本文介绍了如何将JMX配置为仅绑定到本地主机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Centos6上使用JDK8运行Tomcat8.我使用以下选项启用JMX:

I run Tomcat8 using JDK8 on Centos6.I enable JMX using the following options:

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"

不幸的是,当我检查打开了哪些端口时,我发现这些端口监听所有IP:

Unfortunately, when I check what ports are opened I discover that these ports listen to all 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

我想如果配置-Dcom.sun.management.jmxremote.local.only=true,则所有端口应仅绑定到本地主机(::ffff:127.0.0.1将出现在所有端口之前).

I suppose that if I configure -Dcom.sun.management.jmxremote.local.only=true all ports should be bind to localhost only (::ffff:127.0.0.1 will appear before all ports).

如何将JMX配置为仅绑定到本地主机?

How to configure JMX to bind to localhost only?

已添加

我不创建JMX,而是使用Tomcat JMX:https://tomcat.apache.org/tomcat-8.0-doc/monitoring.html.

I do not create JMX I use Tomcat JMX: https://tomcat.apache.org/tomcat-8.0-doc/monitoring.html.

推荐答案

据我了解答案并阅读Oracle的有关它的文档,似乎没有 no 方式无需编码即可进行配置. 说在连接器服务器属性"一章中:

As far as I understand this answer and read Oracle's docs about it, there seems to be no way to configure it without coding. This says in the chapter "Connector server attributes":

我看到的唯一选择是在此处实现自定义工厂,例如> 并将类名传递给属性以及classpath中的JAR/class.

The only option I see is to implement a custom factory like here and pass the classname to the property along with the JAR/class in classpath.

如果我做错了,请纠正我.

Correct me if I am wrong.

这篇关于如何将JMX配置为仅绑定到本地主机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 06:14