Cassandra is
well suited when it runs in distributed mode in a cluster. It follows
peer to peer cluster mode instead of master/slave architecture. That
makes Cassandra really good in terms of availability and scalability.
Suppose , I have two machines with ip "192.168.1.11" and " 192.168.1.24". We can create a cluster of these machines as follows:
On both of the systems do the following changes in cassandra.yaml file:
1) listen_address-
for example,
On first machine, listen_address-192.168.1.11
On second machine, listen_address-192.168.1.24
2) rpc_address-
Similarly as listen_address
3) Add both ips as seed nodes on each of the machine.
For example,
seed - "192.16.1.11,192.168.1.24"
Make the above change in both of the systems.
4) Start the cassandra deamon on both of the machines
$CASSANDRA_HOME/bin/cassandra -f
5) Run the nodetool on any of the system to check as follows:
$CASSANDRA_HOME/bin/nodetool -h 192.168.1.11 ring
Note: Ownership information does not include topology, please specify a keyspace.
Address
DC Rack Status State Load Owns
Token
125770647146966923544277099442418897726
192.168.1.24
datacenter1 rack1 Up Normal 11.32 KB 49.51%
39864057911651858052466199027576462686
192.168.1.11 datacenter1 rack1 Up Normal 13.52 KB 50.49% 125770647146966923544277099442418897726
$CASSANDRA_HOME/bin/nodetool -h 192.168.1.24 ring
Note: Ownership information does not include topology, please specify a keyspace.
Address
DC Rack Status State Load Owns
Token
125770647146966923544277099442418897726
192.168.1.24
datacenter1 rack1 Up Normal 11.32 KB 49.51%
39864057911651858052466199027576462686
192.168.1.11
datacenter1 rack1 Up Normal 13.52 KB 50.49%
125770647146966923544277099442418897726
That defines how easily we can scale cassandra cluster. We can add another node similarly.
Note: Time and date on all the systems should be in sync.
No comments:
Post a Comment