The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.
Title
How do I add a strong consistency namespace to an existing cluster?
Problem Description
I have a cluster that needs to have a strong consistency enabled namespace added to it.
Explanation
Aerospike server version 4.0 introduces a new mode for configuring a namespace with strong consistency (vs. default of AP). Refer to the Strong Consistency Guide for details about this mode. In order to add a namespace that is AP enabled, please see this knowledge-base article on adding namespace. For a strong consistency namespace, you would need to follow the steps below in order to have the cluster configured correctly.
Solution
Part 1: Add Namespace
- Edit the aerospike.conf file to contain the new strong consistency namespace. If you have a rack-aware enabled cluster, you would need to add
rack-id
as well to the configuration.
namespace <ns_name> {
---
strong-consistency true
---
}
Configuration reference to strong consistency.
- Stop the Aerospike service
sudo service aerospike stop
- Start the Aerospike service
sudo service aerospike start
Make sure the node has joined the cluster prior to proceeding to the next step.
- Repeat steps 1-3 for each node in the cluster in a rolling manner. You usually do not need to wait for migrations to complete between each restart (unless if some namespaces are configured as storage-engine memory, or if the use case requires deleting the stored data whenever a node leaves the cluster (for example if records are potentially non durably deleted while a node is out of the cluster).
Part 2 - Create the Roster
- From within asadm, get the list of nodes with the namespace definition
Admin> asinfo –v "roster:namespace=<ns_name>"
Details on roster
command.
- Set the roster to the observed_nodes
Admin> asinfo –v "roster-set:namespace=<ns_name>;nodes=[observed nodes list]"
The observed nodes list is an actual list of node names displayed as a result of the command from step 2 in this section
Details on roster-set
command
Note for rack aware: In order to maintain the configured rack aware setting you need to append @rack-id to each node-id (as displayed in the observed node list).
Admin> asinfo –v "roster-set:namespace=<ns_name>;nodes=<node name>@101,<node name>@102,<node name>@101,…"
The rack-id numbers listed above will be taking effect. The rack-id setting in the aerospike.conf file associated with each node is only used to populate the observed node list and facilitate the creation of the roster but is otherwise not used.
- Validate your roster
Admin> asinfo –v "roster:"
Notice that the roster is null but pending_roster is set with the provided list of nodes.
- Apply the pending_roster (Only the principal will respond with “ok” to this command, the rest will ignore it).
Admin> asinfo –v "recluster:"
Details on recluster
command
- Verify that the new roster was applied
Admin> asinfo –v "roster:"
- Validate that the namespace cluster size agrees with the service cluster size
Admin> show stat –flip like cluster_size
Notes
Documentation reference for Strong consistency
- https://www.aerospike.com/docs/guide/consistency.html
- https://www.aerospike.com/docs/architecture/consistency.html
Keywords
strong consistency SC add namespace roster
Timestamp
05/18/2018