rabbitmq monitoring master node in the cluster configuration - rabbitmq

is there a way to understand who is the master node in the cluster High Availability configuration?
is it possibile to do this using the monitoring tool ?

is there a way to understand who is the master node in the cluster
High Availability configuration?
I assume you mean "queue master", i.e. the node that is running the actual queue. This information can be shown by running rabbitmqctl list_queues name pid which will show the name of the master node in the pid column. Or, you can query the information using the HTTP API
$ curl -4su guest:guest localhost:15672/api/queues/%2F | jq '.[] | "\(.name) \(.node)"'
"amq.gen-S-CMD0E2NPXabpIOGdvDQg rabbit#localhost"
"test rabbit#localhost"
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

Related

Federated Queue is not appearing in Downstream node/server

I am trying to federate messages using Federate queue in two machines.But I am not able to see federated queue automatically creating in downstream server.
Lets say example,I have two server A(Upstream) and B(Downstream).I did configuration properly and installed federation plugin and used policy ,
rabbitmqctl set_policy --apply-to queues federate-me "" \ '{"federation-upstream-set":"all"}'
and added upstream ,
rabbitmqctl set_parameter federation-upstream my-upstream '{"uri":"amqp://****:****#address","expires":3600000}'
After that I have published one message to Queue("Test_Queue") to A server but the "Test_Queue" should automatically create in B Server right? but it is not happening.
Any help would be appreciated.
Thank you.

How to get notifications about failovers in Redis cluster to the client application

Is there a way for a client to get notified about failover events in the Redis cluster? If so, which client library would support this? I am currently using Jedis but have the flexibility to switch to any other Java client.
There are two ways that I can think of to check this, one of them is to grep for master nodes on the cluster, keeping in mind their IDs, if the ports changed for any of them then a failover happened.
$ redis-cli -p {PORT} cluster nodes | grep master
Another way, but it is not as robust of a solution is using the consistency checker ruby script, that will start showing errors in writes as an output, which you can monitor and send notifications depending on it, since that happens when the read server is trying to take its master's role.
Sentinel (http://redis.io/topics/sentinel) has the ability to monitor the cluster member, and send a publish/subscribe notification upon failure. The link contains a more in-depth explanation and tutorial.

RabbitMQ Set the HA Policy

I know the HA Policy is set by the following command:
$ rabbitmqctl set_policy ha-all "" '{"ha-mode":"all","ha-sync-mode":"automatic"}'
My question which seems basic:
Do I have to issue this command on each node or just one of them?
RabbitMQ provides to distributes the policy to all the cluster, so it does not matter which node you select the info will be distribute to the other nodes.
Please read here: https://www.rabbitmq.com/clustering.html
A RabbitMQ broker is a logical grouping of one or several Erlang
nodes, each running the RabbitMQ application and sharing users,
virtual hosts, queues, exchanges, bindings, and runtime parameters.
Sometimes we refer to the collection of nodes as a cluster.

Fetching or viewing a rabbitmq results

When I was trying to display rabbitmq queue details as follows, It display result as follows:
sudo rabbitmqctl list_queues | grep notifications.info
notifications.info 37
Now my question is that how to fetch or view those messages or information contained in notifications.info.
In case you have the admin plugin installed, you can peek inside those messages using the admin UI. Usually available on port 15672 of your rabbitmq host.
You can see if this plugin is installed by running:
rabbitmq-plugins list
Another way to receive messages from the queue is by using one of the many rabbitmq clients. E.g. the RabbitMq java client: https://www.rabbitmq.com/java-client.html. What's your favorite programming language? Chances are that there is a client for you. Here is an overview of available clients: https://www.rabbitmq.com/devtools.html

How can I determine which nodes in my rabbitmq cluster are HA?

I have a clustered HA rabbitmq setup. I am using the "exactly" policy similar to:
rabbitmqctl set_policy ha-two "^two\." \'{"ha-mode":"exactly","ha-params":10,"ha-sync-mode":"automatic"}'
I have 30 machines running, of which 10 are HA nodes with queues replicated. When my broker goes down (randomly assigned to be the first HA node), I need my celery workers to point to a new HA node (one of the 9 left). I have a script that automates this. The problem is: I do not know how to distinguish between a regular cluster node and a HA node. When I issue the command:
rabbitmqctl cluster_status
The categories I get are "running nodes", "disc", and "ram". but there is no way here to tell if a node is HA.
Any ideas?
In cluster every node share everything with another, so you don't have do distinguish nodes in your application in order to access all entities.
In your case when one of HA node goes down (their number get to 9), HA queues will be replicated to first available node (doesn't matter disc or ram).