RabbitMQ: Use the new rabbitmq.conf file on Windows

To use the new rabbitmq.conf file on windows you must re-install the service to let it use the conf file, and the file must exists on disk before you re-install the service.

Here’s the steps to enable the new rabbitmq.conf file:

  1. Go to the rabbitmq folder, usually “%appdata%\RabbitMQ”
  2. Create a file named “rabbitmq.conf” (if you want you can take the example file from github)
  3. Open the command prompt from start menu using the link “RabbitMQ Command Prompt (sbin dir)”
  4. Stop the service
    rabbitmq-service stop
  5. Remove the service
    rabbitmq-service remove
  6. Install the service
    rabbitmq-service install
  7. Start the service
    rabbitmq-service start
Advertisements

RabbitMQ: Move base/data/db directory to another drive/location on Windows

Here’s the steps to move all the base RabbitMQ directory (with also data and log directory) to another location on Windows:

  • open the command prompt from start menu using the link “RabbitMQ Command Prompt (sbin dir)”
  • stop the service
rabbitmq-service stop
  • kill the process “epmd.exe” from the task manager using the details tab
  • move the folder from “%appdata%\RabbitMQ” to a different location for instance “D:\”
  • install the service
rabbitmq-service install
  • start the service
rabbitmq-service start

Enjoy!

RabbitMQ: Completely Hard Reset a RabbitMQ Server Installation

clean-rabbitmq

Probably the most exciting thing of this post is the funny image of RabbitMQ’s cleaner 🙂

Yes, you can also reset the RabbitMQ instance, by running these commands:

rabbitmqctl.bat stop_app

rabbitmqctl.bat reset

rabbitmqctl.bat start_app

soft-reset-rabbitmq

…but sometimes could be necessary to clean up stuff, especially when you have played around cluster, multiple node on the same machine, ad so on.

It took me a while to figure out who was maintaining a reference to the %appdata%\RabbitMQ folder, even after I uninstalled Erlang, so here’s the simple steps:

  1. Uninstall RabbitMQ Server
  2. Kill the process epmd.exe (this was the process maintaning a reference to the RabbitMQ folder)
    rabbitmq-epmd-process
  3. Delete the folder RabbitMQ that is under %appdata%
    rabbitmq-folder-wont-delete If you also want to change the erlang cookie, you will need to delete also the file “.erlang.cookie” that you find under your users folder %userprofile%
    rabbitmq-erlang-cookie If you have a cluster and remove .erlang.cookie the node would no be able to rejoin the cluster
  4. Reinstall RabbitMQ Server

 

That’s all folks!

RabbitMQ: Change the Hostname

rabbitmq-change-hostname

WARNING: ALL THE RABBITMQ DATA WILL BE LOST WITH THIS OPERATION. Please backup your rabbitmq database before doing this (check the documentation about).

If you change the name of the machine where RabbitMQ server is installed, you will see that the service will no longer be startable, this because RabbitMQ relays on the machine name to create and connect to the node, even if it is local.

To fix this problem, you just have to reinstall the rabbitmq windows service, by using the proper command line utility rabbitmq-service.bat

*********************
Service control usage
*********************

rabbitmq-service help    - Display this help
rabbitmq-service install - Install the RabbitMQ service
rabbitmq-service remove  - Remove the RabbitMQ service

The following actions can also be accomplished by using
Windows Services Management Console (services.msc):

rabbitmq-service start   - Start the RabbitMQ service
rabbitmq-service stop    - Stop the RabbitMQ service
rabbitmq-service disable - Disable the RabbitMQ service
rabbitmq-service enable  - Enable the RabbitMQ service
  1. First start a command prompt as administrator and go to the rabbitmq-server-x sbin folder
    cd %programfiles(x86)%\RabbitMQ Server\rabbitmq_server-3.3.2\sbin
  2. Uninstall the service
    rabbitmq-service.bat remove
  3. Install the service
    rabbitmq-service.bat install

This should recreate the service and configure it to start the node with the correct name.

If this doesn’t work you can follow the instruction on how to completely reset a rabbitmq server installation.