docker run -d --hostname node1 --name myrabbit1 -p 15672:15672 -p 5672:5672 -e RABBITMQ_ERLANG_COOKIE='rabbitcookie' rabbitmq:management
docker run -d --hostname node2 --name myrabbit2 -p 5673:5672 --link myrabbit1:node1 -e RABBITMQ_ERLANG_COOKIE='rabbitcookie' rabbitmq:management
docker run -d --hostname node3 --name myrabbit3 -p 5674:5672 --link myrabbit1:node1 --link myrabbit2:node2 -e RABBITMQ_ERLANG_COOKIE='rabbitcookie' rabbitmq:management
node1:
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl start_app
node2:
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster --ram rabbit@node1
rabbitmqctl start_app
node3:
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster --ram rabbit@node1
rabbitmqctl start_app
注意:
启动时用 rabbitmq:management,不然无法登陆web页面