Cassandra cluster design does not allow you to run two nodes in a single host (machine). However, there are alternative methods to simulate two hosts in a single machine by adding virtual ethernet devices to the host on which we plan to run the Cassandra cluster.
This setup includes two virtual ethernet devices on the default ethernet device (e.g., eth0). Since we run two Carbon servers in one machine, some ports may try to bind with the default device and this results in port conflicts. Therefore we are going to offset one WSO2 SS instance by 10.
Users can configure the
<PRODUCT_HOME>/repository/conf/carbon.xml file or the
-Doffset option to offset a Carbon server. When offsetting takes place, all the nodes are shifted by the offset. It is necessary to set the Cassandra storage port (cluster port) into a common value (7000). Cassandra related port’s base values can be set via system variables as explained in this tutorial.
Create two IP aliases:
- Configure cassandra.yaml in node 0 and node 1.
In node 0:
In node 1:
<PRODUCT_HOME>/repository/conf/etc/hector-config.xmlin node 0.
<PRODUCT_HOME>/repository/conf/etc/hector-config.xmlin node 1.
- Start the cluster.
Node 0 configurations: Use the
--startcommand to start node 0.
- Node 1 configurations:
<PRODUCT_HOME>/bin/wso2server.shfile as follows:
--startcommand to start node 1.
You can verify the status of the cluster using a
Also you can check the listening port using a
You can now connect to the cluster using the