4

So I have an EC2 server running Apache Kafka (testing). It has port 9111 for JMX and EC2 security setting changed to open the port.

I am trying to run JConsole on my Mac to read JMX metrics of this server but I got "Secure Connection Failed" message and then it asks whether I want to try without SSL. So I selected Insecure. Then I just got "Connection Failed: Retry?" error. There isn't much explanation this time. What went wrong? In the JXM configuration of Kafka, secure connection and authentification are disabled.

Any clue/insight?

kee
  • 10,969
  • 24
  • 107
  • 168
  • I found some comment about adding -Djava.rmi.server.hostname parameter but it still didn't work. – kee Sep 23 '14 at 22:07

3 Answers3

3

It turned out that when you run your Java process in EC2 and you want to access its JMX, you have to specify "-Djava.net.preferIPv4Stack=true" in running your Java process. Also I had to open all ports and it was because RMI would use different ports. So I fixed the port RMI is going to use.

kee
  • 10,969
  • 24
  • 107
  • 168
3

In my case, setting -Djava.rmi.server.hostname=my_machine_hostname works.

Ken Chen
  • 159
  • 2
  • 7
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.

panksdmz
  • 421
  • 1
  • 5
  • 8