Single-token architecture deployment
Use single-token architecture deployment when you are not using virtual nodes (vnodes).
Follow these steps only when you are not using virtual nodes (vnodes).
Prerequisites
- Have a basic understanding of tokens and Database internals.
- DataStax Enterprise is installed on each node.
- Choose a name for the cluster.
- Take note of the total number of nodes in the cluster.
- For a mixed-workload cluster, determine the purpose of each node.
- Determine which nodes are seed nodes and record their IP addresses. Seed nodes provide the means for all the nodes to find each other and learn the topology of the ring.
- If using multiple data centers, develop a naming convention for each data center and rack, for example: DC1, DC2 or 100, 200 and RAC1, RAC2 or R101, R102.
- Other possible configuration settings are described in the cassandra.yaml configuration file.
Procedure
-
Suppose you install DataStax Enterprise on these nodes:
- node0 10.168.66.41 (seed1)
- node1 10.176.43.66
- node2 10.168.247.41
- node3 10.176.170.59 (seed2)
- node4 10.169.61.170
- node5 10.169.30.138
-
Calculate the token assignments using the information on Calculating tokens.
Single Data Center Node Token node0 0 node1 21267647932558653966460912964485513216 node2 42535295865117307932921825928971026432 node3 63802943797675961899382738893456539648 node4 85070591730234615865843651857942052864 node5 106338239662793269832304564822427566080 Multiple Data Centers Node Token Offset Data Center node0 0 NA DC1 node1 56713727820156410577229101238628035242 NA DC1 node2 113427455640312821154458202477256070485 NA DC1 node3 100 100 DC2 node4 56713727820156410577229101238628035342 100 DC2 node5 113427455640312821154458202477256070585 100 DC2 - If the nodes are behind a firewall, open the required ports for internal/external communication. See Configuring firewall port access.
-
If DataStax Enterprise is running, stop the nodes and clear the data:
- Packaged
installs:
$ sudo service dse stop $ sudo rm -rf /var/lib/cassandra/* ## Clears the data from the default directories
- Tarball installs:
From the install directory:
$ sudo bin/dse cassandra-stop $ sudo rm -rf /var/lib/cassandra/* ## Clears the data from the default directories
Note: If you are clearing data from an AMI installation for restart, you need to preserve the log files.
- Packaged
installs:
-
Set the properties in the cassandra.yaml file for each
node.
Important: After making any changes in the cassandra.yaml file, you must restart the node for the changes to take effect.Location:
- Packaged installs: /etc/dse/cassandra/cassandra.yaml
- Tarball installs: install_location/resources/cassandra/conf/cassandra.yaml
Properties to set:
- initial_token: token
- num_tokens: 1
- -seeds: internal_IP_address of each seed node
- listen_address: empty
If not set, Cassandra asks the system for the local address, the one associated with its hostname. In some cases Cassandra doesn't produce the correct address and you must specify the list_address.
- auto_bootstrap: false
Add the bootstrap setting only when initializing a fresh cluster with no data.
- If you are using a cassandra.yaml from a previous
version, remove the following options, as they are no longer supported by
DataStax
Enterprise:
## Replication strategy to use for the auth keyspace. auth_replication_strategy: org.apache.cassandra.locator.SimpleStrategy auth_replication_options: replication_factor: 1
Example:
If using more than one data center, include at least one seed node from each data center. It is a best practice to have more than one seed node per data center.
cluster_name: 'MyDemoCluster' num_tokens: 256 seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "10.168.66.41,10.176.170.59" listen_address:
-
If necessary, change the dse.yaml file on each node to specify the
snitch to be delegated by the DseDelegateSnitch. Be sure to use a data center
and rack-aware snitch. See About Snitches.
- Packaged installs: /etc/dse/dse.yaml
- Tarball installs: install_location/resources/dse/conf/dse.yaml
Example of specifying the PropertyFileSnitch:
delegated_snitch: org.apache.cassandra.locator.PropertyFileSnitch
-
In the cassandra-topology.properties file, use your naming
convention to assign data center and rack names to the IP addresses of each
node, and assign a default data center name and rack name for unknown
nodes.
- Packaged installs: /etc/dse/cassandra/cassandra-topology.properties
- Tarball installs: install_location
Example:
# Cassandra Node IP=Data Center:Rack 10.168.66.41=DC1:RAC1 10.176.43.66=DC2:RAC1 10.168.247.41=DC1:RAC1 10.176.170.59=DC2:RAC1 10.169.61.170=DC1:RAC1 10.169.30.138=DC2:RAC1 # default for unknown nodes default=DC1:RAC1
-
After you have installed and configured DataStax Enterprise on all nodes, start
the seed nodes one at a time, and then start the rest of the nodes:
- Packaged installs: See Starting DataStax Enterprise as a service.
- Tarball installs: See Starting DataStax Enterprise as a stand-alone process.
Note: If the node has restarted because of automatic restart, you must stop the node and clear the data directories, as described above. -
Check that your cluster is up and running:
- Packaged installs: $ nodetool status
- Tarball installs:
$ install_location/bin/nodetool status