while connect to a rabbitmq-cluster , I got the following message,it seams it has conneted but not the next step. I execute rabbitmqctl join_cluster rabbit@rabbit2
attempted to contact: [rabbit@rabbit2]
rabbit@rabbit2:
* connected to epmd (port 4369) on rabbit2
* node rabbit@rabbit2 up, 'rabbit' application running
when I execute rabbitmqctl status -n rabbit@rabbit2
it connect successful and get the right messages
my hosts file
172.17.0.3 rabbit3.onlymin.com rabbit3
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.18.137.102 rabbit2.onlymin.com rabbit2
172.18.137.103 rabbit3.onlymin.com rabbit3
172.18.137.104 rabbit4.onlymin.com rabbit4
Did you do pass the erlang cookie env variable https://github.com/docker-library/docs/tree/master/rabbitmq#erlang-cookie
An issue with the image isn't apparent so you could also ask the Docker Community Forums, the Docker Community Slack, or Stack Overflow. As these repositories are for issues with the image and not necessarily for questions of usability
my docker start parameters锛孖n fact these parameters is set up on three other server cluster was successful銆侱on't know if the server itself锛宼his image Is my from copied above three successful servers锛孖n the three servers cluster is no problem on it, Just changed my IP address銆侽ther servers in this cluster are different in hostname and name
docker run -d --hostname rabbit2.onlymin.com \
--add-host="rabbit2.onlymin.com rabbit2":172.18.137.102 \
--add-host="rabbit3.onlymin.com rabbit3":172.18.137.103 \
--add-host="rabbit4.onlymin.com rabbit4":172.18.137.104 \
--name rabbit2 \
-p 4369:4369 \
-p 5671:5671 \
-p 5672:5672 \
-p 15671:15671 \
-p 15672:15672 \
-p 25672:25672 \
-v /data/share/server_data/fz_01/rabbitmq:/var/lib/rabbitmq \
-v /data/share/server_log/fz_01/rabbitmq:/var/log \
-e RABBITMQ_DEFAULT_USER=user01 \
-e RABBITMQ_DEFAULT_PASS=password01 \
-e RABBITMQ_ERLANG_COOKIE='secret cookie here' \
rabbitmq:3.6
It can see in this cluster, my servers have same RABBITMQ_ERLANG_COOKIE, and I use the hosts to find each other, rabbitmqctl status -n rabbit@rabbit2 success return, it shows these servers can find each other and can build successful connection. but it cannot join cluster,even it has the similar RABBITMQ_ERLANG_COOKIE
Following the instructions from https://www.rabbitmq.com/clustering.html#creating, this seems to be working:
$ docker network create rabbit
$ docker pull rabbitmq:3.7
3.7: Pulling from library/rabbitmq
Digest: sha256:14a4f6c871e3218c383ac38be6e3af6af547fff46bf38c8fe113aca6f1b49697
Status: Image is up to date for rabbitmq:3.7
$ docker run -dit --name rabbit1 --hostname rabbit1 --network rabbit -e RABBITMQ_ERLANG_COOKIE='foo bar baz' rabbitmq:3.7
d75184283c5417b009ea431d58c1d9c94999fe35e1a5decb7c91cc1bae4df99e
$ docker run -dit --name rabbit2 --hostname rabbit2 --network rabbit -e RABBITMQ_ERLANG_COOKIE='foo bar baz' rabbitmq:3.7
149115d6a8b8cc2b43d211550549ca1a69491870faf190655e83d1a1c36be1df
$ docker logs --tail=2 rabbit1
2018-08-10 21:07:33.219 [info] <0.5.0> Server startup complete; 0 plugins started.
completed with 0 plugins.
$ docker logs --tail=2 rabbit2
2018-08-10 21:07:53.482 [info] <0.5.0> Server startup complete; 0 plugins started.
completed with 0 plugins.
$ docker exec -it rabbit2 bash
root@rabbit2:/# rabbitmqctl stop_app
Stopping rabbit application on node rabbit@rabbit2 ...
root@rabbit2:/# rabbitmqctl join_cluster rabbit@rabbit1
Clustering node rabbit@rabbit2 with rabbit@rabbit1
root@rabbit2:/# rabbitmqctl start_app
Starting node rabbit@rabbit2 ...
completed with 0 plugins.
root@rabbit2:/# rabbitmqctl cluster_status
Cluster status of node rabbit@rabbit2 ...
[{nodes,[{disc,[rabbit@rabbit1,rabbit@rabbit2]}]},
{running_nodes,[rabbit@rabbit1,rabbit@rabbit2]},
{cluster_name,<<"rabbit@rabbit2">>},
{partitions,[]},
{alarms,[{rabbit@rabbit1,[]},{rabbit@rabbit2,[]}]}]
root@rabbit2:/# exit
$ docker exec -it rabbit1 bash
root@rabbit1:/# rabbitmqctl cluster_status
Cluster status of node rabbit@rabbit1 ...
[{nodes,[{disc,[rabbit@rabbit1,rabbit@rabbit2]}]},
{running_nodes,[rabbit@rabbit2,rabbit@rabbit1]},
{cluster_name,<<"rabbit@rabbit2">>},
{partitions,[]},
{alarms,[{rabbit@rabbit2,[]},{rabbit@rabbit1,[]}]}]
root@rabbit1:/# exit
Thanks! Was stuck on this for a while and this solution helped me.
Thanks this saved my time.
Most helpful comment
Following the instructions from https://www.rabbitmq.com/clustering.html#creating, this seems to be working: