【发布时间】:2018-05-17 18:01:04
【问题描述】:
我使用的是 Cassandra 3.11.2,无法在特定接口上绑定 JMX。
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
netstat -l
tcp 0 0 *:7199 *:* LISTEN
我的 cassandra-env.sh 如下:
if [ "x$LOCAL_JMX" = "x" ]; then
LOCAL_JMX=no
fi
# Specifies the default port over which Cassandra will be available for
# JMX connections.
# For security reasons, you should not expose this port to the internet. Firewall it if needed.
JMX_PORT="7199"
if [ "$LOCAL_JMX" = "yes" ]; then
JVM_OPTS="$JVM_OPTS -Dcassandra.jmx.local.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
else
JVM_OPTS="$JVM_OPTS -Dcassandra.jmx.remote.port=$JMX_PORT"
# if ssl is enabled the same port cannot be used for both jmx and rmi so either
# pick another value for this property or comment out to use a random port (though see CASSANDRA-7087 for origins)
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=192.168.8.60"
fi
我的印象是 Djava.rmi.server.hostname 会设置 jxm 监听主机。 JMX 连接在这种情况下可以正常工作。
编辑: 它现在正在工作,但我与 JMX 主机的连接被拒绝
root@server:/etc/cassandra# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:domain *:* LISTEN
tcp 0 0 192.168.1.100:7199 *:* LISTEN
root@server:/etc/cassandra# nodetool -h 192.168.1.100 status
nodetool: Failed to connect to '192.168.1.100:7199' - ConnectException: 'Connection refused (Connection refused)'
【问题讨论】: