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. 安装依赖项
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. 激活插件
rabbitmq-plugins enable rabbitmq_management rabbitmq-plugins list
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. 修改.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. 添加rabbitmq⽤户
rabbitmqctl add_user admin 123456 rabbitmqctl set_user_tags admin administrator rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。