#操作系统环境
Centos6.7
#使用的版本:
Rabbit MQ:3.2.2
erlang:R16B03
#1、准备工作
下载rabbit mq:http://www.rabbitmq.com/releases/
下载erlang:http://www.erlang.org/download/
#安装ncurses
yum list|grep ncurses
yum -y install ncurses-devel
#升级make版本和xslt版本
yum -y install libxslt-devel
#2、安装erlang
执行命令:
tar -zxvf otp_src_R16B03.tar.gz
cd otp_src_R16B03
./configure
make
make install
测试:
命令行输入:erl --version
出现版本信息,则成功。
#3、安装rabbitmq
tar zxvf rabbitmq-server-3.2.2.tar.gz
cd rabbitmq-server-3.2.2
make
make install
#4、故障排查
在make install的时候得到一个报错:
echo “Put your EZs here and use rabbitmq-plugins to enable them.” > plugins/README
rm -f plugins/rabbit_common*.ez
Please set TARGET_DIR.
Please set SBIN_DIR.
Please set MAN_DIR.
Please set DOC_INSTALL_DIR.
make: *** [install_dirs] 错误 1
解决办法
说让添加环境变量,解决方法:(rabbitmq-server-3.2.2目录下执行)
export TARGET_DIR=/home/SITAPP/rabbitmq
export SBIN_DIR=/home/SITAPP/rabbitmq/sbin
export MAN_DIR=/home/SITAPP/rabbitmq/man
export DOC_INSTALL_DIR=/home/SITAPP/rabbitmq/doc
重新make install又得到一个错误:
/bin/sh: xmlto: command not found
/bin/sh: line 2: xmlto: command not found
make: *** [docs/rabbitmqctl.1.gz] 错误 127
安装xmlto命令,yum install -y xmlto
重新make install完成。
#5、配置rabbitMQ:
设置日志与消息持久化目录:
ln -s /home/SITAPP/rabbitmq/sbin/rabbitmq-server /usr/bin/rabbitmq-server
ln -s /home/SITAPP/rabbitmq/sbin/rabbitmq-env /usr/bin/rabbitmq-env
#6、启动rabbitMQ(rabbitmq/sbin目录下):
./ rabbitmq-server
./rabbitmq-server -detached(后台启动)
出现下面信息,则表示成功:
##########
Starting broker… completed with 0 plugins.
#7、查看服务状态:
lsof -i:5672
#8、关闭rabbitmq服务:
./rabbitmqctl stop
#9、启动/关闭web管理工具:
启动:./rabbitmq-plugins enable rabbitmq_management
关闭:./rabbitmq-plugins disable rabbitmq_management
出现错误
Error: {cannot_write_enabled_plugins_file,”/etc/rabbitmq/enabled_plugins”,
enoent}
创建目录:
mkdir /etc/rabbitmq
从新启动:
./rabbitmq-plugins enable rabbitmq_management
出现下面信息:
The following plugins have been enabled:
mochiweb
webmachine
rabbitmq_web_dispatch
amqp_client
rabbitmq_management_agent
rabbitmq_management
Plugin configuration has changed. Restart RabbitMQ for changes to take effect.
重启rabbitmq服务。
通过访问http://IP:15672/ 用户名密码guest访问即可。