1
votes

I want to install RabbitMQ Service as a Windows Service. I see an option to install RabbitMQ Service from installer (v3.6.5). However, it does not work.

I write a Batch script trying to re-install RabbitMQ service after running installer file.

set HOMEDRIVE=C:
set HOMEPATH=\Users\%username%

call "C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.5\sbin\rabbitmq-service.bat" remove
call "C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.5\sbin\rabbitmq-service.bat" install

call net start RabbitMQ

call "C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.5\sbin\rabbitmq-plugins.bat" enable rabbitmq_management

However, this script is quite unstable. Sometimes it works, but sometimes it doesn't.

I tested in many PCs with Windows 10, Windows 8.1, Windows 7 and Windows Server 2012.

When error occurs, it always occurs in the last command (enabling RabbitMQ management)

C:\Program Files\erl9.0\erts-9.0\bin\erlsrv: Service RabbitMQ removed from system.
C:\Program Files\erl9.0\erts-9.0\bin\erlsrv: Service RabbitMQ added to system.
The RabbitMQ service is starting.
The RabbitMQ service was started successfully.

Plugin configuration unchanged.

Applying plugin configuration to rabbit@<myhost>... failed.
* Could not contact node rabbit@<myhost>.
Changes will take effect at broker restart.
* Options: --online  - fail if broker cannot be contacted.
--offline - do not try to contact broker.

Sometimes, I got this error

...
Plugin configuration unchanged.

Applying plugin configuration to rabbit@<myhost>... failed.
Error: noproc

In my PC, I get the first error (could not contact node...) when %HOMEDRIVE%%HOMEPATH% is C:\users\myusername. When I change to C:\Windows, it works well. Then I change back to C:\users\, it also works well, no more error.

However, on a server with Windows Server 2012, even C:\Windows does not work (could not contact node...).

In all PCs, I see .erlang.cookie file in both C:\Windows and C:\Users[username]. (I don't know anything about erlang, just follow some instructions from other questions in StackOverFlow).

What is wrong with my script?

  1. Is the error related to the version of RabbitMQ? I am not using the latest version.

  2. Is it related to Erlang? I guess if Erlang caused this problem, then two commands about removing/installing RabbitMQ service would be failed.

  3. Is it able to install the service without checking service option from installer, just run command rabbitmq-service.bat install?

1

1 Answers

0
votes

The RabbitMQ team monitors this mailing list and only sometimes answers questions on stackoverflow.

You should be using the most recent version of the RabbitMQ installer for Windows, available here. I am assuming that <myhost> in your question is an edited-out hostname, not what is actually being used. You also don't mention which version of Erlang you have installed, but I assume it is a recent one.

You should uninstall RabbitMQ and ensure all traces are removed from C:\Users\myusername (be sure to check %APPDATA%) and C:\Windows. You should not have to change the default values of HOMEDRIVE and HOMEPATH prior to installation. Use an administrative account when running the Erlang and RabbitMQ .exe installers.

Please note that 3.6.12 has this issue on Windows. A workaround is to set vm_memory_calculation_strategy to erlang. I fixed this issue and it will be delivered in 3.6.13.

Thanks for using RabbitMQ!