热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

rabbitmq故障判断

查看rabbitmqDashboard就能观察出整个集群的状态,ready可以看成是消息积压,但是大多是由死信队列导致,这个大可放心&#x

查看rabbitmq Dashboard 就能观察出整个集群的状态, ready 可以看成是消息积压,但是大多是由死信队列导致,这个大可放心,即便消息再多,虽然消费者不消费但是配置了TTL消息会自动删除。

Publish 数一般不要超过12000/s, 一般小集群高峰平均:1000/s 左右 大集群高峰平均:6000/s 左右

Disk write 与 Deliver(manual ack) 息息相关, 手动ack 在消费者没有消费消息的时候,为了保证数据不丢失,采用beta这种落地方案,只要物理节点I/O不高,就可以忽略,同时如果消息被消费,就会自动删除这条消息。

状态:alpha,消息的内容和索引都在内存中;beta,消息的内容在磁盘,索引在内存;gamma,消息的内容在磁盘,索引在磁盘和内存中都有;delta,消息的内容和索引都在磁盘。

设计核心思想:

rabbitmq 可以使用镜像模式,但没必要all全量镜像,保留两个镜像就行,一个是主另一个是备,有两个好处,一个脑裂因素干扰少,另一个可以减少同步开销,添加了 {cluster_partition_handling, pause_minority} 设置,避免因网络原因导致的少数派选举,避免数据脑裂。

Ready:待消费的消息总s数
Unacked:待应答的消息总数。
Total:总数 Ready+Unacked
Publish:producter pub消息的速率。
Publisher confirm:broker确认pub消息的速率。
Deliver(manual ack):customer手动确认的速率。
Deliver( auto ack):customer自动确认的速率。
Consumer ack:customer正在确认的速率。
Redelivered:正在传递’redelivered’标志集的消息的速率。
Get (manual ack):响应basic.get而要求确认的消息的传输速率。
Get (auto ack):响应于basic.get而发送不需要确认的消息的速率。
Return:将basic.return发送给producter的速率。
Disk read:queue从磁盘读取消息的速率。
Disk write:queue从磁盘写入消息的速率。
Connections:client的tcp连接的总数。
Channels:通道的总数。
Exchange:交换器的总数。
Queues:队列的总数。
Consumers:消费者的总数。
在这里插入图片描述

查看rabbitmq Dashboard 就能观察出整个集群的状态, ready 可以看成是消息积压,但是大多是由死信队列导致,这个大可放心,即便消息再多,虽然消费者不消费但是配置了TTL消息会自动删除。

Publish 数一般不要超过12000/s, 一般小集群高峰平均:1000/s 左右 大集群高峰平均:6000/s 左右

Disk write 与 Deliver(manual ack) 息息相关, 手动ack 在消费者没有消费消息的时候,为了保证数据不丢失,采用beta这种落地方案,只要物理节点I/O不高,就可以忽略,同时如果消息备消费,就会自动删除这条消息。

状态:alpha,消息的内容和索引都在内存中;beta,消息的内容在磁盘,索引在内存;gamma,消息的内容在磁盘,索引在磁盘和内存中都有;delta,消息的内容和索引都在磁盘。

设计核心思想:

rabbitmq 可以使用镜像模式,但没必要all全量镜像,保留两个镜像就行,一个是主另一个是备,有两个好处,一个脑裂因素干扰少,另一个可以减少同步开销,添加了 {cluster_partition_handling, pause_minority} 设置,避免因网络原因导致的少数派选举,避免数据脑裂。

