I am trying to use JMX nodetool distantly. I cannot configure JMX to listen on the public network interface whereas Cassandra does listen on public interface.
Note it is not Cassandra connection, but JMX connection. Cassandra is available on public interface port 9042.
netstat -planet | grep 7199
gives
127.0.0.1:7199
and nodetool -h
consistently fails.
With ./cassendra-env.sh, I set LOCAL_JMX=no
-Dcom.sun.management.jmxremote.host=<public_ip>
-Djava.rmi.server.hostname=<public_ip>
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
I tried, without success, to put the parameters also in jvm11-server.options.
JMX keeps binding to 127.0.0.1.
Do I miss something?
(Tryng to use JMX distantly)
Running Cassandra 4.1.4 with Java 11.
I am trying to use JMX nodetool distantly. I cannot configure JMX to listen on the public network interface whereas Cassandra does listen on public interface.
Note it is not Cassandra connection, but JMX connection. Cassandra is available on public interface port 9042.
netstat -planet | grep 7199
gives
127.0.0.1:7199
and nodetool -h
consistently fails.
With ./cassendra-env.sh, I set LOCAL_JMX=no
-Dcom.sun.management.jmxremote.host=<public_ip>
-Djava.rmi.server.hostname=<public_ip>
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
I tried, without success, to put the parameters also in jvm11-server.options.
JMX keeps binding to 127.0.0.1.
Do I miss something?
(Tryng to use JMX distantly)
Running Cassandra 4.1.4 with Java 11.
Share Improve this question edited Nov 20, 2024 at 5:54 Erick Ramirez 16.4k2 gold badges21 silver badges31 bronze badges asked Nov 19, 2024 at 15:20 Alain JosserandAlain Josserand 11 silver badge1 bronze badge 2- Welcome to Stack Overflow! A friendly reminder that this site is for getting help with coding, algorithm, or programming language problems so I voted to have your post moved to DBA Stack Exchange. For future reference, you should post DB admin/ops questions on dba.stackexchange/questions/ask?tags=cassandra. Cheers! – Erick Ramirez Commented Nov 20, 2024 at 6:34
- @ErickRamirez IMO interacting with Java arguments to configure JVM management settings is a programming topic. – dan1st Commented Nov 20, 2024 at 12:46
1 Answer
Reset to default 1The minimum requirement to enable remote JMX access is to set LOCAL_JMX
to any value other than yes
.
In my test environment, I added the following line to conf/cassandra-env.sh
:
LOCAL_JMX=no
I didn't enable authentication or SSL to keep it simple and left the configuration with just:
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"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
fi
With this minimal configuration, the Cassandra process is listening for JMX connections on all interfaces. For example:
$ sudo lsof -nPi | grep 7199
java 4544 erick 78u IPv4 73723 0t0 TCP *:7199 (LISTEN)
$ sudo netstat -tnlp | grep 7199
tcp 0 0 0.0.0.0:7199 0.0.0.0:* LISTEN 4544/java
There's a good chance that you've misconfigured something in your environment. For the record, I did not modify any other configuration file other than cassandra-env.sh
. Cheers!