running Rabbitmq-server as a windows service

1,347 views
Skip to first unread message

Doğukan Güran

unread,
Aug 22, 2014, 5:01:03 AM8/22/14
to rabbitm...@googlegroups.com
Hi,

In the windows services, environment variables cannot be used. So, I cannot start the rabbitmq-server.bat file in my windows service.

But, I need to start the broker in the background and it should be running in the background as much as the computer(server) is running.

One more thing, I need to run the broker on a server and when I log off from the server, all my open applications would be closed forcefully, But, windows services that are created by me would continue it's running.

How can I use the broker as a windows service?

P.S. rabbitmq-server -detach does not satisfy my need.

Any help is appreciated,

Regards,
D.G.

Michael Klishin

unread,
Aug 22, 2014, 5:04:41 AM8/22/14
to rabbitm...@googlegroups.com, Doğukan Güran
On 22 August 2014 at 13:01:09, Doğukan Güran (doguka...@gmail.com) wrote:
> > In the windows services, environment variables cannot be used.
> So, I cannot start the rabbitmq-server.bat file in my windows
> service.
>
> But, I need to start the broker in the background and it should
> be running in the background as much as the computer(server)
> is running.
>
> One more thing, I need to run the broker on a server and when I log
> off from the server, all my open applications would be closed
> forcefully, But, windows services that are created by me would
> continue it's running.
>
> How can I use the broker as a windows service?

See Run RabbitMQ as a Service on http://www.rabbitmq.com/install-windows.html.
Environment variables can be used but that requires service *reinstallation*
(not just restart):
http://www.rabbitmq.com/configure.html#customise-windows-environment

Other Windows-specific caveats:
http://www.rabbitmq.com/windows-quirks.html

If you need to run RabbitMQ in the background from your own program,
this is a general Windows operations question, which we can't offer
help with on this list. 
--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Doğukan Güran

unread,
Aug 22, 2014, 5:23:06 AM8/22/14
to rabbitm...@googlegroups.com, doguka...@gmail.com
OK. Thanks,

but one more question, I hope you can answer it here,

What is the "erlsrv.exe"'s config file? When I run this, It runs the default configuration.


Regards,
D.G.

Michael Klishin

unread,
Aug 22, 2014, 5:28:39 AM8/22/14
to rabbitm...@googlegroups.com, Doğukan Güran
On 22 August 2014 at 13:23:11, Doğukan Güran (doguka...@gmail.com) wrote:
> > What is the "erlsrv.exe"'s config file? When I run this, It runs
> the default configuration.

Do you mean "how to make it use a custom config file"?

erlsrv.exe runs the Erlang VM as a Windows service:
http://www.erlang.org/doc/man/erlsrv.html

You can override RabbitMQ config file location using the
RABBITMQ_CONFIG_FILE env variable (again, remember to reinstall the service):
http://www.rabbitmq.com/configure.html.

Erlang VM flags can be changed using RABBITMQ_SERVER_ERL_ARGS.

Default paths are mentioned on http://www.rabbitmq.com/relocate.html

Doğukan Güran

unread,
Aug 22, 2014, 6:41:52 AM8/22/14
to rabbitm...@googlegroups.com, doguka...@gmail.com
I really mean that when I start the rabbitmq service, it is started listening on the port 5672(default) but I created my config file and configure new port(5050). How rabbitmq service will see and open the broker on the port 5050. What reinstalling the service  means? Is it uninstalling and instaling the erlang?

Michael Klishin

unread,
Aug 22, 2014, 6:56:55 AM8/22/14
to rabbitm...@googlegroups.com, Doğukan Güran
On 22 August 2014 at 14:41:58, Doğukan Güran (doguka...@gmail.com) wrote:
> > I really mean that when I start the rabbitmq service, it is started
> listening on the port 5672(default) but I created my config file
> and configure new port(5050). How rabbitmq service will see
> and open the broker on the port 5050.

You need to either edit the config in the standard location, or override
config file location. All of which is covered in the documentation I've linked to.

Also, see RabbitMQ log files: recent versions should log the config location
used .

> What reinstalling the service
> means? Is it uninstalling and instaling the erlang?

Uninstall RabbitMQ and install it again.

