Rajesh
Rajesh

Reputation: 29

cqlsh Connection refused

When ever you get a Cassandra cqlsh Connection error as follows:

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")})

Upvotes: 1

Views: 10408

Answers (5)

TARUN BATCHU
TARUN BATCHU

Reputation: 1

just check once already any Cassandra is running by ps ax | grep cassandra

if yes kill that process using pid

kill pid

that worked for me

Upvotes: 0

Hunter
Hunter

Reputation: 21

When I installed Cassandra 3.11.1, I came across this problem. I also found if I ran

service cassandra status

, there is a

cassandra dead but pid file exists

problem. It indicates that the Cassandra service does not start I checked the

/var/log/cassandra/cassandra.log

and found this error:

Exception encountered during startup...

.It is a bug and already reported. The original post link https://issues.apache.org/jira/browse/CASSANDRA-14173.

The solution is to downgrade Cassandra to 3.0

  1. download Cassandra rpm

curl -O https://www.apache.org/dist/cassandra/redhat/30x/cassandra-3.0.15-1.noarch.rpm

or

wget https://www.apache.org/dist/cassandra/redhat/30x/cassandra-3.0.15-1.noarch.rpm

  1. rpm -ivh cassandra-3.0.15-1.noarch.rpm
  2. service cassandra start
  3. service cassandra status # check cassandra status, it should say

cassandra (pid 1234) is running...

  1. cqlsh #start cassandra

Hope this helps you

Upvotes: 0

Eddie Martinez
Eddie Martinez

Reputation: 13910

I was having the same issue with Cassandra 3.11.0, anytime I changed the address of rpc or listen address cqlsh wouldn't work. I had to add the same local ip to seeds

So after trial and error my cassandra.yml looked like:

class-name: org.apache.cassandra.locator.SimpleSeedProvider
parameters: 
    -seeds: "192.168.0.30"

listen_adress: 192.168.0.30
rpc_address: 192.168.0.30

then running

cqlsh 192.168.0.30 9042

Upvotes: 1

Kat
Kat

Reputation: 337

You can also connect without using the IP address - just use the hostname: cqlsh ‘hostname -I’

Upvotes: 2

doanduyhai
doanduyhai

Reputation: 8812

Another solution, type cqlsh <listen_address> [<port>] if it is not set to 127.0.0.1 or localhost

Upvotes: 1

Related Questions