6

I'm setting up an instance of RabbitMQ to run on my development workstation so as to make tests.

I would like to play with the configuration (conf regarding flow control in my case).

I've installed erlang, rabbitmq-server-3.1.1, set RABBITMQ_BASE to a certain directory, set RABBITMQ_CONFIG_FILE to c:/path/to/myconf (so it references c:\path\to\myconf.config).

Now I open my cmd and execute rabbitmq-service install. The web manager shows that my RMQ server is up and running.

But the value for disk_free_limit I've set does not match.

I don't know if the config file is not read or if I my config file has errors and is therefore ignored.

Content of my conf file:

[
    {rabbit,
        [
            {disk_free_limit, 250000000}
        ]
    }
].

Launch report in the logs (it shows that my conf file is not read):

=INFO REPORT==== 12-Jun-2013::17:06:44 ===
node           : rabbit@DEV-WORKSTATION
home dir       : C:\Windows
config file(s) : (none)
cookie hash    : 2SazL+DgWDMqrHlr4w8R8A==
log            : c:/rabbitmq_server-3.1.1/RabbitMQ/log/DEV-WORKSTATION.log
sasl log       : c:/rabbitmq_server-3.1.1/RabbitMQ/log/rabbit@DEV-WORKSTATION-sasl.log
database dir   : c:/rabbitmq_server-3.1.1/RabbitMQ/db/rabbit@DEV-WORKSTATION-mnesia

Thanks for your help.

Olivier H
  • 245
  • 1
  • 3
  • 8
  • I removed the `RABBITMQ_CONFIG_FILE` env var and left `RABBITMQ_BASE`. I moved my config file to `%RABBITMQ_BASE%\rabbitmq.config`. And now the settings are read correctly. Is it a bug happening only under windows? – Olivier H Jun 12 '13 at 15:54
  • The question of why the setting file is skipped is still awaiting an answer, even if i can work now :) – Olivier H Jun 12 '13 at 15:54
  • When you say `%RABBITMQ_BASE%\rabbitmq.config`, is that the same as `%APPDATA%\RabbitMQ\rabbitmq.config`? Coincidentally, I'm trying to configure the same `disk_free_limit` setting, so far without success, even when putting the config in the default location. It always says "config file(s): (none)" and `rabbitmqctl status` confirms it didn't pick up my settings. – Evgeniy Berezovsky Aug 08 '13 at 04:53
  • When running `rabbitmq-server`, it'll use `%APPDATA%\RabbitMQ\rabbitmq.config`, but not when running as a service. – Evgeniy Berezovsky Aug 08 '13 at 05:08
  • Figured it out. My comment to @MosheKatz's answer elaborates. – Evgeniy Berezovsky Aug 08 '13 at 05:16
  • Have you tried Windows-style backslashes as well? – Evgeniy Berezovsky Aug 09 '13 at 03:27

2 Answers2

6

I had the same issue and struggled to figure it out. I think the options provided in the start menu are doing things incorrectly. Once I ran from the command line it worked well.

set the RABBITMQ_CONFIG_FILE to your config file 1. Add your config file 2. rabbitmq-service stop 3. rabbitmq-service remove 4. rabbitmq-service install

Then it was able to pickup the config file

Dharshan
  • 321
  • 3
  • 5
  • Cheers.. removing service and re-installing did the trick for me but it still ignored the RABBITMQ_CONFIG_FILE env variable and looked for rabbitmq.conf in the RABBITMQ_BASE directory – Ocean Airdrop Oct 04 '18 at 04:01
5

Make sure you set the RABBITMQ_CONFIG_FILE environment variable in the correct place. It needs to be in the System variables section in Control Panel > System > Advanced... > Environment Variables.

Note that all that the RabbitMQ Service start script does is:

if "!RABBITMQ_CONFIG_FILE!"=="" (
    set RABBITMQ_CONFIG_FILE=!RABBITMQ_BASE!\rabbitmq
)

which simply checks if the variable is set and sets it to the default if it isn't set. It then goes on to check if the file, appending a .config extension, exists:

if exist "!RABBITMQ_CONFIG_FILE!.config" (
    set RABBITMQ_CONFIG_ARG=-config "!RABBITMQ_CONFIG_FILE!"
) else (
    set RABBITMQ_CONFIG_ARG=
)

(I can't really say that I recommend doing this, but, if you really want to, you can change c:/rabbitmq_server-3.1.1/RabbitMQ/sbin/rabbitmq-service.bat so the line above uses the location that you want as the default.)

Evgeniy Berezovsky
  • 851
  • 1
  • 8
  • 26
Moshe Katz
  • 3,053
  • 3
  • 26
  • 41
  • 6
    It's important to note that the above code section in `rabbitmq-service.bat` is only run once when installing the service. So if you add a config file later on, you'll have to reinstall the service for the config file settings to be picked up. – Evgeniy Berezovsky Aug 08 '13 at 05:15