所以我有一台运行Apache Kafka(测试)的EC2服务器。它具有用于JMX的端口9111,并且EC2安全设置已更改为打开端口。
我正在尝试在我的Mac上运行JConsole来读取此服务器的JMX指标,但我收到“安全连接失败”消息,然后它询问我是否要在没有SSL的情况下尝试。所以我选择了Insecure。然后我得到“连接失败:重试?”错误。这次没有太多解释。什么地方出了错?在Kafka的JXM配置中,禁用安全连接和身份验证。
任何线索/见解?
答案 0 :(得分:3)
事实证明,当您在EC2中运行Java进程并且想要访问其JMX时,您必须在运行Java进程时指定“-Djava.net.preferIPv4Stack = true”。此外,我必须打开所有端口,这是因为RMI将使用不同的端口。所以我修复了RMI即将使用的端口。
答案 1 :(得分:2)
就我而言,设置-Djava.rmi.server.hostname = my_machine_hostname可以正常工作。
答案 2 :(得分:1)
The issue is that when the JVM creates a remote debugging JMX service, it also allocated a dynamic RMI port. You need access to that port along with the JMX_PORT to be able to connect using jConsole (or Kafka Manager etc).
You can see this using
netstat -plunt
An options here is to force the JVM to use a fixed port for RMI using the below startup argument
-Dcom.sun.management.jmxremote.rmi.port=<some available port>
option. Then you can just open that particular port. This also works very well if you choose to dockerize you kafka solution.