docker-rabbitmq-cluster
docker-rabbitmq-cluster copied to clipboard
Error: unable to perform an operation on node 'rabbit@rabbitmq2'.
Hi, I've cloned and docker-compose up and got this error logs
rabbitmq2_1 | RABBITMQ_ERLANG_COOKIE env variable support is deprecated and will be REMOVED in a future version. Use the $HOME/.erlang.cookie file or the --erlang-cookie switch instead. rabbitmq2_1 | Stopping rabbit application on node rabbit@rabbitmq2 ... rabbitmq2_1 | Error: unable to perform an operation on node 'rabbit@rabbitmq2'. Please see diagnostics information and suggestions below. rabbitmq2_1 | rabbitmq2_1 | Most common reasons for this are: rabbitmq2_1 | rabbitmq2_1 | * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues) rabbitmq2_1 | * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server) rabbitmq2_1 | * Target node is not running rabbitmq2_1 | rabbitmq2_1 | In addition to the diagnostics info below: rabbitmq2_1 | rabbitmq2_1 | * See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more rabbitmq2_1 | * Consult server logs on node rabbit@rabbitmq2 rabbitmq2_1 | * If target node is configured to use long node names, don't forget to use --longnames with CLI tools rabbitmq2_1 | rabbitmq2_1 | DIAGNOSTICS rabbitmq2_1 | =========== rabbitmq2_1 | rabbitmq2_1 | attempted to contact: [rabbit@rabbitmq2] rabbitmq2_1 | rabbitmq2_1 | rabbit@rabbitmq2: rabbitmq2_1 | * connected to epmd (port 4369) on rabbitmq2 rabbitmq2_1 | * epmd reports: node 'rabbit' not running at all rabbitmq2_1 | no other nodes on rabbitmq2 rabbitmq2_1 | * suggestion: start the node rabbitmq2_1 | rabbitmq2_1 | Current node details: rabbitmq2_1 | * node name: 'rabbitmqcli-45-rabbit@rabbitmq2' rabbitmq2_1 | * effective user's home directory: /var/lib/rabbitmq rabbitmq2_1 | * Erlang cookie hash: gnzLDuqKcGxMNKFokfhOew== rabbitmq2_1 | rabbitmq3_1 | RABBITMQ_ERLANG_COOKIE env variable support is deprecated and will be REMOVED in a future version. Use the $HOME/.erlang.cookie file or the --erlang-cookie switch instead. rabbitmq3_1 | Stopping rabbit application on node rabbit@rabbitmq3 ...
and idea why is that?
why is that?
I got the same issue and it looks to be a problem with the erlang cookie. As the log suggest, setting erlang cookie from environment variable is deprecated, so I tried to set it using file in all the node.
volumes:
- ./local_dir/erlang_cookie.txt:/var/lib/rabbitmq/mnesia/.erlang.cookie
Edit: The above approach only makes the first node works, the other two nodes still have epmd problem.
It helps for me to add sleep after /usr/local/bin/docker-entrypoint.sh rabbitmq-server -detached command:
...
/usr/local/bin/docker-entrypoint.sh rabbitmq-server -detached
sleep 10s
# Do the cluster dance
rabbitmqctl stop_app
rabbitmqctl join_cluster rabbit@rabbitmq1
...
Now it works.