AlexFisher
AlexFisher

Reputation: 55

Cassandra not started correctly

I try to build Cassandra cluster with 3 nodes

On node 1 i've got a trouble when i try use cqlsh:

Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

In cassandra.yaml i dont't see strings with ip 127.0.0.1, i wrote there correct parametres (in my mind)

cluster_name: 'cassandra_cluster'
seeds: "node_public_ip_1,node_public_ip_2,node_public_ip_3"
listen_address: node_public_ip_1
rpc_adress: node_public_ip_1

in cassandra-topology.properties:

`# Cassandra Node IP=Data Center:Rack`

node_public_ip_1=dc1:rac1 node_public_ip_2=dc1:rac1 node_public_ip_3=dc1:rac1

What i do wrong? Thanks!

Upvotes: 0

Views: 282

Answers (2)

Erick Ramirez
Erick Ramirez

Reputation: 16393

When you run cqlsh without specifying the host, it defaults to localhost (127.0.0.1). You need to specify the client IP address (rpc_address) of the node you want to connect to when running cqlsh.

Also, the standard recommendation for multi-homed servers is to use the private IP for internal cluster comms and the public IP for client connections. This means that in cassandra.yaml you would configure:

listen_address: private_ip
rpc_address: public_ip

Since the seeds are used for seeding cluster communication, you would also configure the seeds list with the nodes' private IP addresses.

Finally, if you're using the old PropertyFileSnitch, you should also configure cassandra-topology.properties with the nodes' private IP addresses.

However, PFS is really old and in almost all cases our recommendation is to use GossipingPropertyFileSnitch since it has all the benefits of being able to expand the cluster in the future without any downsides as I've explained in this post -- https://community.datastax.com/questions/8887/.

It is also a lot simpler to manage GPFS since you only need to set a single node's DC and rack configuration in cassandra-rackdc.properties without having to reconfigure all the nodes whenever you add/remove nodes from the cluster.

When you do switch to GPFS, you should delete cassandra-topology.properties on the nodes to prevent any gossip issues in the future as I've explained in this post -- https://community.datastax.com/questions/4621/. Cheers!

Upvotes: 1

Adelino Silva
Adelino Silva

Reputation: 930

Try run the "nodetool status" and "nodetool describecluster" on both nodes of this cluster to identify the IP used by nodes.

and try connect passing the host/ip. like:

cqlsh <host> <port> -u <user> -p <password>

Upvotes: 0

Related Questions