本文介绍了获取所有主机连接数到我的ActiveMQ代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ActiveMQ代理设置:

券商机上运行:hostA上

Broker is running on machine: hostA

来自不同主机的客户端可以连接到hostA上运行我的经纪人举例来说,有可能从任何主机任意数量的客户端。

Clients from different host can connect to my broker instance running on hostA, there can be any number of client from any host.

有没有办法找出有多少客户端连接到代理,并还列表,它告诉我从每台主机连接众多怎么在那里我的经纪人。

我想这样做没有作出有关的主机数量的假设。

I want to do this without making assumption about number of hosts.

我可以用lsof的命令和一些解析过的输出做到这一点,但我在情况下,我不能使用此。

I can do this by using lsof command and some parsing over output, but I am in situation where I can not use this.

是否存在被ActiveMQ的命令行实用程序提供的功能的 ActiveMQ的管理员即可。

Is there any feature provided by ActiveMQ command line utility activemq-admin.

推荐答案

您可以得到pretty多的MBean特性的ActiveMQ通过ActiveMQ的管理员公开。有迹象表明,让你从特定的客户端连接的快速计票没有属性或操作。你必须做你的结束一些工作来获得你想要的所有细节,但所有的原始数据是存在的。

You can get to pretty much any Mbean attribute ActiveMQ exposes via the activemq-admin. There are no attributes or operations that give you a quick count of connections from specific clients. You will have to do some work on your end to get all the details you want, but all the raw data is there.

例如:

代理统计:

activemq-admin query --objname type=Broker,brokerName=localhost  

连接统计

activemq-admin query --objname type=Broker,brokerName=localhost,connector=clientConnectors,connectorName=<transport connector name>,connectionViewType=clientId,connectionName=* 

结果
注意:文档,因为这书面方式并没有进行更新,以考虑到AMQ取得该MBean变化。对对象的实例名称是不正确的。

See full doc here.
NOTE: Documentation as of this writting has not be updated to take into account the Mbean changes made in AMQ. References to Object names in examples are not correct.

您可以得到的MBeanInfo从JMX对象名称(或示例语法来)(例如使用JConsole的或视觉VM)。每个对象名称遗嘱统计类似org.apache.activemq:类型。对于脚本,删除org.apache.activemq:你应该在企业对您通过脚本从JMX需要的任何东西。

You can get the object name (or example sytax) from JMX (using jconsole or visual vm for example) from the MBeanInfo. Each object name wills stat something like org.apache.activemq:type. For the script, remove the "org.apache.activemq:" and you should be in business for any thing you need from JMX via the script.

我觉得你也可以考虑使用椒与您的经纪人。虽然不是与ActiveMQ的管理员脚本兼容,可以达到你的一切从ActiveMQ的管理员脚本,也可以访问所有的操作。在过去,我经常使用的ActiveMQ的管理员脚本对于券商的本地监控/命令行管理,但已开始将一切都打椒服务。但同样,ActiveMQ的管理员会给你一个方法来访问你在找什么在这里。

I think you may also look into using Jolokia with your broker. Although not compatible with the activemq-admin script, you can reach everything you can from the activemq-admin script, but also have access to all of the operations. In the past I've heavily used the activemq-admin script for local monitoring/command line administration of the broker, but have started converting everything to hit the Jolokia service. But again, activemq-admin will give you a way to access what you are looking for here.

这篇关于获取所有主机连接数到我的ActiveMQ代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 20:44