Skip to content

Commit f5c2314

Browse files
committed
Namespaces feature
1 parent 2ae1d09 commit f5c2314

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import {Tabs} from 'nextra/components'
2+
3+
# Namespaces
4+
5+
Oxia can partition the data in different namespaces. Application can use namespaces to isolate different use cases
6+
7+
Each namespace has its own independent set of shards and
8+
9+
## Using a namespace
10+
11+
When creating an Oxia client, it's possible to specify the namespace to be used. If not provided,
12+
the client will use the `default` namespace.
13+
14+
<Tabs items={['Go', 'Java', 'CLI']}>
15+
<Tabs.Tab>
16+
```go
17+
client, err := oxia.NewClient("localhost:6648", oxia.WithNamespace("my-namespace"))
18+
```
19+
</Tabs.Tab>
20+
<Tabs.Tab>
21+
```java
22+
SyncOxiaClient client = OxiaClientBuilder.create("localhost:6648")
23+
.namespace("my-namespace")
24+
.syncClient();
25+
```
26+
</Tabs.Tab>
27+
<Tabs.Tab>
28+
```shell
29+
oxia client --namespace my-namespace put my-key my-value
30+
```
31+
</Tabs.Tab>
32+
</Tabs>
33+
34+
35+
## Creating a new namespace
36+
37+
Edit the coordinator configuration. Eg. on Kubernetes it would be stored in a config map
38+
39+
```shell
40+
kubectl --namespace oxia edit configmap oxia-coordinator
41+
```
42+
43+
Add a section for `my-new-namespace`, specifying the initial shard count and replication factor.
44+
45+
```yaml {6-8}
46+
config.yaml: |
47+
namespaces:
48+
- name: default
49+
initialShardCount: 3
50+
replicationFactor: 3
51+
- name: my-new-namespace
52+
initialShardCount: 5
53+
replicationFactor: 3
54+
servers:
55+
- public: oxia-0.oxia-svc.oxia.svc.cluster.local:6648
56+
internal: oxia-0.oxia-svc:6649
57+
- public: oxia-1.oxia-svc.oxia.svc.cluster.local:6648
58+
internal: oxia-1.oxia-svc:6649
59+
- public: oxia-2.oxia-svc.oxia.svc.cluster.local:6648
60+
internal: oxia-2.oxia-svc:6649
61+
```
62+
63+
The Oxia coordinator will automatically detect the change and will create the shards for the namespace.
64+
65+
### Namespace configuration
66+
67+
| Name | Description | Default |
68+
|------------------------|----------------------------------------------------------------|---------|
69+
| `initialShardCount` | Number of shards to split the namespace | |
70+
| `replicationFactor` | Replication factor for the shards | |
71+
| `notificationsEnabled` | Whether the namespace should have notification feature enabled | `true` |
72+
73+
## Deleting a namespace
74+
75+
Once the namespace is removed from the `config.yaml`, the Oxia coordinator will again immediately
76+
pick up the change and will instruct the Oxia servers to remove the shards for this namespace.

0 commit comments

Comments
 (0)