ActiveMQ 的常用命令和功能。
安装 ActiveMQ:
brew install activemq
启动 ActiveMQ:
activemq start
关闭 ActiveMQ:
activemq stop
查看当前连接数:
1
2
3activemq-admin query --view CurrentConnectionsCount | grep CurrentConnectionsCount
也可以使用 netstat: netstat -an | grep 61616 | wc -l网页中查看 ActiveMQ 的信息,如有多少个 queues, topics, connections 等:
1
2
3URL: http://localhost:8161/admin
Username: admin
Password: admin查看有多少个 Producer
1
activemq-admin query TotalConnectionsCount=* | grep TotalProducerCount
查看有多少个 Consumer
1
activemq-admin query TotalConnectionsCount=* | grep TotalConsumerCount
查看连接到 Broker 的连接的信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16activemq-admin query connectionName=*
查看连接
activemq-admin query connectionName=* | grep RemoteAddress | sort
输出
RemoteAddress = tcp://127.0.0.1:59420
RemoteAddress = tcp://127.0.0.1:59420
查看连接,去掉重复的行, -c 显示重复行的数字
activemq-admin query connectionName=* | grep RemoteAddress | sort | uniq
activemq-admin query connectionName=* | grep RemoteAddress | sort | uniq -c
查看有多少个连接
activemq-admin query connectionName=* | grep RemoteAddress | wc -l
activemq-admin query connectionName=* | grep RemoteAddress | uniq | wc -l查看 Queue 和 Topic 的信息
1
2activemq-admin query -QTopic=*
activemq-admin query -QQueue=*Broker status
activemq-admin query --objname
type=Broker,
brokerName=localhostConnection Stats
activemq-admin query --objname
type=Broker,
brokerName=localhost,
connector=clientConnectors,
connectorName=,
connectionViewType=clientId,
connectionName=*
协议
修改 conf/activemq.xml
的 transportConnectors
1 | <!-- |