其他分享
首页 > 其他分享> > rabbitmq配置镜像队列

rabbitmq配置镜像队列

作者:互联网

ip hostname
192.168.56.100 master01
192.168.56.101 node01
 curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash
 yum install -y erlang
 rpm --import https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
 rpm --import https://packagecloud.io/gpg.key
 curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
 yum install rabbitmq-server -y

 #可以修改默认的数据目录(可不修改,本实验未修改)
 mkdir -pv /epailive/data/rabbitmq && chown -R rabbitmq:rabbitmq /epailive/data/rabbitmq
cat >/etc/rabbitmq/rabbitmq-env.conf <<EOF
RABBITMQ_LOG_BASE=/epailive/data/rabbitmq/log
RABBITMQ_MNESIA_BASE=/epailive/data/rabbitmq/mnesia
EOF

 #启动 加载插件
 systemctl start rabbitmq-server && systemctl enable rabbitmq-server && rabbitmq-plugins enable rabbitmq_management
 #设置用户名密码:
 rabbitmqctl add_user  manager  TSVVXzXiXF4
 rabbitmqctl set_user_tags manager administrator
 rabbitmqctl set_permissions -p / manager ".*" ".*" ".*"
 #确认192.168.56.100:15672、192.168.56.101:15672能登录打开就可以

选择master01为master,也就是说我们需要把node01的Cookie文件同步到master01节点上去

#master01上操作:
scp /var/lib/rabbitmq/.erlang.cookie root@node01:/var/lib/rabbitmq/
#node01上操作
rabbitmqctl stop_app  
rabbitmqctl join_cluster  rabbit@master01
rabbitmqctl start_app
rabbitmqctl cluster_status



systemctl stop rabbitmq-server
rabbitmqctl  -n rabbit@master01  forget_cluster_node rabbit@node01

再加入集群的时候报这个错,原因是: 主机集群认为该节点仍在集群中, 而该节点实际上退出集群了。 导致数据文件日志不一致,而无法加入集群。
  解决方法:
  删除 /epailive/data/rabbitmq/mnesia 

更多精彩关注公众号“51运维com” 个人博客

标签:node01,队列,master01,rabbitmq,rabbitmqctl,集群,镜像,节点
来源: https://www.cnblogs.com/xull0651/p/15428970.html