user1795516
user1795516

Reputation: 491

Cassandra-Cli refusing connection

I am trying to connect to cassandra. I installed the latest stable version that is apache-cassandra-1.2.4 and extracted it on my desktop. As I run cassandra it sets up nicely listening for thrift client and displaying following :

sudo cassandra -f

log :

 INFO 15:30:34,646 Cassandra version: 1.0.12
 INFO 15:30:34,646 Thrift API version: 19.20.0
 INFO 15:30:34,646 Loading persisted ring state
 INFO 15:30:34,650 Starting up server gossip
 INFO 15:30:34,661 Enqueuing flush of Memtable-LocationInfo@1117603949(29/36 serialized/live bytes, 1 ops)
 INFO 15:30:34,661 Writing Memtable-LocationInfo@1117603949(29/36 serialized/live bytes, 1 ops)
 INFO 15:30:34,877 Completed flushing /var/lib/cassandra/data/system/LocationInfo-hd-54-Data.db (80 bytes)
 INFO 15:30:34,892 Starting Messaging Service on port 7000
 INFO 15:30:34,901 Using saved token 143186062733850112297005303551620336860
 INFO 15:30:34,903 Enqueuing flush of Memtable-LocationInfo@1282534304(53/66 serialized/live bytes, 2 ops)
 INFO 15:30:34,904 Writing Memtable-LocationInfo@1282534304(53/66 serialized/live bytes, 2 ops)
 INFO 15:30:35,102 Completed flushing /var/lib/cassandra/data/system/LocationInfo-hd-55-Data.db (163 bytes)
 INFO 15:30:35,106 Node localhost/127.0.0.1 state jump to normal
 INFO 15:30:35,107 Bootstrap/Replace/Move completed! Now serving reads.
 INFO 15:30:35,108 Will not load MX4J, mx4j-tools.jar is not in the classpath
 INFO 15:30:35,150 Binding thrift service to localhost/127.0.0.1:9160
 INFO 15:30:35,155 Using TFastFramedTransport with a max frame size of 15728640 bytes.
 INFO 15:30:35,160 Using synchronous/threadpool thrift server on localhost/127.0.0.1 : 9160
 INFO 15:30:35,168 Listening for thrift clients...

Now as I run : cassandra-cli -h localhost -p 9160, it throws up the error. I have checked for the port to be free and cassandra is listening at the port. :

**

org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused
    at org.apache.thrift.transport.TSocket.open(TSocket.java:183)
    at org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:81)
    at org.apache.cassandra.cli.CliMain.connect(CliMain.java:80)
    at org.apache.cassandra.cli.CliMain.main(CliMain.java:256)
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
    at java.net.Socket.connect(Socket.java:579)
    at org.apache.thrift.transport.TSocket.open(TSocket.java:178)
    ... 3 more
Exception connecting to localhost/9160. Reason: Connection refused.

**

Upvotes: 0

Views: 6033

Answers (3)

madheswaran
madheswaran

Reputation: 196

Option 1:

Run jps command under root user and kill CassandraDaemon if you will see it. After this you will start Cassandra again.

Option2:

Try to connect Cassandra with CQL 
  ./cqlsh 10.234.31.232 9042

Final Check:

An intermediate firewall is blocking the JVM from making the connection. 
An operating system firewall, or antivirus that is causing the problems as well.

I think you installed in windows and looks like firewall is blocking your connection.

Upvotes: 0

diguage
diguage

Reputation: 397

I had the same error.Now, it is OK.

The main problem is that the configuration is wrong.

My configuration is as following:

My visual machine ip is 192.168.11.11.My cassandra was installed into the machine.So, I configurate thar

listen_address: 192.168.11.11
rpc_address: 0.0.0.0
broadcast_rpc_address: 192.168.11.11

That is OK。

Upvotes: 1

mmukhe
mmukhe

Reputation: 668

The documentation of cassandra-stress seems to be sketchy. Maybe in due course that would be corrected. As of now, this command worked for me

./cassandra-stress write -node <IP_OF_NODE1>

Once this works, we could try putting in the other optional parameters to tweak our command.

Upvotes: 0

Related Questions