Simon MacMullen

unread,
Aug 22, 2014, 6:58:52 AM8/22/14
to Michael Klishin, rabbitm...@googlegroups.com, Doğukan Güran
On 22/08/14 11:56, Michael Klishin wrote:
>> >What reinstalling the service
>> >means? Is it uninstalling and instaling the erlang?
> Uninstall RabbitMQ and install it again.

Or:

> rabbitmq-service.bat install
> rabbitmq-service.bat stop
> rabbitmq-service.bat start

See http://www.rabbitmq.com/man/rabbitmq-service.man.html

Cheers, Simon

Jeremy Herman

unread,
Nov 14, 2014, 2:08:12 PM11/14/14
to rabbitm...@googlegroups.com, doguka...@gmail.com
See Run RabbitMQ as a Service on http://www.rabbitmq.com/install-windows.html
Environment variables can be used but that requires service *reinstallation* 
(not just restart): 
http://www.rabbitmq.com/configure.html#customise-windows-environment 

Michael, do you have an example of this?  How to 'reinstall' when it is already running as a windows service so that it picks up new environment variables? 

Jeremy Herman

unread,
Nov 14, 2014, 2:24:02 PM11/14/14
to rabbitm...@googlegroups.com, doguka...@gmail.com
Figured it out.  I was running rabbit-server vs rabbit-service.

Michael Klishin

unread,
Nov 14, 2014, 3:21:49 PM11/14/14
to Jeremy Herman, rabbitm...@googlegroups.com, doguka...@gmail.com
On 14 November 2014 at 22:08:13, Jeremy Herman (gal...@gmail.com) wrote:
> Michael, do you have an example of this? How to 'reinstall' when
> it is already running as a windows service so that it picks up new
> environment variables?

There's an uninstaller, search for "RabbitMQ" in the start menu. Then install it again. 

Jeremy Herman

unread,
Nov 14, 2014, 5:11:44 PM11/14/14
to rabbitm...@googlegroups.com, gal...@gmail.com, doguka...@gmail.com
Hi Michael,

I saw that.  Thanks!  However my service needs to run that command, and my service is ran under the "Local Service" account.  Attempting to run that command under the service gives me the following error:

RabbitMQ: Could not start erlang service "RabbitMQ"with commandline ["C:\Program Files\erl6.1\erts-6.1\bin\erl.exe" -service_event ErlSrv_RabbitMQ -nohup -sname rabbit@WIN7X64ENT-0  -pa "C:\\Program Files (x86)\\RabbitMQ Server\\rabbitmq_server-3.3.4\\sbin\\..\\ebin" -boot start_sasl -s rabbit boot -config "C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming\\RabbitMQ\\rabbitmq" +W w +A30 +P 1048576 -kernel inet_default_connect_options "[{nodelay,true}]"   -sasl errlog_type error -sasl sasl_error_logger false -rabbit error_logger {file,\""C:/Windows/system32/config/systemprofile/AppData/Roaming/RabbitMQ/log/rabbit@WIN7X64ENT-0.log"\"} -rabbit sasl_error_logger {file,\""C:/Windows/system32/config/systemprofile/AppData/Roaming/RabbitMQ/log/rabbit@WIN7X64ENT-0-sasl.log"\"} -rabbit enabled_plugins_file \""C:/Windows/system32/config/systemprofile/AppData/Roaming/RabbitMQ/enabled_plugins"\" -rabbit plugins_dir \""C:/Program Files (x86)/RabbitMQ Server/rabbitmq_server-3.3.4/sbin/../plugins"\" -rabbit plugins_expand_dir \""C:/Windows/system32/config/systemprofile/AppData/Roaming/RabbitMQ/db/rabbit@WIN7X64ENT-0-plugins-expand"\" -rabbit windows_service_config \""C:/Windows/system32/config/systemprofile/AppData/Roaming/RabbitMQ/rabbitmq"\" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia dir \""C:/Windows/system32/config/systemprofile/AppData/Roaming/RabbitMQ/db/rabbit@WIN7X64ENT-0-mnesia"\"  -kernel inet_dist_listen_min 25672 -kernel inet_dist_listen_max 25672 ].
Reply all
Reply to author
Forward
0 new messages