1、实验环境
192.168.56.101r1.com 192.168.56.102r2.com
2、修改主机名
# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.56.101r1 r1.com 192.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.cookie WNZBLBYBFEMCSGOTZCFM
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查看如下
转载于:https://blog.51cto.com/peaceweb/1590107