Vishal Sharma
Vishal Sharma

Reputation: 1750

Unable to run cqlsh(connection refused)

I'm getting a connection error "unable to connect to any server" when I run .cqlsh command from the bin directory of my node.

I'm using an edited yaml file containing only the following(rest all values present in the default yaml have been omitted) :

cluster name, num tokens, partitioner, data file directories, commitlog directory, commitlog sync, commitlog sync period, saved cache directory, seed provider info, listen address and endpoint snitch.

Is this error because I've not included some important parameter in the yaml like rpc address? Please help.

OS: RHEL 6.9 Cassandra: 3.0.14

Upvotes: 1

Views: 2038

Answers (2)

Chakri Stark
Chakri Stark

Reputation: 176

  1. The cassandra yaml file can have modified values, but you should not delete the rows and make your own yaml file. And yes, rpc address is needed in yaml file.
  2. In writing the directories like data_file_directories, you should follow the same indentation as:

     data_file_directories - 
          /path/to/access
    

Cassandra is very strict at it's indentation in yaml file. I once faced an issue due to this wrong indentation in data_file_directories.

  1. Finally, run ./cqlsh , provide ip_address if it is a remote server.
  2. Check the nodetool status and confirm whether the node is up and normal.

Upvotes: 1

TomerSan
TomerSan

Reputation: 1578

Check the following:

  1. Cassandra is running: nodetool status / ps -elf | grep cassa
  2. Port 9042 (default for CQL) is not used by something else: netstat -an | grep 9042
  3. Try running cqlsh `hostname -i`

Good luck.

Upvotes: 0

Related Questions