在同一集群中的远程主机上使用 Nodetool 命令时出现问题

Nodetool command having issue when using it on remote host in the same cluster

如果我们运行 nodetool 用于来自同一集群中节点的任何其他主机,我们会收到错误。虽然它适用于本地主机。

nodetool -h 10.241.17.81 status 
nodetool: Failed to connect to '10.241.17.81:7199' - ConnectException: 'Connection refused'.

这里,10.241.17.81是同一个集群的远程主机。

在cassandra-env.sh中添加JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=10.241.17.81"并重启节点后还是不行

是否有与broadcast_rpc_address相关的内容?

rpc_address: 0.0.0.0
broadcast_rpc_address: 10.241.17.81
rpc_port: 9160
rpc_keepalive: true

您需要在 cassandra-env.sh 中更改以下内容:

if [ "x$LOCAL_JMX" = "x" ]; then
    LOCAL_JMX=yes

if [ "x$LOCAL_JMX" = "x" ]; then
    LOCAL_JMX=no

JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true" 

JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false" 

并重启节点。

此外,在进行这些更改之前,请务必使用以下命令检查您的主机:

netstat -antp.