kafka monitoring using JMX when running kafka in docker in boot2docker

断了今生、忘了曾经 提交于 2019-12-02 01:49:17

For completeness, here is the solution that works:

I ran ches/kafka docker image as follows -- note that the JMX_PORT (7203) is now published appropriately:

$ docker run --hostname localhost --name kafka --publish 9092:9092 --publish 7203:7203 --env EXPOSED_HOST=192.168.59.103 --env ZOOKEEPER_IP=192.168.59.103 ches/kafka

Also, the following environment is set in the kafka-run-class.sh (.bat for windows)

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

But I needed to add one additional item (thanks to one of the commenters for pointing this out):

-Dcom.sun.management.jmxremote.rmi.port=7203

Now, to run the ches/docker image in boot2docker you just need to set one of the recognized environment variables (KAFKA_JMX_OPTS or KAKFA_OPTS) to add the additional item and it now works.

Thanks for the help!

There's no reason the kafka docker port would bind to the same port in the boot2docker VM except if you specify it.

Try running it with -p 7203:7203 to force the 1:1 forwarding of the port.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!