如何限制ActiveMQ的JMX API只能访问本地主机/内网?
我刚刚开始使用JMX来监控activemq,我已经启用了远程监控。现在的问题是,如何只允许 localhost 访问 JMX API?或者有没有一种方法可以在不启用远程监控的情况下使用 JMX API。
I have just started using JMX to monitor activemq,i have enabled remote monitoring. Now the question is,How do i allow only localhost have access to JMX API? Or is there a way i can use JMX API without enabling remote monitoring..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在花了几个小时谷歌搜索解决方案后,我发现了这篇文章 https://wiki.internet2.edu/confluence/display/CPD/Monitoring+Tomcat+with+JMX 展示了如何为 tomcat 配置 JMX 以及如何通过 rmi 公开 JMX。
选项“-Djava.rmi.server.hostname=test-idc.internet2.edu”表示运行tomcat的主机的名称。如果您不指定主机名,则尝试从远程计算机连接将返回“连接失败”。
您需要做的就是在您的 activemq 启动脚本中设置属性 -Djava.rmi.server.hostname=localhost
就是这样...重新启动 activemq 并且您只能从本地计算机访问 jmx。
After spending hours of my time googling for a solution, i came across this article https://wiki.internet2.edu/confluence/display/CPD/Monitoring+Tomcat+with+JMX which shows how to configure JMX for tomcat and how to expose JMX over rmi.
The option "-Djava.rmi.server.hostname=test-idc.internet2.edu" indicates the name of the host on which tomcat is running. If you donot specify the hostname then trying to connect from a remote machine returns 'Connection failed'.
All you need to do is to set the property -Djava.rmi.server.hostname=localhost in your activemq startup script
Thats it... restart activemq and you have jmx accessible only from your local machine.