1、实验环境
192.168.56.101r1.com
192.168.56.102r2.com
2、修改主机名
# cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.56.101r1 r1.com192.168.56.102 r2r2.com
3、安装前准备
#yum -y install gcc* make ncurses-devel libxslt xsltproc unzip nc
4、安装erlang
#tar -zxvf otp_src_17.4.tar.gz#cd otp_src_17.4#./configure#make && make install
5、安装rabbitmq
#tar -zxvf rabbitmq-server-3.4.2.tar.gz#cd rabbitmq-server-3.4.2#make && make install
6、修改PATH路径
# vim ~/.bash_profile PATH=$PATH:$HOME/bin:/root/rabbitmq-server-3.4.2/scripts# source ~/.bash_profile
7、启动rabbitmq
#rabbitmq-server -detached
8、启用web管理插件,重启rabbitmq生效
#rabbitmq-server enable rabbitmq_management
如果/etc/rabbitmq不存在会报如下错误:
Error: {cannot_write_enabled_plugins_file,”/etc/rabbitmq/enabled_plugins”, enoent}mkdir /etc/rabbitmq
9、关闭rabbitmq
#rabbitmqctl stop
10、修改两个节点的COOKIE值一样
#cat /root/.erlang.COOKIEWNZBLBYBFEMCSGOTZCFM
11、配置集群
以独立的启动rabbitmq#rabbitmq-server -detached停止应用程序#rabbitmqctl stop_app以内存的方式加入rabbit@r2集群#rabbitmqctl jpin_cluster --ram rabbit@r2启动应用程序#rabbitmqctl start_app查看集群状态#rabbitmqctl cluster_status
web查看如下
也可以改成disc模式
#rabbitmqctl stop_app#rabbitmqctl reset#rabbitmqctl join_cluster rabbit@r2#rabbitmqctl start_app
web查看如下
本文出自 “毛竹之势” 博客,请务必保留此出处http://peaceweb.blog.51cto.com/3226037/1590107