标签:rabl 节点 代理 cdb run policy 队列 rod 内存
RabbitMQ简介:#更改主机名
[root@localhost ~]# vim /etc/hostname
mq01.localdomain (操作相同,只是主机名01、02、03)
[root@localhost ~]# vim /etc/hosts
192.168.120.138 mq01
192.168.120.139 mq02
192.168.120.140 mq03
#重启系统
[root@localhost ~]#init 6
#三台防火墙都关闭
[root@mq01 ~]# systemctl stop firewalld.service
[root@mq01 ~]# setenforce 0
[root@mq01 ~]# yum install epel-release -y
[root@mq01 ~]# yum install rabbitmq-server -y
--------------------磁盘节点01-------------------------
#优化路径
[root@mq01 ~]# ln -s /usr/lib/rabbitmq/bin/ /usr/bin/
[root@mq01 ~]# rabbitmq-plugins list
#开启rabbitmq
[root@mq01 ~]# rabbitmq-plugins enable rabbitmq_management
[root@mq01 ~]# systemctl start rabbitmq-server.service
[root@mq01 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@mq01 ...br/>[{nodes,[{disc,[rabbit@mq01]}]},
{running_nodes,[rabbit@mq01]},br/>{cluster_name,<<"rabbit@mq01">>},
{partitions,[]}]
...done. ###连接成功###
[root@mq01 ~]# netstat -ntap | grep 5672
tcp 0 0 0.0.0.0:15672 0.0.0.0: LISTEN 3018/beam
tcp 0 0 0.0.0.0:25672 0.0.0.0: LISTEN 3018/beam
tcp6 0 0 :::5672 ::: LISTEN 3018/beam
---------------------内存节点02----------------------------
[root@mq02 ~]# ln -s /usr/lib/rabbitmq/bin/* /usr/bin/
[root@mq02 ~]# rabbitmq-plugins enable rabbitmq_management
[root@mq02 ~]# systemctl start rabbitmq-server.service
[root@mq02 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@mq02 ...br/>[{nodes,[{disc,[rabbit@mq02]}]},
{running_nodes,[rabbit@mq02]},br/>{cluster_name,<<"rabbit@mq02">>},
{partitions,[]}]
...done.
--------------------内存节点03-----------------------------------
[root@mq03 ~]# ln -s /usr/lib/rabbitmq/bin/* /usr/bin/
[root@mq03 ~]# rabbitmq-plugins enable rabbitmq_management
[root@mq03 ~]# systemctl start rabbitmq-server.service
[root@mq03 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@mq03 ...br/>[{nodes,[{disc,[rabbit@mq03]}]},
{running_nodes,[rabbit@mq03]},br/>{cluster_name,<<"rabbit@mq03">>},
{partitions,[]}]
...done.
####操作都相同#####
##关闭三台rabbitmq服务##
[root@mq01 ~]# systemctl stop rabbitmq-server.service
##进入第一台##
[root@mq01 ~]# vim /var/lib/rabbitmq/.erlang.cookie
SNBTPYOBNPXOMBFNWAZA ##(复制序列号)
##进入第二台##
[root@mq02 ~]# vim /var/lib/rabbitmq/.erlang.cookie
SNBTPYOBNPXOMBFNWAZA ##将第一台的序列号复制粘贴下来,要一致
##进入第三台##
[root@mq03 ~]# vim /var/lib/rabbitmq/.erlang.cookie
SNBTPYOBNPXOMBFNWAZA ##都和第一台一致
##三台服务启动##
[root@mq01 ~]# systemctl start rabbitmq-server.service
================在02、03上操作-----内存节点=======
[root@mq02 ~]# rabbitmqctl stop_app
Stopping node rabbit@mq02 ...
...done.
##以内存模式进行添加##
[root@mq02 ~]# rabbitmqctl join_cluster --ram rabbit@mq01
Clustering node rabbit@mq02 with rabbit@mq01 ...
...done.
##开启app##
[root@mq02 ~]# rabbitmqctl start_app
Starting node rabbit@mq02 ...
...done.
##第三台同样操作##
[root@mq03 ~]# rabbitmqctl stop_app
Stopping node rabbit@mq03 ...
...done.
[root@mq03 ~]# rabbitmqctl join_cluster --ram rabbit@mq01
Clustering node rabbit@mq03 with rabbit@mq01 ...
...done.
##开启app##
[root@mq03 ~]# rabbitmqctl start_app
Starting node rabbit@mq03 ...
...done.
###验证群集状态###
[root@mq01 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@mq01 ...br/>[{nodes,[{disc,[rabbit@mq01]},{ram,[rabbit@mq03,rabbit@mq02]}]},
{running_nodes,[rabbit@mq03,rabbit@mq02,rabbit@mq01]},br/>{cluster_name,<<"rabbit@mq01">>},
{partitions,[]}]
...done.
##登录磁盘节点##
http://192.168.120.138:15672/
默认账户和密码都是guest
增加消息队列
queues->
name:aa //消息队列的名称
durability:durable //是否支持持久化br/>node:rabbit@mq01
arguments:x-ha-policy = all
add queue 完成
标签:rabl 节点 代理 cdb run policy 队列 rod 内存
原文地址:http://blog.51cto.com/13756916/2300723