rabbitmq集群安装
vim /etc/hosts
10.2.1.115 node1
10.2.1.116 node2
10.2.1.117 node3
yum -y install gcc glibc-devel make ncurses-devel openssl-devel autoconf
rpm -Uvh
rpm -Uvh
wget
yum -y install rabbitmq-server-3.6.14-1.el6.noarch.rpm
#每台执行安装
cd /var/lib/rabbitmq
service rabbitmq-server restart
chkconfig rabbitmq-server on
#得到cookie(第一台)
cat .erlang.cookie
rabbitmq-plugins enable rabbitmq_management
#其他服务器
cd /var/lib/rabbitmq
chmod 700 .erlang.cookie
#把第一台得到的值写入进去,改回权限
echo "xxxxx" > .erlang.cookie
chmod 400 .erlang.cookie
假设有三台机器,分别为node1、node2、node3,那么下面将node2和node3与node1组成集群(即在node2和node3两台机器中做如下操作):
rabbitmqctl stop_app
rabbitmqctl join_cluster rabbit@node1
rabbitmqctl start_app
#配置完成后,可以在任意节点机器上执行 rabbitmqctl cluster_status 来查看是否集群配置成功
#设置镜像队列策略
rabbitmqctl set_policy ha-all "^" '{"ha-mode":"all"}'
#新建集群用户 设定权限
rabbitmqctl add_user iboss dgg962540
rabbitmqctl set_user_tags iboss administrator
rabbitmqctl list_users
rabbitmqctl set_permissions -p / iboss '.*' '.*' '.*'
chkconfig rabbitmq-server on
原文地址:https://www.cnblogs.com/lzzhang/p/4786468.html
阅读(1156) | 评论(0) | 转发(0) |