Cassandra - nodetool无法在另一台机器上运行?

时间:2011-04-13 17:37:50

标签: java cassandra

我在4个节点上有一个cassandra集群(每个节点运行ubuntu 10.04和cassandra 0.7.4)。 所有节点都使用SWITCH连接,每个节点都分配了一个STATIC IP ADDRESS(不涉及DNS)。

节点似乎运行正常(状态为“正常”,所有节点都已启动等)。

问题是:nodetool有效,但只有在同一节点上运行nodetool命令时才有效。当我尝试在 STATIC_IP = 192.168.0.4 上从 STATIC_IP = 192.168.0.253 运行nodetool时,出现以下错误:

(注意:机器's3789'的静态IP为192.168.0.253)

user@s3789:/opt/cassandra/apache-cassandra-0.7.4$ bin/nodetool -host 192.168.0.4 ring

Error connection to remote JMX agent! java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is: java.net.ConnectException: Connection refused at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:128) at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source) at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2343) at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:296) at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:267) at org.apache.cassandra.tools.NodeProbe.connect(NodeProbe.java:137) at org.apache.cassandra.tools.NodeProbe.<init>(NodeProbe.java:107) at org.apache.cassandra.tools.NodeCmd.main(NodeCmd.java:511) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384) at java.net.Socket.connect(Socket.java:546) at java.net.Socket.connect(Socket.java:495) at java.net.Socket.<init>(Socket.java:392) at java.net.Socket.<init>(Socket.java:206) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)

任何提示如何解决这个问题?

2 个答案:

答案 0 :(得分:15)

来自conf / cassandra-env.sh的

# add this if you're having trouble connecting:
# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<public name>"
# 
# see 
# https://blogs.oracle.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole
# for more on configuring JMX through firewalls, etc. (Short version:
# get it working with no firewall first.)

答案 1 :(得分:0)

检查您是否在启动服务器之前启动了rmiregistry

rmiregistry &

Getting started with RMI