RabbitMq集群安装
1.1 依赖环境
1. 3台Centos 7的机器,hostname分别为A、B、C
创新互联建站专注于牙克石网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供牙克石营销型网站建设,牙克石网站制作、牙克石网页设计、牙克石网站官网定制、小程序开发服务,打造牙克石网络公司原创品牌,更为您提供牙克石网站排名全网营销落地服务。
2. IP地址分别为:A - 172.20.0.2 B - 172.20.0.3 C - 172.20.0.4
3. 修改hosts⽂件如下:
vim /etc/ho RabbitMq集群安装 sts
172.20.0.2 A 172.20.0.3 B 172.20.0.4 C
4. 保证所有节点互通
1.2 安装部署(all nodes)
1. 安装依赖项
yum install -y epel-release
2. 下载esl-erlang rpm包
wget https://packages.erlangsolutions.com/erlang/rpm/centos/7/x86_64/esl-erlang_22.1.71~centos~7_amd64.rpm
3. 安装esl-erlang
yum install esl-erlang_22.1.7-1_centos_7_amd64.rpm
4. 验证esl-erlang
erl -version 出现“Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 10.5.5” 证明安装成功
5. 下载rabbitmq rpm包
wget https://github.com/rabbitmq/rabbitmqserver/releases/download/v3.8.1/rabbitmq-server-3.8.11.el7.noarch.rpm
6. 安装socat依赖
yum install socat
7. 安装rabbitmq
rpm -ivh rabbitmq-server-3.8.1-1.el7.noarch.rpm
1.3 开启插件(all nodes)
1. 激活插件
rabbitmq-plugins enable rabbitmq_management rabbitmq-plugins list
1.4 启动(all nodes)
1. 开机启动:
chkconfig rabbitmq-server on
2. 查看启动状态:
rabbitmqctl status
3. 启动,关闭,重启:
systemctl enable rabbitmq-server.service systemctl start rabbitmq-server.service systemctl stop rabbitmq-server.service systemctl restart rabbitmq-server.service
4. rabbitmq启动
rabbitmqctl start_app
1.5 加⼊集群
1. 修改.erlang.cookie
chmod 600 /var/lib/rabbitmq/.erlang.cookie vim /var/lib/rabbitmq/.erlang.cookie `保持所有节点cookie⼀致`
2. B节点执⾏
rabbitmqctl stop_app rabbitmqctl join_cluster --ram rabbit@A rabbitmqctl start_app
3. C节点执⾏
rabbitmqctl stop_app rabbitmqctl join_cluster --ram rabbit@A rabbitmqctl start_app
4. 查看集群状态(A节点)
# 查看集群状态
rabbitmqctl cluster_status
5. 增加镜像策略(A节点)
rabbitmqctl set_policy ha-all "^" '{"ha-mode":"all"}'
1.6 新增⽤户(A节点)
1. 添加rabbitmq⽤户
rabbitmqctl add_user admin 123456 rabbitmqctl set_user_tags admin administrator rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
本文名称:RabbitMq集群安装
链接地址:http://azwzsj.com/article/pcosgo.html