Rootop 服务器运维与web架构

RabbitMQ在linux下的安装

| 暂无评论

目前最新版本下载:
http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.4/rabbitmq-server-3.2.4.tar.gz
http://www.erlang.org/download/otp_src_R16B03-1.tar.gz

[root@localhost ~]# tar otp_src_R16B03-1.tar.gz
[root@localhost ~]# cd otp_src_R16B03-1
[root@localhost otp_src_R16B03-1]# yum install -y ncurses ncurses-devel
[root@localhost otp_src_R16B03-1]# ./configure
[root@localhost otp_src_R16B03-1]# make
[root@localhost otp_src_R16B03-1]# make install
测试:

[root@localhost otp_src_R16B03-1]# erl
Erlang R16B03-1 (erts-5.10.4)  [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.4  (abort with ^G)
1> halt().
[root@localhost otp_src_R16B03-1]#
erlang完成。

[root@localhost ~]# tar zxvf rabbitmq-server-3.2.4.tar.gz
[root@localhost ~]# cd rabbitmq-server-3.2.4
[root@localhost rabbitmq-server-3.2.4]# make
[root@localhost rabbitmq-server-3.2.4]# make install

在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

说让添加环境变量,解决方法:
[root@localhost rabbitmq-server-3.2.4]# export TARGET_DIR=/usr/local/rabbitmq
[root@localhost rabbitmq-server-3.2.4]# export SBIN_DIR=/usr/local/rabbitmq/sbin
[root@localhost rabbitmq-server-3.2.4]# export MAN_DIR=/usr/local/rabbitmq/man
[root@localhost rabbitmq-server-3.2.4]# export DOC_INSTALL_DIR=/usr/local/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完成。

配置rabbitMQ:
设置日志与消息持久化目录:
[root@localhost ~]# mkdir /var/log/rabbitmq
[root@localhost ~]# mkdir /var/lib/rabbitmq

[root@localhost ~]# ln -s /usr/local/rabbitmq/sbin/rabbitmq-server /usr/bin/rabbitmq-server
[root@localhost ~]# ln -s /usr/local/rabbitmq/sbin/rabbitmq-env /usr/bin/rabbitmq-env
[root@localhost ~]# rabbitmq-server &

RabbitMQ 3.2.4. Copyright (C) 2007-2013 GoPivotal, Inc.
## ## Licensed under the MPL. See http://www.rabbitmq.com/
## ##
########## Logs: /var/log/rabbitmq/rabbit@localhost.log
###### ## /var/log/rabbitmq/rabbit@localhost-sasl.log
##########
Starting broker… completed with 0 plugins.

查看服务状态:
[root@localhost ~]# lsof -i:5672
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
beam 25276 root 13u IPv6 73960 0t0 TCP *:amqp (LISTEN)

关闭rabbitmq服务:
[root@localhost ~]# cd /usr/local/rabbitmq/sbin/
[root@localhost sbin]# ./rabbitmqctl stop
Stopping and halting node rabbit@localhost …
…done.
[root@localhost sbin]# lsof -i:5672
[1]+ Done ./rabbitmq-server
[root@localhost sbin]# lsof -i:5672
[root@localhost sbin]#

启动web管理工具:
[root@localhost sbin]# ./rabbitmq-plugins enable rabbitmq_management
Error: {cannot_write_enabled_plugins_file,”/etc/rabbitmq/enabled_plugins”,
enoent}
[root@localhost sbin]# mkdir /etc/rabbitmq
[root@localhost sbin]# ./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.

[root@localhost sbin]# lsof -i:15672
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
beam 25589 root 16u IPv4 74702 0t0 TCP *:15672 (LISTEN)
关闭管理工具用:
[root@localhost sbin]# ./rabbitmq-plugins disable rabbitmq_management

通过访问http://192.168.0.5:15672/ 用户名密码guest访问即可。

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/2327.html

作者:Venus

服务器运维与性能优化

发表回复