RabbitMQ系列之RabbitMQ集群


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

#hosts准備:

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 設置

#path var/lib/rabbitmq/

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

 #打開EPMD 端口 4369 

[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.

偽集群實例

一台機子啟動兩個Rabbitmq實例,分別指定不同端口和名稱: 

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

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2021 ITdaan.com