|Initializing a cluster|
You can use initialize a Cassandra cluster with a single data center.
This example describes installing a six node cluster spanning two racks in a single data center. Each node is configured to use the RackInferringSnitch (multiple rack aware) and 256 virtual nodes (vnodes). It is recommended to have more than one seed node per data center.
In Cassandra, the term data center is a grouping of nodes. Data center is synonymous with replication group, that is, a grouping of nodes configured together for replication purposes.
node0 188.8.131.52 (seed1) node1 184.108.40.206 node2 220.127.116.11 node3 18.104.22.168 (seed2) node4 22.214.171.124 node5 126.96.36.199
$ sudo service cassandra stop
$ sudo rm -rf /var/lib/cassandra/*
$ ps auwx | grep cassandra $ sudo kill <pid>
$ cd <install_location> $ sudo rm -rf /var/lib/cassandra/*
cluster_name: 'MyDemoCluster' num_tokens: 256 seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "188.8.131.52,184.108.40.206" listen_address: 220.127.116.11 rpc_address: 0.0.0.0 endpoint_snitch: RackInferringSnitch
node1 to node5
The properties for these nodes are the same as node0 except for the listen_address.
If the node has restarted because of automatic restart, you must stop the node and clear the data directories, as described above.
For packaged installs, run the following command:
$ sudo service cassandra start
For binary installs, run the following commands:
$ cd <install_location> $ bin/cassandra