Ready:待消费的消息总s数
Unacked:待应答的消息总数。
Total:总数 Ready+Unacked
Publish:producter pub消息的速率。
Publisher confirm:broker确认pub消息的速率。
Deliver(manual ack):customer手动确认的速率。
Deliver( auto ack):customer自动确认的速率。
Consumer ack:customer正在确认的速率。
Redelivered:正在传递’redelivered’标志集的消息的速率。
Get (manual ack):响应basic.get而要求确认的消息的传输速率。
Get (auto ack):响应于basic.get而发送不需要确认的消息的速率。
Return:将basic.return发送给producter的速率。
Disk read:queue从磁盘读取消息的速率。
Disk write:queue从磁盘写入消息的速率。
Connections:client的tcp连接的总数。
Channels:通道的总数。
Exchange:交换器的总数。
Queues:队列的总数。
Consumers:消费者的总数。
在这里插入图片描述

https://www.jianshu.com/p/7b6e575fd451

命令判断

1,rabbitmqctl eval ‘rabbit_diagnostics:maybe_stuck().’

rabbitmqctl eval ‘rabbit_diagnostics:maybe_stuck().’
2021-07-23 11:25:19 There are 391 processes.
2021-07-23 11:25:19 Investigated 2 processes this round, 5000ms to go.
2021-07-23 11:25:19 Investigated 2 processes this round, 4500ms to go.
2021-07-23 11:25:20 Investigated 2 processes this round, 4000ms to go.
2021-07-23 11:25:20 Investigated 2 processes this round, 3500ms to go.
2021-07-23 11:25:21 Investigated 2 processes this round, 3000ms to go.
2021-07-23 11:25:21 Investigated 2 processes this round, 2500ms to go.
2021-07-23 11:25:22 Investigated 2 processes this round, 2000ms to go.
2021-07-23 11:25:22 Investigated 2 processes this round, 1500ms to go.
2021-07-23 11:25:23 Investigated 2 processes this round, 1000ms to go.
2021-07-23 11:25:23 Investigated 2 processes this round, 500ms to go.
2021-07-23 11:25:24 Found 2 suspicious processes.
2021-07-23 11:25:24 [{pid,<11072.1.0>},
{registered_name,erts_code_purger},
{current_stacktrace,
[{erts_code_purger,wait_for_request,0,[]}]},
{initial_call,{erts_code_purger,start,0}},
{message_queue_len,0},
{links,[]},
{monitors,[]},
{monitored_by,[]},
{heap_size,233}]
2021-07-23 11:25:24 [{pid,<11072.686.0>},
{registered_name,[]},
{current_stacktrace,
[{pg2,’-do_monitor/1-fun-0-’,1,
[{file,“pg2.erl”},{line,383}]}]},
{initial_call,{erlang,apply,2}},
{message_queue_len,0},
{links,[]},
{monitors,[{process,<11272.385.0>}]},
{monitored_by,[<11072.405.0>]},
{heap_size,233}]
ok

返回ok 是正常的集群状态

2&#xff0c; rabbitmqctl cluster_status

Cluster status of node rabbit&#64;transactionrabbitmq03
[{nodes,[{disc,[rabbit&#64;transactionrabbitmq01,rabbit&#64;transactionrabbitmq02,
rabbit&#64;transactionrabbitmq03]}]},
{running_nodes,[rabbit&#64;transactionrabbitmq01,rabbit&#64;transactionrabbitmq02,
rabbit&#64;transactionrabbitmq03]}, 如果显示 running_nodes 说明是正常的
{cluster_name,<<“rabbit&#64;transactionrabbitmq01”>>},
{partitions,[]},
{alarms,[{rabbit&#64;transactionrabbitmq01,[]},
{rabbit&#64;transactionrabbitmq02,[]},
{rabbit&#64;transactionrabbitmq03,[]}]}]

3&#xff0c; 如果集群异常&#xff0c;请在任何一个节点上快速执行,就能恢复集群正常状态

rabbitmqctl stop_apprabbtitmqctl start_app

4&#xff0c;如果发现rabbitmq 集群脑裂&#xff0c;请在少数派上执行这条命令

rabbitmqctl stop_apprabbtitmqctl start_app

推荐阅读
author-avatar
mobiledu2502921803
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有