Rabbitmq 问题记录

0.启用web页面管理
sudo rabbitmq-plugins enable rabbitmq_management
sudo rabbitmqctl add_user mytest mytest
sudo rabbitmqctl set_user_tags mytest administrator
sudo rabbitmqctl set_permissions -p / mytest ".*" ".*" ".*"


1. client -> rabbitmq-server使用连接池
a.每个进程独占连接池,连接池默认值:max_size=30 min_size=2 ttl=1200
b.连接使用协程池来处理事业,协程池默认值:executor_thread_pool_size=64

2. client与rabbitmq-server 连接的心跳保持
a. client与rabbitqm-server协商心跳检查时间(默认60s), 取两边最小值作用心跳检查时间
b. 心跳包是特定类型的数据(frame_type=8,内容为空),上层应用感知不到心跳,底层连接(amqp)直接处理,接发不需要端响应
c. client与rabbitqm-server都周期性地发送心跳(最新发送数据的时间点作为起点)
d. 两端使用2个心跳时间作为超时时间(最近收到数据的时间点作为起点)
e. 发送心跳间隔单个心跳时间

3. oslo_messaging 的Connection.
a. publish
1.池化管理Connection, 周期性地检查和发送心跳(Threading)
2.获取时触发Connection超时(池)检查
3.发送msg后等待confirm(类型(60, 80))

b. consume
非池化Connnection, 周期性地检查和发送心跳(Threading),等待处理msg


5. Rabbitmq配置(openstack)
[oslo_messaging_rabbit]
rabbit_hosts = "mgm-net0:5672,mgm-net2:5672"
rabbit_userid = openstack
rabbit_password =rabbit_pass
kombu_reconnect_delay = 1.0
rabbit_retry_interval = 1
rabbit_retry_backoff = 2
rabbit_max_retries = 0
rabbit_durable_queues = true
rabbit_ha_queues = true
heartbeat_timeout_threshold = 60
heartbeat_rate = 2
rabbit_qos_prefetch_count = 5


6.neutron-server服务进程数量
a. api-server 默认等于CPU核数
b. rpc-worker 默认等于1(RPC任务较多,建议适当调整)
c. rpc_state_report_workers 默认等于1(实际等于n+1)
d PeriodicWorker 默认等于1(只能等于1,plugin的周期性任务,如dhcp-agent/router-agent周期性管理等)


7.问题处理
1.心跳Timeout "missed heartbeats from client, timeout: 60s"
a. 仅有publish Connection产生超时
b. https://github.com/celery/kombu/pull/489
2.重启Cluster的某个节点,"operation basic.publish caused a channel exception not_found: no exchange"
a.集群的节点数据没有同步
b.https://bugzilla.redhat.com/show_bug.cgi?id=1399237

文档:
https://blog.csdn.net/zyz511919766/article/details/41896823
https://geewu.gitbooks.io/rabbitmq-quick/content/index.html

原文地址:https://www.cnblogs.com/gaozhengwei/p/10085145.html