我在Centos6上使用JDK8运行Tomcat8.我使用以下选项启用JMX:
CATALINA_OPTS="${CATALINA_OPTS} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9123 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=true"
Run Code Online (Sandbox Code Playgroud)
不幸的是,当我检查打开了哪些端口时,我发现这些端口会监听所有IP:
netstat -plunt | grep java
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::60555 :::* LISTEN 22752/java
tcp 0 0 ::ffff:127.0.0.1:8080 :::* LISTEN 22752/java
tcp 0 0 :::9123 :::* LISTEN 22752/java
tcp 0 0 :::40867 :::* LISTEN 22752/java
Run Code Online (Sandbox Code Playgroud)
我想如果我配置-Dcom.sun.management.jmxremote.local.only=true所有端口应该只绑定到localhost(::ffff:127.0.0.1将出现在所有端口之前).
如何配置JMX仅绑定到localhost?
添加
我不创建JMX我使用Tomcat JMX : https://tomcat.apache.org/tomcat-8.0-doc/monitoring.html.