1
votes

I have created 2 node cassandra cluster with below configurations.
Node-1:
cassandra-topology.properties:

192.168.1.177=DC1:RAC1
192.168.1.134=DC2:RAC2

cassandra.yml:

cluster_name: 'TestCluster'
num_tokens: 256  
listen_address:  
rpc_address: localhost 
- seeds: "192.168.1.177,192.168.1.134"  
endpoint_snitch: GossipingPropertyFileSnitch

Node-2:
cassandra-topology.properties:

192.168.1.177=DC1:RAC1  
127.0.0.1=DC2:RAC2 # Also tried 192.168.1.134 ip

cassandra.yml:

 cluster_name: 'TestCluster'  
    num_tokens: 256 
    listen_address:  
    rpc_address: localhost 
    - seeds: "192.168.1.177"  
    endpoint_snitch: GossipingPropertyFileSnitch 

I can see both the nodes are up and running using 'nodetool status' command. The Keyspace i have created is as below:

 > CREATE  KEYSPACE testReplication WITH replication = {'class':  NetworkTopologyStrategy', 'DC1' : '2', 'DC2' : '2'};

I can also create tables which gets replicated to both the nodes, but when i try to 'INSERT' or 'SELECT' on the table cqlsh gives 'NoHostAvailable:', but system.log is not showing anything about it.

Any help will be appreciated.
Thanks.

1

1 Answers

0
votes

In cassandra.yaml in each node, put your node ip torpc_address: and listen_address: and try to put seeds: same for each node (DC1 and DC2). And also for cassandra-topology.properties, put the same configuration for each node. So, for example your Node-1 configuration will looks like:

cluster_name: 'TestCluster'
num_tokens: 256  
listen_address: 192.168.1.177
rpc_address: 192.168.1.177
- seeds: "192.168.1.177,192.168.1.134"  
endpoint_snitch: GossipingPropertyFileSnitch

And for each node, cassandra-topology.properties:

192.168.1.177=DC1:RAC1
192.168.1.134=DC2:RAC2