Cassandra不会在OSX上启动“原因:连接被拒绝了”。

时间:2014-12-04 09:41:23

标签: java cassandra

我正在处理一个java项目,其中cassandra包含在存储库本身中。我无法让它运行,但收到​​以下错误:

/Users/xxx/dev/xxxx/build/cassandra/bin/cassandra-cli -h localhost -p 9052 -f 

/Users/xxx/dev/xxxx/schema.txt
return code: 0
stderr: 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:73)
    at org.apache.cassandra.cli.CliMain.main(CliMain.java:249)
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:178)
    ... 3 more
Exception connecting to localhost/9052. Reason: Connection refused.

stdout: Not connected to a cassandra instance.
Not connected to a cassandra instance.

我尝试将端口和localhost主机名更改为127.0.0.1和0.0.0.0,但这没有任何区别。

我使用的是java版本" 1.7.0_71"

任何想法都将不胜感激,谢谢

1 个答案:

答案 0 :(得分:1)

问题是cassandra尝试启动不在我的/etc/hosts文件中的主机名。 我通过运行/Users/xxx/dev/xxxx/build/cassandra/bin/cassandra -f找到了哪个主机名,这样可以更好地输出问题。