在boot2docker中的docker中运行kafka时,使用JMX进行kafka监视 [英] kafka monitoring using JMX when running kafka in docker in boot2docker

查看:1336
本文介绍了在boot2docker中的docker中运行kafka时,使用JMX进行kafka监视的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让JMX监视工作来监视一个测试卡夫卡实例。

I am trying to get JMX monitoring working to monitor a test kafka instance.

我通过boot2docker在docker中运行kafka(ches / kafka),但是我无法正确配置JMX监控。我做了一堆故障排除,我知道kafka实例运行正常(消费者和生产者工作)。当我尝试简单的JMX工具(jconsole和jvisualvm)并且都无法连接(不安全的连接错误,连接失败)时出现此问题。

I have kafka (ches/kafka) running in docker via boot2docker but I can not get JMX monitoring configured properly. I have done a bunch of troubleshooting and I know the kafka instance is running properly (consumers and producers work). The issue arises when I try simple JMX tools (jconsole and jvisualvm) and both can not connect (insecure connection error, connection failed).

注意事项的配置项:我连接到192.168.59.103(运行'boot2docker ip'时发现virtualbox ip),而ches / kafka docker / kafka实例使用端口7203作为JMX_PORT(在kafka启动日志中确认)。使用jconsole,我连接到192.168.59.103:7203,那就是发生错误。

Configuration items of note: I connect to 192.168.59.103 (virtualbox ip found when running 'boot2docker ip') and the ches/kafka docker/kafka instance uses the port 7203 as the JMX_PORT (confirmed in the kafka startup logs). Using jconsole, I connect to 192.168.59.103:7203 and that is when the errors occur.

任何帮助都不胜感激。

推荐答案

为了完整起见,这里是解决方案:

For completeness, here is the solution that works:

我运行ches / kafka码头图像如下 - 请注意,JMX_PORT(7203)现在已正确发布:

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

另外,在kafka-run-class.sh(.bat for windows)中设置了以下环境。

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

b

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

现在,要在boot2docker中运行ches / docker镜像只需要设置一个公认的环境变量(KAFKA_JMX_OPTS或KAKFA_OPTS)来添加额外的项目,它现在可以工作。

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.

感谢您的帮助!

这篇关于在boot2docker中的docker中运行kafka时,使用JMX进行kafka监视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