Failed to Create Cookie file RabbitMQ in Windows
Solution 1
Had the same H: problem. Set the home drive to some dir in the dos shell before executing the cli.
set HOMEDRIVE=C:/conf/rabbitmq :: Or your favorite dir
rabbitmq-plugins.bat enable rabbitmq_management
Use a folder in C drive. The rabbitmq system will write the cookie file there.
Solution 2
Find location of ".erlang.cookie" in your PC and run the commands bellow:
set HOMEDRIVE=[location of ".erlang.cookie"]
rabbitmq-plugins.bat enable rabbitmq_management
Solution 3
There are cases when your HOMEDRIVE and HOMEPATH get overridden by group policy (active directory user) and than you'll need to set your HOMEDRIVE variable each time you want to start RabbitMQ service. In this case what you can do is:
rabbitmq-service remove
serviceedit rabbitmq-service.bat file:
"!ERLANG_HOME!\bin\erl.exe" ^ -pa "!RABBITMQ_EBIN_ROOT!" ^ -boot !CLEAN_BOOT_FILE! ^ -noinput -hidden ^ -s rabbit_prelaunch ^ -setcookie "C:\Users\userName\" ^ <<< this is a place of your cookie !RABBITMQ_NAME_TYPE! rabbitmqprelaunch!RANDOM!!TIME:~9!@localhost ^ -conf_advanced "!RABBITMQ_ADVANCED_CONFIG_FILE!" ^ ..."
save the script
set HOMEDRIVE=C:\Users\userName
change homedrive before installing servicerabbitmq-service install
reinstall the service
now each time your reboot your service starts automatically and all paths are OK!
Solution 4
I solved the problem by following the steps below:
Open the file: "Program Files/RabbitMQ Server/rabbitmq_server-/sbin/rabbitmq-env"
At the end of the file, append the line:
REM Environment cleanup set BOOT_MODULE= set CONFIG_FILE= set FEATURE_FLAGS_FILE= set ENABLED_PLUGINS_FILE= set LOG_BASE= set MNESIA_BASE= set PLUGINS_DIR= set SCRIPT_DIR= set SCRIPT_NAME= set TDP0= set HOMEDRIVE=C: <<< the new path of the .erlang.cookie
Open the RabbitMQ console
write:
4.1.
rabbitmq-service stop
4.2.rabbitmq-service remove
4.3.rabbitmq-service install
4.4.rabbitmq-service start
Solution 5
While this may seem totally obvious, you do need to run cmd "as administrator" - I was getting the above error until I remedied that. :-)
user636525
Updated on October 13, 2021Comments
-
user636525 over 2 years
I am trying to run the following command
rabbitmq-plugins.bat enable rabbitmq_management
and its giving me an error like this:
11:36:55.464 [error] Failed to create cookie file 'h:/.erlang.cookie': enoent
I am using windows 7, Erlang Version R16B01 and RabbitMQ-Server version 3.1.5
I am using my work PC and our Corporate policy sets the HOMEDRIVE to h: and HOMEPATH to / and i dont think they will let me change this.
I can see the .erlang.cookie file under C:\Windows.
Could someone let me know of a workaround for this ?
Thanks in advance !