https://www.rabbitmq.com/docs/production-checklist
存储方式
- 使用持久化存储,可使用Network-attached Storage (NAS而非NFS)
- 保证存储隔离,禁止共享RabbitMQ的数据目录,理想情况是不共享磁盘IO
- 支持大多数本地文件系统,避免使用分布式文件系统
资源限制
内存
By default, RabbitMQ will not accept any new messages when it detects that it’s using more than 40% of the available memory (as reported by the OS)
建议
- 托管 RabbitMQ 的节点应始终具有至少 256 MiB 的可用内存。使用仲裁队列、Shovel 和 Federation 的部署可能需要更多。
- vmmemoryhigh_watermark.relative设置在0.4到0.7
- 应谨慎使用高于 0.7 的值,并进行可靠的内存使用和基础设施级监控。操作系统和文件系统必须保留至少 30% 的内存,否则性能可能会因分页而严重下降。
磁盘
磁盘剩余空间限制disk_free_limit默认值为50M,仅适用于开发环境。
建议
- 最差场景是内存限制用满全部刷盘
- 磁盘剩余空间限制最小值应当与内存使用限制最大值保持一致
- 1.5或者2倍
文件句柄
至少50k
安全相关
虚拟主机
单租户可以使用默认虚拟主机/,多租户需要分离
用户
生产环境删除默认用户guest
Resource Alarms
When a resource alarm is in effect, all connections that publish will be blocked until the alarm clears. Clients can opt-in to receive a notification when they are blocked. Learn more in the Resource Alarms guide.
Temporarily Blocking Publishing
It is possible to effectively block all publishing in a cluster by setting the memory high watermark to 0, thus making a resource alarm to go off immediately:
Plain Text rabbitmqctl set_vm_memory_high_watermark 0
Blocked and Unblocked Connection Notification
channel.queuebind:把目的队列绑定到来源交换机 channel.exchangebind:把目的交换机绑定到来源交换机