Making RabbitMQ independent of hostname of system without RabbitMQ data loss

248 views
Skip to first unread message

Rohit Roshan

unread,
Apr 4, 2019, 6:43:32 AM4/4/19
to rabbitmq-users
Hi,

I wanted to make  RabbitMQ independent of hostname of system without RabbitMQ data loss.

I have done below steps but getting the below error.

Step 1
Run .\rabbitmq-service.bat remove
output : Service RabbitMQ removed from system.

Step 2
In rabbitmq-env-conf.bat
set RABBITMQ_NODENAME=rabbit@FIXED_NODE_NAME

Step 3

node name (FIXED_NODE_NAME) is added to the hosts file
127.0.0.1       FIXED_NODE_NAME

Step 4

Run  .\rabbitmq-service.bat install
Output  : Unable to register RabbitMQ service with service manager.
Error: The specified service has been marked for deletion.
: No service with the name RabbitMQ exists.

So during install and start i am getting above error

Kindly let me know where i am doing wrong or how to fix it ? also will my queues and shovels be not impacted by the above steps taken ? Since the reuirement is even if change of hostname of system , rabbitMQ should be running properly and queue and shovels data should not be lost.

Thank You
Message has been deleted

Luke Bakken

unread,
Apr 4, 2019, 10:58:01 AM4/4/19
to rabbitmq-users
Hi Rohit,

Did you stop the RabbitMQ service prior to running .\rabbitmq-service.bat remove ?

Rohit Roshan

unread,
Apr 4, 2019, 2:16:14 PM4/4/19
to rabbitmq-users
Hi Luke,

Thanks for the response.

Now after stopping  RabbitMQ service , I am able to install and start.

But When i am login to rabbitmq GUI using URL https://localhost:15671 , i am not finding any queue ,shovels and users created.
In the DB and log folder , new folders are created prefixed with rabbit@FIXED_NODE_NAME , also folders are having all content as previous folder which was prefixed with older host name.

i tried running command to rename the cluster but it tells it is already done

rabbitmqctl rename_cluster_node rabbit@WIN-34HO88LIRD0 rabbit@fixedhost
Renaming cluster nodes:
  rabbit@WIN-12345 -> rabbit@fixedhost


Error: {nodes_already_in_cluster,[rabbit@fixedhost]}

Can you let me know how can i recover the data or avoid losing it in the process

Regards
Rohit Roshan

Luke Bakken

unread,
Apr 4, 2019, 5:50:39 PM4/4/19
to rabbitmq-users
Hi Rohit,


You must stop the node, and move old directories to those that use the new name. The old directory will be in the %AppData%\RabbitMQ directory of the administrative user that installed RabbitMQ.

Thanks,
Luke

Rohit Roshan

unread,
Apr 5, 2019, 6:44:34 AM4/5/19
to rabbitmq-users
Hi Luke,

When i am trying to stop the node , i am getting below error

command rabbitmqctl stop rabbit@fixedhost
output Stopping and halting node rabbit@fixedhost
Error: {could_not_read_pid,{error,enoent}}

But rabbitmqctl stop_app and rabbitmqctl  start_app commands are working 

>rabbitmqctl stop_app
Stopping rabbit application on node rabbit@fixedhost

rabbitmqctl start_app
Starting node rabbit@fixedhost

But it does not make any difference. still not able to see queues and shovels

old directories are moved to those that use the new name by installing and starting the service.

 I have attached the folder snapshots.

Regards
Rohit Roshan
DB_folder.png
log_folder.JPG

Luke Bakken

unread,
Apr 5, 2019, 8:39:54 AM4/5/19
to rabbitmq-users
Hi Rohit,

When reading the RabbitMQ docs, sometimes it's necessary to adjust for Windows.

To stop the service, use the rabbitmq-service.bat stop command like you did before when you changed the node name.

Then, after stopping the service, remove the rabbit@fixedhost* directories (the new ones), and rename the old directories so they start with rabbit@fixedhost- rather than the other host name.

Then, use rabbitmq-service.bat start to start.

I've created the following issue to improve the error you get if you mistakenly use rabbitmqctl stop on Windows - https://github.com/rabbitmq/rabbitmq-cli/issues/338

Thanks,
Luke

Rohit Roshan

unread,
Apr 5, 2019, 2:26:33 PM4/5/19
to rabbitmq-users
Hi Luke,

I have followed same steps given by you in the previous reply but no luck.
Still queue and shovels are not available.

am i missing something else in the process ?


Regards
Rohit Roshan

Luke Bakken

unread,
Apr 5, 2019, 3:04:35 PM4/5/19
to rabbitmq-users
Hi Rohit,

As long as your old data directories contained the expected information, renaming them to the new directory name reflecting the new host name should work.

Since I don't have a complete transcript of all the commands you ran, I can't say exactly where the process didn't work.

I recommend making sure you are using the correct name for the directories. There should only be directories starting with rabbit@fixedhost-* in your %AppData%\RabbitMQ directory.

Thanks,
Luke

On Friday, April 5, 2019 at 11:26:33 AM UTC-7, Rohit Roshan wrote:
Hi Luke,

Rohit Roshan

unread,
Apr 8, 2019, 1:34:20 PM4/8/19
to rabbitmq-users
Hi Luke,

I am putting down below sequential steps and response i have done , which may help you to figure our where it is going wrong

Step1 : node name (fixedhost) is added to the hosts file

1.JPG





Now DB and Log folder is having files with old hostname

2.JPG






3.JPG





Step 2 : Stopped RabbitMQ

Step 3 : removed from service
4.JPG


Step 4 : in rabbitmq-env-conf.bat , set the rabbitMQ node name
6.JPG



Step 5 : install command

5.JPG




Step 6 : start command
9.JPG


Step 7 : tried to start the node but got pid error
10.JPG


Step 8 : As suggested by you stopped the rabbitMQ 
11.JPG


Step 9:  Tried to reconfigure node but it was telling already reconfigured with new hostname
12.JPG



By now DB and log folder was having new files with new hostname
13.JPG 





Step 10 : deleted the new files/folder with fixedhost name and renamed the older one with fixedhost
14.JPG




Step 11 : Finally started rabbitMQ 
15.JPG


But queues and shovels are gone.

16.JPG








Please review my process and add if i am missing anything.

Thanks in Advance 

Regards
Rohit Roshan

Luke Bakken

unread,
Apr 8, 2019, 2:42:04 PM4/8/19
to rabbitmq-users
Hi Rohit,

Thanks for the detailed sequence of steps. Some of the screenshots are too small to read, unfortunately.

Rather than continue with a back-and-forth, I installed RabbitMQ 3.7.14 on my Windows 8.1 VM and then renamed the node to rabbit@fixedhost

The entire sequence of commands can be seen in the attached file.

Thanks,
Luke
windows-rename-node-transcript.txt

Rohit Roshan

unread,
Apr 10, 2019, 5:10:32 AM4/10/19
to rabbitmq-users
Hi Luke,

Thanks for the steps.
I tried and it is working for me as well.
There were mistake in the sequence of my steps.

Thanks a lot . 

Regards
Rohit Roshan

Arun Kumar

unread,
Apr 10, 2019, 5:13:23 AM4/10/19
to rabbitmq-users
Hi Luke,

Even I was trying Rabbitmq hostname change handling and your detailed steps helped me very much. Appreciate for your help. Thank you
Reply all
Reply to author
Forward
0 new messages