-
两台电脑都安装rabbitmq
-
配置host文件
-
拷贝erlang.cookie(将两台的cookie保持一致)
-
每个节点执行以下命令
#on rabbit1
rabbitmq-server -detached
#on rabbit2
rabbitmq-server -detached -
主节点开启rabbitmq
rabbitmq-server start
6.从节点执行以下命令
#on rabbit2
rabbitmqctl stop_app
#=> Stopping node rabbit@rabbit2 ...done.
rabbitmqctl reset
#=> Resetting node rabbit@rabbit2 ...
rabbitmqctl join_cluster rabbit@rabbit1
#=> Clustering node rabbit@rabbit2 with [rabbit@rabbit1] ...done.
rabbitmqctl start_app
#=> Starting node rabbit@rabbit2 ...done.
-
查看集群状态
rabbitmqctl cluster_status
RabbitMQ创建角色并授权命令
rabbitmqctl add_user admin admin
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"