|Initializing a cluster|
You can use initialize a Cassandra cluster with multiple data centers.
Data replicates across the data centers automatically and transparently; no ETL work is necessary to move data between different systems or servers. You can configure the number of copies of the data in each data center and Cassandra handles the rest, replicating the data for you.
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 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
$ 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: "10.168.66.41,10.176.170.59" listen_address: 10.168.66.41 endpoint_snitch: PropertyFileSnitch
node1 to node5
The properties for these nodes are the same as node0 except for the listen_address.
# 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
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