Loading...
CentOS 6.7安装RabbitMQ消息中间件

RabbitMQ笔记 2015/12/18 RabbitMQ , CentOS , Linux

#RabbitMQ是基于Erlang开发的,所以首先安装Erlang环境

下载:erlang-17.4-1.el6.x86_64.rpm 下载地址:http://www.rabbitmq.com/releases/erlang/


#rpm安装erlang

rpm -ivh erlang-17.4-1.el6.x86_64.rpm


#安装RabbitMQ Server

下载:rabbitmq-server-3.5.6-1.noarch.rpm 下载地址:http://www.rabbitmq.com/install-rpm.html


#rpm安装rabbitmq-server

rpm -ivh rabbitmq-server-3.5.6-1.noarch.rpm


#启动rabbitmq-server

/sbin/service rabbitmq-server start


#设置开机启动

chkconfig rabbitmq-server on


#开放防火墙端口

SELinux and similar mechanisms may prevent RabbitMQ from binding to a port. When that happens, RabbitMQ will fail to start. Make sure the following ports can be opened:

  • 4369 (epmd), 25672 (Erlang distribution)
  • 5672, 5671 (AMQP 0-9-1 without and with TLS)
  • 15672 (if management plugin is enabled)
  • 61613, 61614 (if STOMP is enabled)
  • 1883, 8883 (if MQTT is enabled)


#默认安装说明

默认安装日志路径:/var/log/rabbitmq

默认安装路径:/usr/lib/rabbitmq

默认安装配置文件存放路径:/etc/rabbitmq


#默认访问用户和虚拟主机

默认安装的rabbitmq服务,默认拥有一个账号和密码都是“guest”的用户,并且绑定到虚拟主机“/”,只能在本机(localhost)访问rabbitmq,正式发布时,建议删除“guest”账号和虚拟主机“/


#管理RabbitMQ节点

进入到bin目录:cd /usr/lib/rabbitmq/bin

停止服务:./rabbitmqctl stop

查看状态: ./rabbitmqctl status

更多rabbitmqctl命令:http://www.rabbitmq.com/man/rabbitmqctl.1.man.html


#查看日志

进入到日志目录:cd /var/log/rabbitmq

浏览日志文件:ls

rabbit@centos1.log  rabbit@centos1-sasl.log  startup_err  startup_log

查看日志文件:cat rabbit@centos1.log


#开启UI管理界面插件“Management Plugin

cd /usr/lib/rabbitmq/bin

rabbitmq-plugins enable rabbitmq_management


URL访问地址:http://server-name:15672


#创建管理员用户,负责整个MQ的运维

rabbitmqctl add_user  admin admin  

rabbitmqctl set_user_tags admin administrator  

更多用户管理命令:http://www.rabbitmq.com/man/rabbitmqctl.1.man.html


创建好后,便可以用账号为admin,密码为admin登录http://server-name:15672 进行MQ的维护



#参考文档

http://www.rabbitmq.com/




Comments