RabbitMQ keep alive: failed in opening a new connection: dial tcp 127.0.0.1:5672: connect: connection refused
The connection refused error may occur when the RabbitMq fails to start but the Xray startup is initialized. The possible reasons for this could be the erlang cookie mismatch and preventing the RabbitMq startup through “xray” user
To confirm this, navigate to the the directory /opt/jfrog/xray/app/third-party/rabbitmq/sbin and execute ./rabbitmqctl cluster_status
If there is any error observed like below, then it means that the erlang cookie created by Xray is not matching with the erlang cookie created by the rabbitmq itself

As highlighted above the erlang cookie will be available under the effective user’s home directory. To confirm the content of all the .erlang.cookie files, navigate to the path “/opt/jfrog/xray” and “/root” then verify the .erlang.cookie file with “/opt/jfrog/xray/app/third-party/rabbitmq/.erlang.cookie”.
The content of all the .erlang.cookie should match and it is expected to have the content “JFXR_RABBITMQ_COOKIE”. If any mismatch is identified, stop Xray, and make sure all the rabbitmq processes are stopped. To retrieve the PID, use the below commands and use kill -9 <PID>
Further, update the values on all places ie [“/root”, “/opt/jfrog/xray”, “/opt/jfrog/xray/app/third-party/rabbitmq/.erlang.cookie” ] and update the system.yaml to use the “JFXR_RABBITMQ_COOKIE” as rabbitmq.erlangCookie.value.
After updating the files, navigate to the /opt/jfrog/xray/var/data/rabbitmq/mnesia directory and take a backup and delete the contents within the directory.
Starting from Xray 3.8x, the stop and restart action on Xray will not be applied to RabbitMQ process. On start action of Xray, if RabbitMQ is not running, it will be started.
If you want the script to perform stop and restart action on RabbitMQ, set shared.rabbitMq.autoStop as true in the system.yaml. Note that this flag is not consumed in docker-compose installation.
Finally, restart Xray.
The connection refused error may occur when the RabbitMq fails to start but the Xray startup is initialized. The possible reasons for this could be the erlang cookie mismatch and preventing the RabbitMq startup through “xray” user
To confirm this, navigate to the the directory /opt/jfrog/xray/app/third-party/rabbitmq/sbin and execute ./rabbitmqctl cluster_status
If there is any error observed like below, then it means that the erlang cookie created by Xray is not matching with the erlang cookie created by the rabbitmq itself
As highlighted above the erlang cookie will be available under the effective user’s home directory. To confirm the content of all the .erlang.cookie files, navigate to the path “/opt/jfrog/xray” and “/root” then verify the .erlang.cookie file with “/opt/jfrog/xray/app/third-party/rabbitmq/.erlang.cookie”.
The content of all the .erlang.cookie should match and it is expected to have the content “JFXR_RABBITMQ_COOKIE”. If any mismatch is identified, stop Xray, and make sure all the rabbitmq processes are stopped. To retrieve the PID, use the below commands and use kill -9 <PID>
ps aux | grep erl ps aux | grep epmd ps aux | grep rabbit ps aux | grep erlang
Further, update the values on all places ie [“/root”, “/opt/jfrog/xray”, “/opt/jfrog/xray/app/third-party/rabbitmq/.erlang.cookie” ] and update the system.yaml to use the “JFXR_RABBITMQ_COOKIE” as rabbitmq.erlangCookie.value.
After updating the files, navigate to the /opt/jfrog/xray/var/data/rabbitmq/mnesia directory and take a backup and delete the contents within the directory.
Starting from Xray 3.8x, the stop and restart action on Xray will not be applied to RabbitMQ process. On start action of Xray, if RabbitMQ is not running, it will be started.
If you want the script to perform stop and restart action on RabbitMQ, set shared.rabbitMq.autoStop as true in the system.yaml. Note that this flag is not consumed in docker-compose installation.
rabbitMq: ## Enable this to stop rabbitmq along with other services of xray ## By default rabbitmq will always be running autoStop: true
Finally, restart Xray.