初探RabbitMQ——实验环境搭建

Posted by BlkArt on June 9, 2015

虚拟机准备

主机名 IP OS 节点角色
rabbitmq-1 192.168.2.81/24 CentOS7 RabbitMQ Server
rabbitmq-2 192.168.2.82/24 CentOS7 N/A

设置SELinux模式

注意: SELinux处于Enforcing模式会导致rabbitmq-server服务启动失败

# setenforce 0

清空防火墙规则

注意: rabbitmq-server默认监听TCP 5672端口,RabbitMQ Server节点需确保防火墙未拒绝TCP 5672端口

# iptables -F
# service iptables save

配置EPEL7源『Server』

安装软件包『Server』

# yum -y install rabbitmq-server

启动rabbitmq服务『Server』

# systemctl start rabbitmq-server
# systemctl enable rabbitmq-server

确认rabbitmq-server服务状态

# systemctl status rabbitmq-server
rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled)
   Active: active (running) since 二 2015-06-09 16:15:10 CST; 5s ago
  Process: 3250 ExecStop=/usr/lib/rabbitmq/bin/rabbitmqctl stop (code=exited, status=0/SUCCESS)
 Main PID: 3291 (beam.smp)
   CGroup: /system.slice/rabbitmq-server.service
           ├─3291 /usr/lib64/erlang/erts-5.10.4/bin/beam.smp -W w -K true -A30 -P 1048576 -- -root /usr/lib64/erlang -progname erl --...
           ├─3306 /usr/lib64/erlang/erts-5.10.4/bin/epmd -daemon
           ├─3387 inet_gethost 4
           └─3395 inet_gethost 4

6月 09 16:14:20 rabbitmq-1 systemd[1]: rabbitmq-server.service: Got notification message from PID 3306, but reception only pe...ID 3291
6月 09 16:14:45 rabbitmq-1 rabbitmq-server[3291]: RabbitMQ 3.3.5. Copyright (C) 2007-2014 GoPivotal, Inc.
6月 09 16:14:45 rabbitmq-1 rabbitmq-server[3291]: ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
6月 09 16:14:45 rabbitmq-1 rabbitmq-server[3291]: ##  ##
6月 09 16:14:45 rabbitmq-1 rabbitmq-server[3291]: ##########  Logs: /var/log/rabbitmq/[email protected]
6月 09 16:14:45 rabbitmq-1 rabbitmq-server[3291]: ######  ##        /var/log/rabbitmq/[email protected]
6月 09 16:14:45 rabbitmq-1 rabbitmq-server[3291]: ##########
6月 09 16:15:10 rabbitmq-1 rabbitmq-server[3291]: Starting broker... completed with 6 plugins.
6月 09 16:15:10 rabbitmq-1 systemd[1]: Started RabbitMQ broker.
Hint: Some lines were ellipsized, use -l to show in full.