STEPS TO CONFIGURE MULTIPLE NODES CASSANDRA ON A SINGLE WINDOWS MACHINE

 

      To get started, you would have to update the windows hosts file. The windows host file is located at :

 

C:\Windows\System32\drivers\etc

 

     Update the file with the following entries:

    You might need to open the file as an administrator in order to save the entries.

 

127.0.0.1 127.0.0.2 
127.0.0.1 127.0.0.3 
127.0.0.1 127.0.0.4 

   

 

    Download cassandra next from its apache site.

 

    Create the folder structure for your cassandra installation. Something like the below:

 

c:\opt\cassandra\
c:\opt\cassandra\1
c:\opt\cassandra\2
c:\opt\cassandra\3                 

 

 

 

Image
cassandra_multi_node_folder_structure_0

Extract the cassandra distribution file into folder 1,2 and 3:

 

 

 

cassandra_multi_node_folder_structure_expanded_0

 

 

  Configure cassandra.yaml file in each of  the cassandra nodes.

 

Edit the following entries with the values below:

 

File name:

C:\opt\cassandra\1\conf\cassandra.yaml

 

 File entries:

cluster_name: 'YourClusterName'

data_file_directories:
     - /opt/cassandra/1/data


commitlog_directory: /opt/cassandra/1/commitlog


saved_caches_directory: /opt/cassandra/1/saved_caches


seed_provider:
    # Addresses of hosts that are deemed contact points. 
    # Cassandra nodes use this list of hosts to find each other and learn
    # the topology of the ring.  You must change this if you are running
    # multiple nodes!
    - class_name: org.apache.cassandra.locator.SimpleSeedProvider
      parameters:
          # seeds is actually a comma-delimited list of addresses.
          # Ex: "<ip1>,<ip2>,<ip3>"
          - seeds: "127.0.0.2"

listen_address: 127.0.0.2


rpc_address: 127.0.0.2

 

 

 

File name:

C:\opt\cassandra\2\conf\cassandra.yaml

 

 File entries:

cluster_name: 'YourClusterName'

data_file_directories:
     - /opt/cassandra/2/data


commitlog_directory: /opt/cassandra/2/commitlog


saved_caches_directory: /opt/cassandra/2/saved_caches


seed_provider:
    # Addresses of hosts that are deemed contact points. 
    # Cassandra nodes use this list of hosts to find each other and learn
    # the topology of the ring.  You must change this if you are running
    # multiple nodes!
    - class_name: org.apache.cassandra.locator.SimpleSeedProvider
      parameters:
          # seeds is actually a comma-delimited list of addresses.
          # Ex: "<ip1>,<ip2>,<ip3>"
          - seeds: "127.0.0.2"

listen_address: 127.0.0.3


rpc_address: 127.0.0.3

 

 

File name:

C:\opt\cassandra\3\conf\cassandra.yaml

 

 File entries:

cluster_name: 'YourClusterName'

data_file_directories:
     - /opt/cassandra/3/data


commitlog_directory: /opt/cassandra/3/commitlog


saved_caches_directory: /opt/cassandra/3/saved_caches


seed_provider:
    # Addresses of hosts that are deemed contact points. 
    # Cassandra nodes use this list of hosts to find each other and learn
    # the topology of the ring.  You must change this if you are running
    # multiple nodes!
    - class_name: org.apache.cassandra.locator.SimpleSeedProvider
      parameters:
          # seeds is actually a comma-delimited list of addresses.
          # Ex: "<ip1>,<ip2>,<ip3>"
          - seeds: "127.0.0.2"

listen_address: 127.0.0.3


rpc_address: 127.0.0.3

 

 

 

    Edit JMX port for nodes 

    The next step is configure each of the cassandra's nodes JMX port to point to different port numbers.

Open up cassandra.bat file for each of your nodes under the bin directory and look for the value:

-Dcassandra.jmx.local.port

 

For my installations I changed mine like this:

 

C:\opt\cassandra\1\bin\cassandra.bat
      -Dcassandra.jmx.local.port=7199


C:\opt\cassandra\2\bin\cassandra.bat
      -Dcassandra.jmx.local.port=7299


C:\opt\cassandra\3\bin\cassandra.bat
      -Dcassandra.jmx.local.port=7399

 

 

 Test your installation

 

Open the bin directory for each node.   Start up the first node.

C:\opt\cassandra\1\bin>cassandra.bat -f

 

The output on the console should look like this:

cassandra_first_node_startup

 

Next start up the other two nodes:

C:\opt\cassandra\2\bin>cassandra.bat -f

C:\opt\cassandra\3\bin>cassandra.bat -f

 

 

Now take a look at the first node's console. You should see the other nodes joining the cluster.

cassandra_cluster_nodes_ack

 

You can also confirm by checking the nodetool status

cassandra_nodetool_status

 

 

Thanks for reading.