Friday, May 4, 2012

Key Value Store - create cassandra multinode cluster

As introducing of installing cassandra before, I am explaining how to create cassandra multinode cluster.

Reference

Create Multinode cluster

  • cassandra nodes
_images/cassandra_node.png
  • Configuring Multinode Cluster 1st node (kvs01)
As cassandra.yaml is for setting up single node by default, it is necessary to change the configurations to create multinode cluster.
# cd /usr/local/apache-cassandra/conf/
# vi cassandra.yaml
auto_bootstrap : false
- seeds: "192.168.213.91"
listen_address: 192.168.213.91
rpc_address: 192.168.213.91
  • difference between the unrevised cassandra.yaml  and revised one
# diff -u cassandra.yaml.bak cassandra.yaml
--- cassandra.yaml.bak 2012-02-22 23:21:44.000000000 +0900
+++ cassandra.yaml     2012-05-04 07:51:31.000000000 +0900
@@ -8,6 +8,7 @@
 # The name of the cluster. This is mainly used to prevent machines in
 # one logical cluster from joining another.
 cluster_name: 'Test Cluster'
+auto_bootstrap : false

 # You should always specify InitialToken when setting up a production
 # cluster for the first time, and often when adding capacity later.
@@ -95,7 +96,7 @@
       parameters:
           # seeds is actually a comma-delimited list of addresses.
           # Ex: "<ip1>,<ip2>,<ip3>"
-          - seeds: "127.0.0.1"
+          - seeds: "192.168.213.91"

 # emergency pressure valve: each time heap usage after a full (CMS)
 # garbage collection is above this fraction of the max, Cassandra will
@@ -178,7 +179,7 @@
 # address associated with the hostname (it might not be).
 #
 # Setting this to 0.0.0.0 is always wrong.
-listen_address: localhost
+listen_address: 192.168.213.91

 # Address to broadcast to other Cassandra nodes
 # Leaving this blank will set it to the same value as listen_address
@@ -190,7 +191,7 @@
 #
 # Leaving this blank has the same effect it does for ListenAddress,
 # (i.e. it will be based on the configured hostname of the node).
-rpc_address: localhost
+rpc_address: 192.168.213.91
 # port for Thrift to listen for clients on
 rpc_port: 9160
  • restart daemon
# pgrep -f cassandra | xargs kill -9
# /usr/local/apache-cassandra/bin/cassandra
  • Configuring Multinode Cluster other node (kvs02,kvs03)
 listen_address and rpc_address are replaced with those of each servers'
It is no need to enable auto_bootstrap as cassandra-1.x is enabled by default.
# cd /usr/local/apache-cassandra/conf/
# vi cassandra.yaml
- seeds: "192.168.213.91"
listen_address: 192.168.213.92
rpc_address: 192.168.213.92
  • difference between the unrevised cassandra.yaml  and revised one
# diff -u cassandra.yaml.bak cassandra.yaml
--- cassandra.yaml.bak 2012-03-23 04:00:43.000000000 +0900
+++ cassandra.yaml     2012-05-04 08:44:14.000000000 +0900
@@ -8,6 +8,7 @@
 # The name of the cluster. This is mainly used to prevent machines in
 # one logical cluster from joining another.
 cluster_name: 'Test Cluster'
+auto_bootstrap: true

 # You should always specify InitialToken when setting up a production
 # cluster for the first time, and often when adding capacity later.
@@ -95,7 +96,7 @@
       parameters:
           # seeds is actually a comma-delimited list of addresses.
           # Ex: "<ip1>,<ip2>,<ip3>"
-          - seeds: "localhost"
+          - seeds: "192.168.213.91"

 # emergency pressure valve: each time heap usage after a full (CMS)
 # garbage collection is above this fraction of the max, Cassandra will
@@ -178,7 +179,7 @@
 # address associated with the hostname (it might not be).
 #
 # Setting this to 0.0.0.0 is always wrong.
-listen_address: localhost
+listen_address: 192.168.213.92

 # Address to broadcast to other Cassandra nodes
 # Leaving this blank will set it to the same value as listen_address
@@ -190,7 +191,7 @@
 #
 # Leaving this blank has the same effect it does for ListenAddress,
 # (i.e. it will be based on the configured hostname of the node).
-rpc_address: localhost
+rpc_address: 192.168.213.92
 # port for Thrift to listen for clients on
 rpc_port: 9160
  • restart daemon
# pgrep -f cassandra | xargs kill -9
# /usr/local/apache-cassandra/bin/cassandra
  • Verify ring status
# nodetool -h localhost ring
Address         DC          Rack        Status State   Load            Owns    Token
                                                                               100438156989107092060814573762535799562
192.168.213.92  datacenter1 rack1       Up     Normal  53.6 KB         93.47%  89332387546649365392870509741689618961
192.168.213.93  datacenter1 rack1       Up     Normal  49.19 KB        3.26%   94885272267878228726842541752112709261
192.168.213.91  datacenter1 rack1       Up     Normal  55.71 KB        3.26%   100438156989107092060814573762535
 Finally, I'm introducing of the monitoring phase next.

No comments:

Post a Comment

iJAWS@Doorkeeper