外观
ActiveMQ Artemis 运维与观测
本页结论:Artemis 的运维入口是 hawtio Web 控制台(8161)、JMX、
artemisCLI 与内置 metrics 插件;积压观察的核心是队列消息计数(含 scheduled 与 paging 状态),死信与过期地址必须配告警。
运维入口
| 入口 | 用途 |
|---|---|
| Web 控制台(8161,hawtio) | 地址/队列浏览、发送测试消息、查看连接与消费者、JMX 图形化 |
| JMX | 全部管理属性/操作:深度、速率、分页状态、强制消息移动/删除 |
artemis CLI | artemis queue stat(队列统计)、artemis check node/queue(健康探测)、artemis address create 等 |
| metrics 插件 | Micrometer/JSON 指标导出(etc/management.xml 与 metrics 插件配置) |
本仓库实验用 QueueBrowser 实现 stats 命令(客户端视角的深度清点),不依赖容器内 CLI——两种视角读数一致时可交叉验证。
关键指标
| 指标 | 含义 | 告警建议 |
|---|---|---|
| MessageCount / DurableMessageCount | 队列深度(全部 / 持久) | 持续增长 = 消费能力不足 |
| ScheduledCount | 等待定时投递的消息数 | 异常增长说明延迟参数被误用 |
| Paging 状态 | 地址是否进入分页 | 进入分页即应关注积压来源 |
| DeliverCount / AcknowledgeCount 速率 | 投递与确认速率 | 差值持续扩大 = 消费失败或重投风暴 |
| 死信地址深度 | orders-dlq 等 DLQ 的消息数 | 非零即告警:毒消息或系统性失败 |
| 过期地址深度 | expiry-address 的消息数 | TTL 配置不当的信号 |
| 连接数 / 消费者数 | 会话与消费者分布 | 消费者掉线检测(结合业务心跳) |
积压诊断路径
- 哪个队列积压:控制台或
queue stat按 MessageCount 排序; - 消费者在不在:消费者数为 0 → 连接/部署问题;有消费者但深度涨 → 看处理耗时与失败率;
- 是否在重投风暴:
consume_failed类日志 + DeliverCount 增速远超业务增速 → 检查 address-setting 的重试上限与死信配置; - 分页了吗:分页中消费走磁盘,追赶速度下降是预期行为,先扩消费者再谈扩容。
日常操作速查
bash
# 队列统计(容器内)
bin/artemis queue stat --url tcp://127.0.0.1:61616 --user <u> --password <p>
# 节点健康探测(可入 CI/存活探针)
bin/artemis check node --url http://127.0.0.1:8161 --user <u> --password <p>
# 浏览/移动死信(JMX 或控制台等价操作)
# 控制台:Queues → 选中 DLQ → Move/Remove- 变更 address-setting 需重载或滚动重启(本仓库版本不做热下发);变更前评估在途消息的新策略生效范围。
- 升级遵循官方迁移说明;journal 格式跨大版本可能需导出/导入。
与其它产品对照
| 维度 | Artemis | RabbitMQ | RocketMQ |
|---|---|---|---|
| 控制台 | hawtio(8161) | management(15672) | dashboard/proxy |
| 积压指标 | 队列 MessageCount | queue depth + unacked | consumer lag(Consume Diff) |
| DLQ 观察 | 死信地址深度 | 死信队列深度 | %DLQ% 组 Topic |
边界
QueueBrowser深度是瞬时快照,高吞吐下与 JMX 计数可能有毫秒级差异,趋势比单点值重要。- JMX 全量拉取在超大集群上代价高,规模化后以 metrics 插件导出为主。
cli-tools:纯自带 CLI 实验
bin 目录仅统一入口 artemis(另有 artemis.cmd/lib),producer/consumer/browser 子命令即可完成收发闭环:check node 探活 → queue create --silent 建 durable anycast 队列 → producer 循环 3 次各发 1 条(--message 只能固定内容)→ consumer --message-count 3 收满自动退出。queue stat 复查 MESSAGE COUNT=0、MESSAGES ACKED=3,browser 浏览余量为 0;镜像 security-enabled=true,每条命令都需带 --user/--password/--url。
artemis / docker
bash demos/artemis/docker/run.shassert.out.txt
--- status: verified capturedAt: "2026-08-23T15:19:49.324Z" dockerImage: "apache/activemq-artemis:2.44.0@sha256:0305c26f19eda00c0506d0953cfe265600a72ac1b17f7934412120c01a595cff" exitCode: 0 --- PASS binHasArtemis: 1 PASS version: 1 PASS nodeCheck: 1 PASS queueCreated: 1 PASS producedCount: 3 PASS consumedCount: 3 PASS messageCount: 0 PASS messagesAcked: 3 PASS browsedLeft: 0 RESULT: all assertions passed
bin-list.out.txt
[cli-tools] $ sh -c ls /opt/activemq-artemis/bin && /opt/activemq-artemis/bin/artemis version artemis artemis.cmd lib Apache ActiveMQ Artemis 2.44.0 ActiveMQ Artemis home: /opt/activemq-artemis ActiveMQ Artemis instance: null
browser.out.txt
[cli-tools] $ /opt/activemq-artemis/bin/artemis browser --destination queue://orders-cli --user admin --password hello-mq-artemis --url tcp://localhost:61616 Connection brokerURL = tcp://localhost:61616 Consumer:: filter = null Consumer ActiveMQQueue[orders-cli], thread=0 trying to browse 1000 messages Consumer ActiveMQQueue[orders-cli], thread=0 browsed: 0 messages Consumer ActiveMQQueue[orders-cli], thread=0 Browser thread finished
consume.out.txt
[cli-tools] $ /opt/activemq-artemis/bin/artemis consumer --destination queue://orders-cli --message-count 3 --receive-timeout 10000 --verbose --user admin --password hello-mq-artemis --url tcp://localhost:61616 Executing org.apache.activemq.artemis.cli.commands.messages.Consumer consumer --destination queue://orders-cli --message-count 3 --receive-timeout 10000 --verbose --user admin --password hello-mq-artemis --url tcp://localhost:61616 Home::/opt/activemq-artemis, Instance::null Connection brokerURL = tcp://localhost:61616 Consumer:: filter = null Consumer ActiveMQQueue[orders-cli], thread=0 wait 10000ms until 3 messages are consumed Consumer ActiveMQQueue[orders-cli], thread=0 Received order-cli-1 JMS Message ID:ID:a6e67567-9f05-11f1-b327-be38a569daa5 Received text sized at 11 Consumer ActiveMQQueue[orders-cli], thread=0 Received order-cli-2 JMS Message ID:ID:a7d2d1a9-9f05-11f1-9c5e-be38a569daa5 Received text sized at 11 Consumer ActiveMQQueue[orders-cli], thread=0 Received order-cli-3 JMS Message ID:ID:a8bce2e1-9f05-11f1-b0ec-be38a569daa5 Received text sized at 11 Consumer ActiveMQQueue[orders-cli], thread=0 Consumed: 3 messages Consumer ActiveMQQueue[orders-cli], thread=0 Elapsed time in second : 0 s Consumer ActiveMQQueue[orders-cli], thread=0 Elapsed time in milli second : 16 milli seconds Consumer ActiveMQQueue[orders-cli], thread=0 Consumed: 3 messages Consumer ActiveMQQueue[orders-cli], thread=0 Consumer thread finished
create.out.txt
[cli-tools] $ /opt/activemq-artemis/bin/artemis queue create --name orders-cli --address orders-cli --anycast --durable --auto-create-address --silent --user admin --password hello-mq-artemis --url tcp://localhost:61616 Connection brokerURL = tcp://localhost:61616 Queue [name=orders-cli, address=orders-cli, routingType=ANYCAST, durable=true, purgeOnNoConsumers=false, autoCreateAddress=false, exclusive=false, lastValue=false, lastValueKey=null, nonDestructive=false, consumersBeforeDispatch=0, delayBeforeDispatch=-1, autoCreateAddress=false] created successfully.
inventory.out.txt
--- status: verified capturedAt: "2026-08-23T15:19:49.324Z" dockerImage: "apache/activemq-artemis:2.44.0@sha256:0305c26f19eda00c0506d0953cfe265600a72ac1b17f7934412120c01a595cff" exitCode: 0 --- [cli-tools] $ sh -c ls /opt/activemq-artemis/bin && /opt/activemq-artemis/bin/artemis version artemis artemis.cmd lib Apache ActiveMQ Artemis 2.44.0 ActiveMQ Artemis home: /opt/activemq-artemis ActiveMQ Artemis instance: null
produce.out.txt
[cli-tools] $ for i in 1 2 3: /opt/activemq-artemis/bin/artemis producer --destination queue://orders-cli --message-count 1 --message order-cli-$i ... Connection brokerURL = tcp://localhost:61616 Producer ActiveMQQueue[orders-cli], thread=0 Started to calculate elapsed time ... Producer ActiveMQQueue[orders-cli], thread=0 Produced: 1 messages Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in second : 0 s Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in milli second : 18 milli seconds Connection brokerURL = tcp://localhost:61616 Producer ActiveMQQueue[orders-cli], thread=0 Started to calculate elapsed time ... Producer ActiveMQQueue[orders-cli], thread=0 Produced: 1 messages Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in second : 0 s Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in milli second : 17 milli seconds Connection brokerURL = tcp://localhost:61616 Producer ActiveMQQueue[orders-cli], thread=0 Started to calculate elapsed time ... Producer ActiveMQQueue[orders-cli], thread=0 Produced: 1 messages Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in second : 0 s Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in milli second : 17 milli seconds
session.out.txt
--- status: verified capturedAt: "2026-08-23T15:19:49.324Z" dockerImage: "apache/activemq-artemis:2.44.0@sha256:0305c26f19eda00c0506d0953cfe265600a72ac1b17f7934412120c01a595cff" exitCode: 0 --- ## status [cli-tools] $ /opt/activemq-artemis/bin/artemis check node --user admin --password hello-mq-artemis --url tcp://localhost:61616 Connection brokerURL = tcp://localhost:61616 Running NodeCheck Checking that the node is started ... success Checks run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.083 sec - NodeCheck ## create [cli-tools] $ /opt/activemq-artemis/bin/artemis queue create --name orders-cli --address orders-cli --anycast --durable --auto-create-address --silent --user admin --password hello-mq-artemis --url tcp://localhost:61616 Connection brokerURL = tcp://localhost:61616 Queue [name=orders-cli, address=orders-cli, routingType=ANYCAST, durable=true, purgeOnNoConsumers=false, autoCreateAddress=false, exclusive=false, lastValue=false, lastValueKey=null, nonDestructive=false, consumersBeforeDispatch=0, delayBeforeDispatch=-1, autoCreateAddress=false] created successfully. ## produce [cli-tools] $ for i in 1 2 3: /opt/activemq-artemis/bin/artemis producer --destination queue://orders-cli --message-count 1 --message order-cli-$i ... Connection brokerURL = tcp://localhost:61616 Producer ActiveMQQueue[orders-cli], thread=0 Started to calculate elapsed time ... Producer ActiveMQQueue[orders-cli], thread=0 Produced: 1 messages Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in second : 0 s Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in milli second : 18 milli seconds Connection brokerURL = tcp://localhost:61616 Producer ActiveMQQueue[orders-cli], thread=0 Started to calculate elapsed time ... Producer ActiveMQQueue[orders-cli], thread=0 Produced: 1 messages Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in second : 0 s Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in milli second : 17 milli seconds Connection brokerURL = tcp://localhost:61616 Producer ActiveMQQueue[orders-cli], thread=0 Started to calculate elapsed time ... Producer ActiveMQQueue[orders-cli], thread=0 Produced: 1 messages Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in second : 0 s Producer ActiveMQQueue[orders-cli], thread=0 Elapsed time in milli second : 17 milli seconds ## consume [cli-tools] $ /opt/activemq-artemis/bin/artemis consumer --destination queue://orders-cli --message-count 3 --receive-timeout 10000 --verbose --user admin --password hello-mq-artemis --url tcp://localhost:61616 Executing org.apache.activemq.artemis.cli.commands.messages.Consumer consumer --destination queue://orders-cli --message-count 3 --receive-timeout 10000 --verbose --user admin --password hello-mq-artemis --url tcp://localhost:61616 Home::/opt/activemq-artemis, Instance::null Connection brokerURL = tcp://localhost:61616 Consumer:: filter = null Consumer ActiveMQQueue[orders-cli], thread=0 wait 10000ms until 3 messages are consumed Consumer ActiveMQQueue[orders-cli], thread=0 Received order-cli-1 JMS Message ID:ID:a6e67567-9f05-11f1-b327-be38a569daa5 Received text sized at 11 Consumer ActiveMQQueue[orders-cli], thread=0 Received order-cli-2 JMS Message ID:ID:a7d2d1a9-9f05-11f1-9c5e-be38a569daa5 Received text sized at 11 Consumer ActiveMQQueue[orders-cli], thread=0 Received order-cli-3 JMS Message ID:ID:a8bce2e1-9f05-11f1-b0ec-be38a569daa5 Received text sized at 11 Consumer ActiveMQQueue[orders-cli], thread=0 Consumed: 3 messages Consumer ActiveMQQueue[orders-cli], thread=0 Elapsed time in second : 0 s Consumer ActiveMQQueue[orders-cli], thread=0 Elapsed time in milli second : 16 milli seconds Consumer ActiveMQQueue[orders-cli], thread=0 Consumed: 3 messages Consumer ActiveMQQueue[orders-cli], thread=0 Consumer thread finished ## browser [cli-tools] $ /opt/activemq-artemis/bin/artemis browser --destination queue://orders-cli --user admin --password hello-mq-artemis --url tcp://localhost:61616 Connection brokerURL = tcp://localhost:61616 Consumer:: filter = null Consumer ActiveMQQueue[orders-cli], thread=0 trying to browse 1000 messages Consumer ActiveMQQueue[orders-cli], thread=0 browsed: 0 messages Consumer ActiveMQQueue[orders-cli], thread=0 Browser thread finished ## verify [cli-tools] $ /opt/activemq-artemis/bin/artemis queue stat --queueName orders-cli --user admin --password hello-mq-artemis --url tcp://localhost:61616 Connection brokerURL = tcp://localhost:61616 |NAME |ADDRESS |CONSUMER|MESSAGE|MESSAGES|DELIVERING|MESSAGES|SCHEDULED|ROUTING|INTERNAL| | | | COUNT | COUNT | ADDED | COUNT | ACKED | COUNT | TYPE | | |orders-cli|orders-cli| 0 | 0 | 3 | 0 | 3 | 0 |ANYCAST| false |
status.out.txt
[cli-tools] $ /opt/activemq-artemis/bin/artemis check node --user admin --password hello-mq-artemis --url tcp://localhost:61616 Connection brokerURL = tcp://localhost:61616 Running NodeCheck Checking that the node is started ... success Checks run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.083 sec - NodeCheck
verify.out.txt
[cli-tools] $ /opt/activemq-artemis/bin/artemis queue stat --queueName orders-cli --user admin --password hello-mq-artemis --url tcp://localhost:61616 Connection brokerURL = tcp://localhost:61616 |NAME |ADDRESS |CONSUMER|MESSAGE|MESSAGES|DELIVERING|MESSAGES|SCHEDULED|ROUTING|INTERNAL| | | | COUNT | COUNT | ADDED | COUNT | ACKED | COUNT | TYPE | | |orders-cli|orders-cli| 0 | 0 | 3 | 0 | 3 | 0 |ANYCAST| false |