steps to configure multiple nodes cassandra on a single windows machine

 

 

      To get started, you would have to update you 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 

   

 

    The next would be to download cassandra from its apache site.

 

    Next, create the folder structure for your cassandra installation. Something like the below image would work just fine:

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

 

cassandra multi node folder structure

 

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

 

cassandra multi node folder structure expanded

 

 

      The next step is to configure cassandra.yaml 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

 

 

You can also confirm by checking the nodetool status

 

cassandra nodetool status

 

 

That's all folks. Thanks for reading.

Add new comment