Thierry Templier
Thierry Templier

Reputation: 202286

How to auto-restart rabbitmq after crashing

I experienced some crash for rabbitmq on my Linux server. To restart it, I execute the following command:

systemctl restart rabbitmq-server.service

The server restarts correctly.

Another problem is that I have to restart all the Node applications that were connected to rabbitmq before crashing.

Here are my questions:

Thanks very much for your help! Thierry

Upvotes: 0

Views: 1961

Answers (1)

Soumen Mukherjee
Soumen Mukherjee

Reputation: 3272

So to answer your first question , the best way to handle it is run the RabbitMQ cluster on docker and have the container restart mode set to always so in case if a node goes down for some reason the container will stop and the docker deamon will spawn a new container for it , if you can use K8s then it is even better.

For our second question the general pattern that we follow in Client applications is to have a reconnect logic which is triggered whenever there is an IO Exception and the reconnect attempt is continued for configured number of times with some wait added in between each attempt. There is no automatic way to do this and has to be handled as part of my client app.

Upvotes: 1

Related Questions