RabbitMQ 笔记

1. 如果你是在虚拟机上建立集群,那么网络分区(network partition)你一定不会陌生。

最暴力的解决方式:重启所有节点app以消除警报。操作顺序:关闭ram节点 -> 关闭disc节点 -> 启动disc节点 -> 启动ram节点

rabbitmqctl stop_app
rabbitmqctl start_app

完整解决方案请参考此文:RabbitMQ网络分区解决方案

 

2. 即使创建了持久化队列,也并不一定能完全保证消息不丢失。

官网原文:

Note on message persistence

Marking messages as persistent doesn't fully guarantee that a message won't be lost. Although it tells RabbitMQ to save the message to disk, there is still a short time window when RabbitMQ has accepted a message and hasn't saved it yet. Also, RabbitMQ doesn't do fsync(2) for every message -- it may be just saved to cache and not really written to the disk. The persistence guarantees aren't strong, but it's more than enough for our simple task queue. If you need a stronger guarantee then you can use publisher confirms.

它可能只是被缓存了并没有真的写到磁盘!

 

3. 对 routing key 的理解

与 exchange、queue 有关,但不是决定性因素,即同一个exchange 与同一个 queue 之间可以定义多个 routing key ,换言之:routing key 只是用来定义 一组或多组 exchange与queue之间的绑定关系。

正因如此,由于 fanout 类型的 exchange 不关心是哪个 queue 发送了消息,所以也就不关心 routing key,因此这个参数会被忽略。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值