CI/CD

Installing RabbitMQ on Windows

RabbitMQ is a trending message queue solution used by many software products today. From the release manager or CI/CD master point of view, it’s just another component that needs to be installed when delivering the product to the customer. Ideally, this should be automated but it depends on the customer environment how the particular configuration will be. Doing it several times I have prepared this step-by-step guide on how to install RabbitMQ successfully on Windows. Sure there is a lot of such guides available but I have included a few points which can save hours of troubleshooting to newbies.

1. Download installation packages

Original Windows installation guide https://www.rabbitmq.com/install-windows.html.

RabbitMQ requires Erlang to run. Consider it in your planning because it’s another product and dependency you should install in a customer’s environment and especially large companies with good security can be resistant against it.

There are several compilations for Windows. Choose the right one as in the picture. The other won’t work because it’s not precompiled.
attachment73939.png

The distribution right on the top of the download page has different folders structure then folders described below.

2. Install Erlang

  • Install Erlang from the downloaded package. Do it under the admin account and use the default folders setting.

3. Install RabbitMQ

  • Install RabbitMQ from the downloaded package. Do it under the admin account and use the default folders setting.

4. Install Handle

  • Extract Handle package to C:\Program Files\Handle and add this path to PATH in Environments settings.
  • If this step isn’t completed properly or Handle installation is skipped, RabbitMQ will work but it will log every 5 minutes in log message “2020-06-06 14:27:21.699 [error] <0.753.0> Could not find handle.exe, please install from sysinternals” and in the admin interface the proper number of used/free file descriptors will be 0.

5. Setup PATHs

  • Create RABBITMQ_BASE variable in Environment variables and point it to folder C:\Server\RabbitMQ where RabbitMQ configuration, logs, and data will be stored.
  • Create RABBITMQ_SERVER variable and point it to the folder where RabbitMQ was installed. By default, it should be C:\Program Files\RabbitMQ Server\rabbitmq_server-{version}.attachment11158.png
  • Create ERLANG_HOME variable and point is to the Erlang installation folder. By default, it should be C:\Program Files\erl{version}.
    attachment79378.png

6. Configure and run RabbitMQ

Setting advanced.config
  • If you would like to specify the custom port number or different admin account and password you must create file advanced.config in the RABBITMQ_BASE path and insert following lines:
[
   {rabbit, [
     {tcp_listeners, [5672]},
     {default_user, <<"admin">>},
     {default_pass, <<"admin">>}
     ]
   }
].
  • When choosing the port number make sure it isn’t used by another application or services. Otherwise, RabbitMQ will not start and log the message that the lister can’t be registered.
  • Make sure this port is allowed in the Windows firewall when accessing RabbitMQ from a remote PC.
  • When advanced.config file isn’t properly formatted RabbitMQ services won’t start crashing unclear exception to Windows application logs. The dot and the end of configuration is also part of a properly formatted configuration file.
  • User name and password specified in advance.config file will be used for first sign up to web administration later.
Installing RabbitMQ as Windows service
  • Open elevated Commnad line and switch to \sbin folder in RabbitMQ installation path. (By default C:\Program Files\RabbitMQ Server\rabbitmq_server-{version}\sbin).
  • Add a plugin for web administration running the command .\rabbitmq-plugins.bat enable rabbitmq_management.
    • If it will report that ERLANG_HOME isn’t defined then try so sign out or restart the PC.
    • If Firewall notification will pop up allow it for private networks.
  • Run .\rabbitmq-service.bat install to install RabbitMQ as Windows Service.
  • Start the service with the command .\rabbitmq-service.bat start. Sure you can start it manually via Services manager.
  • When the service was started successfully you should see the following folders structure in RabbitMQ folder:
    attachment26304.png

    • If the service will crash on start and you will see erl_crash file in the folder having in header message that Kernel pid terminated (application_controller) ({application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,failed_to_read_advanced_configuration_file}},{rabbit_prelaunch, it’s most probably inproperly formatted advanced.config.You can verify it that you will delete the file and service will start again.
Connecting and troubleshooting
  • Try to connect to RAbbitMQ web administration at the URL http://localhost:15672. You should see a screen like this one:

    • Use user name and password configured in advanced.config to log in.
    • If the web administration won’t load then check logs in RABBITMQ_BASE\log and fix configuration as needed.
    • If you can’t log with then user name and password from advanced.config file it’s possible that RabbitMQ service was launched before advanced.config file was created. In that case, RabbitMQ has created the default user guest with password guest. Try to log with this credential.
    • If you would like to reset the guest and user the one from advanced.config then stop the service, delete the content of folders RABBITMQ_BASE\db and RABBITMQ_BASE\log and start the service. This will push RabbitMQ to create a new database and configuration and your advanced.config will be used.

Finally, you should review RABBITMQ_BASE\log if something isn’t going wrong in the background.

Note: Please remember that every change in configuration requires RabbitMQ service to be restarted.

Further reading:

Leave a Reply

Your email address will not be published. Required fields are marked *