从IntelliJ运行Cassandra并获得错误"连接被拒绝"

时间:2017-03-08 00:53:51

标签: cassandra ubuntu-16.04

我尝试使用以下配置在我的系统上试验Cassandra:

OS: Ubuntu 16.04 LTS
Kernel: 4.10.1
Cassandra source GitHub link: https://github.com/apache/cassandra
Setup process on IntelliJ link: https://wiki.apache.org/cassandra/RunningCassandraInIDEA

我打开一个终端并从Cassandra源代码的根目录运行以下命令,没有任何失败:

bin/cassandra -f (it starts Cassandra successfully)
bin/nodetool status (Get information about the node e.g. datacenter, status etc.)
bin/cqlsh (opens the interface for running the queries)

但是,当我按照IntelliJ的设置过程进行操作时,我可以通过点击" 运行"从IntelliJ启动服务器。但是" nodetool status "命令总是返回以下错误:

Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection refused (Connection refused).

有趣的是,当我运行" bin / cqlsh"命令,它连接成功,这意味着节点运行正常。

知道可能导致什么" nodetool status "返回"连接拒绝"? 我也尝试关闭防火墙,但没有帮助。

1 个答案:

答案 0 :(得分:0)

通过添加更多VM参数修复了此问题,如下所示:

Add the following VM arguments if you want to use nodetool

-Djava.rmi.server.hostname=$JMX_HOST (I entered 127.0.0.1)
-Dcom.sun.management.jmxremote.port=$JMX_PORT (I entered 7199)
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

以下是供参考的链接:https://wiki.apache.org/cassandra/RunningCassandraInEclipse

使用IntelliJ的Cassandra设置的wiki页面中未提供这些VM参数:https://wiki.apache.org/cassandra/RunningCassandraInIDEA(也在我的问题中发布)。