RabbitMQ系列之RabbitMQ集羣

本文的集羣是RabbitMq 自身的Cluster搭建 。node

#hosts準備:vim

vim /etc/hosts 
#172.16.3.79 s1     
#172.16.3.105 s2     

172.16.2.10 centos-43     
172.16.2.11 centos-44

#erlang cookie 設置centos

#path var/lib/rabbitmq/bash

chmod 755 .erlang.cookie     
vi .erlang.cookie     
cookie     
chomd 600 .erlang.cookie

 #打開EPMD 端口 4369 cookie

[root@centos-43 rabbitmq]# rabbitmqctl stop_app     
Stopping node 'rabbit@centos-43' ...     
...done.     
[root@centos-43 rabbitmq]# rabbitmqctl join_cluster rabbit@centos-44     
Clustering node 'rabbit@centos-43' with 'rabbit@centos-44' ...     
...done.     
[root@centos-43 rabbitmq]# rabbitmqctl start_app     
Starting node 'rabbit@centos-43' ...     
...done.     
[root@centos-43 rabbitmq]# rabbitmqctl cluster_status     
Cluster status of node 'rabbit@centos-43' ...     
[{nodes,[{disc,['rabbit@centos-43','rabbit@centos-44']}]},     
 {running_nodes,['rabbit@centos-44','rabbit@centos-43']},     
 {partitions,[]}]     
...done.

僞集羣實例app

一臺機子啓動兩個Rabbitmq實例,分別指定不一樣端口和名稱: spa

RABBITMQ_NODE_PORT=9991 RABBITMQ_NODENAME=rab /usr/local/rabbitmq/sbin/rabbitmq-server -detached     
RABBITMQ_NODE_PORT=9992 RABBITMQ_NODENAME=rab2 /usr/local/rabbitmq/sbin/rabbitmq-server -detached
相關文章
相關標籤/搜索