Rabbitmq队列高可用的策略
来源:互联网 发布:电脑双肩包 知乎 编辑:程序博客网 时间:2024/06/05 17:54
1、 RabbitMQ will keep the existing master around until at least one other slave has synchronised (even if this is a long time). However, once synchronisation has occurred things will proceed just as if the node had failed: consumers will be disconnected from the master and will need to reconnect.
当rabbitmq 设置了队列高可用后,会先把至少一个slave节点同步完成,然后才提供作用。
2、If you stop a RabbitMQ node which contains the master of a mirrored queue, some slave on some other node will be promoted to the master (assuming there is a synchronised slave; seebelow). If you continue to stop nodes then you will reach a point where a mirrored queue has no more slaves: it exists only on one node, which is now its master. If the mirrored queue was declared durable then, if its last remaining node is shutdown, durable messages in the queue will survive the restart of that node.
如果不断的关掉queue所在节点,则最后一个成为主节点的queue的信息在重启后会保存。
3、It's possible that when you shut down a master node that all available slaves are unsynchronised. A common situation in which this can occur is rolling cluster upgrades. By default, RabbitMQ will refuse to fail over to an unsynchronised slave on controlled master shutdown (i.e. explicit stop of the RabbitMQ service or shutdown of the OS) in order to avoid message loss; instead the entire queue will shut down as if the unsynchronised slaves were not there. An uncontrolled master shutdown (i.e. server or node crash, or network outage) will still trigger a failover even to an unsynchronised slave.
master队列所在节点挂掉后,slave 队列能否成为slaver,在于挂掉的节点是怎样的。如果是机器挂了活着网络故障,则slave节点会接替master节点
If you would prefer to have master nodes fail over to unsynchronised slaves in all circumstances (i.e. you would choose availability of the queue over avoiding message loss) then you can set theha-promote-on-shutdown policy key to always rather than its default value of when-synced.
可以设置不管什么原因挂掉,slave 队列都能接替master 队列
4、it is possible to lose the master for a queue while all slaves for the queue are shut down. In normal operation the last node for a queue to shut down will become the master, and we want that node to still be the master when it starts again (since it may have received messages that no other slave saw).
However, when you invoke rabbitmqctl forget_cluster_node, RabbitMQ will attempt to find a currently stopped slave for each queue which has its master on the node we are forgetting, and "promote" that slave to be the new master when it starts up again. If there is more than one candidate, the most recently stopped slave will be chosen.
It's important to understand that RabbitMQ can only promote stopped slaves duringforget_cluster_node, since any slaves that are started again will clear out their contents as described at "stopping nodes and synchronisation" above. Therefore when removing a lost master in a stopped cluster, you must invoke rabbitmqctl forget_cluster_node before starting slaves again.
当所有节点都挂掉后,可以设置最后挂掉的slave队列称为master队列5、As discussed, for each mirrored queue there is one master and severalslaves, each on a different node. The slaves apply the operations that occur to the master in exactly the same order as the master and thus maintain the same state. All actions other than publishes go only to the master, and the master then broadcasts the effect of the actions to the slaves. Thus clients consuming from a mirrored queue are in fact consuming from the master.
除了publish的动作是同时作用在master和slave节点上的之外,其他的动作都是先做作用于master节点,然后有master节点作用到slaver节点上去的。
6、Mirrored queues support both Publisher Confirms and Transactions. The semantics chosen are that in the case of both confirms and transactions, the action spans all mirrors of the queue. So in the case of a transaction, atx.commit-ok will only be returned to a client when the transaction has been applied across all mirrors of the queue. Equally, in the case of publisher confirms, a message will only be confirmed to the publisher when it has been accepted by all of the mirrors. It is correct to think of the semantics as being the same as a message being routed to multiple normal queues, and of a transaction with publications within that similarly are routed to multiple queues.
publish启用ack机制,则消息要收到所有slaver的确认后才返回确认
7、lients that are consuming from a mirrored queue may wish to know that the queue from which they have been consuming has failed over. When a mirrored queue fails over, knowledge of which messages have been sent to which consumer is lost, and therefore all unacknowledged messages are redelivered with the redelivered flag set. Consumers may wish to know this is going to happen.
If so, they can consume with the argument x-cancel-on-ha-failover set totrue. Their consuming will then be cancelled on failover and aconsumer cancellation notification sent. It is then the consumer's responsibility to reissuebasic.consume to start consuming again.
mirrord的队列failover后,没有收到确认的消息会有一个redeliverd的标志。当master挂掉,slaver成为master时,consumer如果设置了x-cancel-on-ha-failover为true,则会发送consumer一个通知并断开连接,这时要consumer自己重连了
- Rabbitmq队列高可用的策略
- 高可用消息队列服务构建-RABBITMQ
- 高可用消息队列服务构建-RABBITMQ
- RabbitMQ源码解析前奏--高可用队列
- RabbitMQ+HAProxy构建高可用消息队列
- RabbitMQ高可用镜像队列
- rabbitmq集群的高可用
- [高可用]Ubuntu搭建高可用的RabbitMQ(1)
- [高可用]Ubuntu搭建高可用的RabbitMQ(2)
- (十)RabbitMQ消息队列-高可用集群部署实战
- (十一)RabbitMQ消息队列-如何实现高可用
- Rabbitmq集群高可用
- Rabbitmq集群高可用
- Rabbitmq集群高可用
- rabbitmq+keepalived高可用
- [openstack]配置高可用RabbitMQ
- [openstack]配置高可用RabbitMQ
- Rabbitmq集群高可用测试
- C++基础——C++风格的类型转换(static_cast、const_cast、dynamic_cast、reinterpret_cast)
- 有关今后的学习计划
- Hadoop 元模式之作业归并
- iOS NSCondition结合代码以及项目进行详解
- [NOIP 2013]转圈游戏 快速幂
- Rabbitmq队列高可用的策略
- java中的快速排序实现
- 自定义动画CABasicAnimation
- elasticsearch学习步骤01--------简单介绍
- Spring-注解配置
- Ubuntu 12.04 在root登陆之后没有声音的解决方法
- 平摊分析(算法导论)
- 植物模型
- 在 Linux 上安装 PostgreSQL