Rabbitmq queue mirroring policy don't work when TTL policy is added to the cluster - rabbitmq

On a five nodes rabbitmq cluster,I created two policies. One is for queue replication and the other is for TTL policies.
When I create a queue replication policy with the below commands, It works successfully, without any error.
rabbitmqctl set_policy ha-three .replica. '{"ha-mode":"exactly","ha-params":2,"ha-sync-mode":"automatic"}'
After creating the queue replication policy, I added a TTL policy with the below command. But when I add the TTL policy, the queue replication policy lost its functionality and don't work. When I remove the TTL leave policy, the replication policy starts to work properly again.
rabbitmqctl set_policy TTL ".*" '{"message-ttl":3600000}' --apply-to queues
I don't understand why TTL policy affects the queue replication policy. Did I miss something? I want two policies are working on the same cluster without effecting each other.

Related

Rabbitmq x-overflow reject-publish does not work when set via web console

I'm trying to set the overflow behavior of a particular queue in the Rabbitmq to reject messages exceeding the max limit. I'm using the web console to add a new queue and set the x-max-length. Then I manually added x-overflow and gave it the value of reject-publish. But it seems the default overflow behavior is the one that is getting applied, where the older messages are removed and new ones are enqueued.
Is the way I'm defining the overflow behavior wrong? Could someone please point me how I should be setting the overflow behavior via the web console?
Its not work via web gui, only through cli.
Example:
rabbitmqctl set_policy limit-1gb ".*" '{"max-length-bytes":1000000000,"overflow":"reject-publish"}' --apply-to queues
rabbitmqctl set_policy limit-1m ".*" '{"max-length":1000000,"overflow":"reject-publish"}' --apply-to queues
The x-overflow option is only available for classic queues and NOT quorum queues. So if you were using quorum queue this is the explanation.
Currently (in Rabbit 3.8.5) the quorum queue only supports drop-head overflow, and not reject-publish or reject-publish-dlx.

RabbitMQ: In case of a Master queue going down , Is there a way to get those messages which are not replicated to mirror queues?

When the master node comes up and we make it the mirror of newly elected master.
Is there a configuration or way to re-queue those messages which were not replicated to mirror at the time of master going down ?.
I don't want to lose those messages. I am using ack=1 as I don't want to compromise on producer latency. I am okay with delayed delivery of the un-replicated messages.
Use automatic in ha-sync-mode for ex:
rabbitmqctl set_policy ha-all "" '{"ha-mode":"all", ,"ha-sync-mode":"automatic"}'

rabbitmq Per-Queue Message TTL can't work

I want to discard the messages in the rabbitmq queues when they are not consumed after 3 minutes.
According to official doc http://www.rabbitmq.com/ttl.html ;
rabbitmqctl set_policy TTL ".*" '{"message-ttl":60000}' --apply-to queues
I just set this command, but it don't work as I expect.
If the policy is called when the queues are empty,then the incoming messages will be discarded after expired. Otherwise, the old messages and new messages will be keep in the queues.
Any guys know why ?

HA RabbitMQ without set mirror policy

I set up lab about ha for rabbitmq using cluster and mirror queue.
I am using centos 7 and rabbitmq-server 3.3.5. with three server (ha1, ha2, ha3).
I have just joined ha1 and ha2 to ha3, but do not set policy for mirror queue. When I test create queue with name "hello" on ha1 server, after i check on ha2, and ha3 using rabbitmqctl list queue, hello queue is exist on all node on cluster.
I have a question, why i do not set policy to mirror queue on cluster, but it automatic mirror queue have been created on any node on cluster?
Please give me advice about I have mistake or only join node on cluster, queue will be mirror on all node of cluster. Thanks
In rabbitmq , by default, one queue is stored only to one node. When you create a cluster, the queue is available across nodes.
But It does't mean that the queue is mirrored, if the node gets down the queue is marked as down and you can't access.
Suppose to create one queue to the node, the queue will work until the node is up, as:
if the node is down you will have:
you should always apply the mirror policy, otherwise you could lose the messages

RabbitMQ policy synchronising of queues across cluster

We have setup a RabbitMQ cluster with 3 nodes. If an effort to have some form of load balancing, we setup the policy to only sync across 2 of the nodes:
rabbitmqctl set_policy ha-2 . '{"ha-mode":"exactly","ha-params":2,"ha-sync-mode":"automatic"}'
This works as expected when all 3 nodes are online.
When we shutdown one of the nodes (to simulate a failure) queues mastered on the failed node are still available (on the slave) but not synchronized to another node. If we manually re-apply the policy, the queues then synchronize as expected.
Should we expect that all queues be mirrored in the scenario that one node fails with this policy?
Works as expected in RabbitMQ 3.5.4