简体   繁体   中英

Cassandra Refusing Connection

I'm using VPS with CentOS 6.6.

For two days I'm trying to start Cassandra that I've already installed.

Its CLI is just not working and giving me error. I have tried all online solutions and none worked.

root@maw [/etc/cassandra/conf]# cassandra-cli -h localhost
org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused
        at org.apache.thrift.transport.TSocket.open(TSocket.java:185)
        at org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:81)
        at org.apache.cassandra.thrift.TFramedTransportFactory.openTransport(TFramedTransportFactory.java:41)
        at org.apache.cassandra.cli.CliMain.connect(CliMain.java:65)
        at org.apache.cassandra.cli.CliMain.main(CliMain.java:237)
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:392)
        at java.net.Socket.connect(Socket.java:579)
        at org.apache.thrift.transport.TSocket.open(TSocket.java:180)
        ... 4 more
Exception connecting to localhost/9160. Reason: Connection refused.
Welcome to Cassandra CLI version 2.0.14

The CLI is deprecated and will be removed in Cassandra 3.0.  Consider migrating to cqlsh.
CQL is fully backwards compatible with Thrift data; see http://www.datastax.com/dev/blog/thrift-to-cql3

Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.

[default@unknown]

I have also tried cqlsh and it gives similar error:

root@maw [/etc/cassandra/conf]# cqlsh
Connection error: Could not connect to localhost:9160

Please help.

The problem was Java.

It needs Oracle Java. I was using Open Java.

After changing Java to Oracle Java, it worked.

There can be many problems with cassandra not allowing the connection. Just mentioning the check-points which you can follow to solve the issue 1) Basic check if cassandra is running - service cassandra status 2) If you are using cassandra 2.0 or later then make sure it is running on the oracle java7 not java6 3) Check you rpc_address and listen_address settings in cassandra.yaml 4) Make sure firewall is not blocking any of the ports required by cassandra.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM