Namespaces
Oxia can partition the data in different namespaces. Application can use namespaces to isolate different use cases and also have more visibility in the metrics, which are going to be labeled with the namespace as well.
Each namespace has its own independent key-space and set of shards.
Using a namespace
When creating an Oxia client, it’s possible to specify the namespace to be used. If not provided,
the client will use the default
namespace.
Go
client, err := oxia.NewClient("localhost:6648", oxia.WithNamespace("my-namespace"))
Creating a new namespace
Edit the coordinator configuration. Eg. on Kubernetes it would be stored in a config map
kubectl --namespace oxia edit configmap oxia-coordinator
Add a section for my-new-namespace
, specifying the initial shard count and replication factor.
config.yaml: |
namespaces:
- name: default
initialShardCount: 3
replicationFactor: 3
- name: my-new-namespace
initialShardCount: 5
replicationFactor: 3
servers:
- public: oxia-0.oxia-svc.oxia.svc.cluster.local:6648
internal: oxia-0.oxia-svc:6649
- public: oxia-1.oxia-svc.oxia.svc.cluster.local:6648
internal: oxia-1.oxia-svc:6649
- public: oxia-2.oxia-svc.oxia.svc.cluster.local:6648
internal: oxia-2.oxia-svc:6649
The Oxia coordinator will automatically detect the change and will create the shards for the namespace.
Namespace configuration
Name | Description | Default |
---|---|---|
initialShardCount | Number of shards to split the namespace | |
replicationFactor | Replication factor for the shards | |
notificationsEnabled | Whether the namespace should have notification feature enabled | true |
Deleting a namespace
Once the namespace is removed from the config.yaml
, the Oxia coordinator will again immediately
pick up the change and will instruct the Oxia servers to remove the shards for this namespace.