标签:client policy att moc rmi repos lan tcp6 linu
#centos7部署rabbitmq集群
[root@linux-node1 yum.repos.d]# yum install rabbitmq-server -y
[root@linux-node1 yum.repos.d]# systemctl enable rabbitmq-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
[root@linux-node1 yum.repos.d]# systemctl start rabbitmq-server.service
[root@linux-node1 yum.repos.d]# rabbitmqctl add_user admin admin
Creating user "admin" ...
[root@linux-node1 yum.repos.d]# rabbitmqctl set_permissions admin ".*" ".*" ".*"
Setting permissions for user "admin" in vhost "/" ...
密码设置成admin
[root@linux-node1 ~]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
mochiweb
webmachine
rabbitmq_web_dispatch
amqp_client
rabbitmq_management_agent
rabbitmq_management
Applying plugin configuration to rabbit@linux-node1... started 6 plugins.
[root@linux-node1 ~]# systemctl restart rabbitmq-server
[root@linux-node1 ~]# netstat -lntup|grep 5672
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 15851/beam
tcp 0 0 0.0.0.0:15672 0.0.0.0:* LISTEN 15851/beam
tcp6 0 0 :::5672 :::* LISTEN 15851/beam
====登录页面修改密码,重置角色,略
将node1上的.erlang.cookie传输到node2、node3,并保证权限一直
[root@linux-node1 ~]# scp /var/lib/rabbitmq/.erlang.cookie 192.168.56.12:/var/lib/rabbitmq/
#[root@linux-node1 ~]# scp /var/lib/rabbitmq/.erlang.cookie 192.168.56.13:/var/lib/rabbitmq/
先停止运行节点,然后以后台方式启动 RabbitMQ Server(node1和node2分别执行):
[root@linux-node1 ~]# systemctl stop rabbitmq-server
[root@linux-node1 ~]# rabbitmq-server -detached
Warning: PID file not written; -detached was passed.
[root@linux-node2 ~]# systemctl stop rabbitmq-server
[root@linux-node2 ~]# rabbitmq-server -detached
Warning: PID file not written; -detached was passed.
然后我们以node1作为集群中心,在node2上执行加入集群中心命令(节点类型为磁盘节点):
[root@linux-node2 ~]# rabbitmqctl stop_app
[root@linux-node2 ~]# rabbitmqctl reset
[root@linux-node2 ~]# rabbitmqctl join_cluster rabbit@linux-node1
//默认是磁盘节点,如果是内存节点的话,需要加--ram参数
[root@linux-node2 ~]# rabbitmqctl start_app
查看集群的状态(包含node1和node2节点):
[root@linux-node2 ~]# rabbitmqctl cluster_status
Cluster status of node ‘rabbit@linux-node2‘ ...
[{nodes,[{disc,[‘rabbit@linux-node1‘,‘rabbit@linux-node2‘]}]},
{running_nodes,[‘rabbit@linux-node1‘,‘rabbit@linux-node2‘]},
{cluster_name,<<"rabbit@linux-node2">>},
{partitions,[]}]
#镜像模式
[root@linux-node1 ~]# rabbitmqctl set_policy ha-all "^" ‘{"ha-mode":"all","ha-sync-mode":"automatic"}‘
Setting policy "ha-all" for pattern "^" to "{\"ha-mode\":\"all\",\"ha-sync-mode\":\"automatic\"}" with priority "0" ...
...done.
标签:client policy att moc rmi repos lan tcp6 linu
原文地址:https://www.cnblogs.com/wangkaiok/p/11942844.html