How do I maintain the same internal host on RabbitMQ?

21 Views Asked by At

I am running RabbitMQ on a virtual machine of a local server (for development, testing, and staging environments). When there is an electrical power instability, the server ends up restarting, and RabbitMQ changes its internal IP address. Consequently, I have to redo the connections of the apps that were already connected to it using the previous IP address. I would like to maintain the same IP address even if it restarts.

I haven't found any configuration in RabbitMQ to enable this. Has anyone done this before?

I hope that the RabbitMQ server maintains the same internal IP address. To achieve this, I've tried checking the settings within RabbitMQ itself and connections, but I haven't found anything that could satisfy this requirement.

2

There are 2 best solutions below

0
Gabriele Santomaggio On
  1. RabbitMQ does not change any IP address. Maybe the server changes the IP due to dynamic IP.

  2. In case you have multiple IP(s) on your machine, you can define the listener IP:Port

Like:

listeners.tcp.1 = 192.168.1.99:5672

https://www.rabbitmq.com/docs/networking#interfaces

0
juarez9j On

You can use DNS host name

For example, if IP is 192.168.2.6 , change inside Operating System local DNS database to server name , then when OS restart and change IP, just change IP from DNS database.

Explain

a. IP RabbitMQ : 192.168.2.6.

b. set DNDS local.myRabbitServer.com : 192.168.2.6.

C. APP connect to : local.myRabbitServer.com.

d. When server restart and change IP to : 192.168.2.10.

e. update DNS local.myRabbitServer.com : 192.168.2.10.

f. APP connect same DNS no change, local.myRabbitServer.com.

Alternative ....

Use your Virtual Machine APP, to setting STATIC IP for your virtual host. Generally all Virtual Machines Apps have feature to set static IP.