一、安装Erlang
1)安装erlang依赖的基本环境
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl openssl-devel xmlto zip unzip
2)下载安装Erlang
1.wget http://www.erlang.org/download/otp_src_17.3.tar.gz 2.tar -zxvf otp_src_17.3.tar.gz 3. cd otp_src_17.3 4. ./configure 如果报错: checking for perl... no_perl configure: error: Perl is required to generate v2 to v1 mib converter script configure: error: /bin/sh '/home/rabbitmq/otp_src_17.3/lib/snmp/./configure' failed for snmp/. configure: error: /bin/sh '/home/rabbitmq/otp_src_17.3/lib/configure' failed for lib 5. 解决:yum install perl 6. make 7. make install
二、安装python和simplejson
yum -y install python
wget http://download.openpkg.org/components/cache/python-json/simplejson-3.13.2.tar.gz
tar -zxvf simplejson-3.13.2.tar.gz
cd simplejson-3.13.2
python setup.py install
三、安装Rabbitmq
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.4.1/rabbitmq-server-3.4.1.tar.gz
tar -zxvf rabbitmq-server-3.4.1.tar.gz
cd rabbitmq-server-3.4.1
make TARGET_DIR=/usr/local/rabbitmq/ SBIN_DIR=/usr/local/rabbitmq/sbin MAN_DIR=/usr/local/rabbitmq/man DOC_INSTALL_DIR=/usr/local/rabbitmq/doc install
安装web插件
mkdir /etc/rabbitmq/
#启用:
/usr/local/rabbitmq/sbin/rabbitmq-plugins enable rabbitmq_management
启动关闭rabbitmq
cd /usr/local/rabbitmq/sbin
./rabbitmq-server start #开启
./rabbitmqctl stop #关闭
启动时候如果报错:
Error description:
{could_not_start,rabbit,
{bad_return,
{{rabbit,start,[normal,[]]},
{'EXIT',
{rabbit,failure_during_boot,
{boot_step,networking,
{case_clause,
{error,
{{shutdown,
{failed_to_start_child,tcp_listener,
{cannot_listen,{0,0,0,0,0,0,0,0},5672,eaddrinuse}}},
{child,undefined,'rabbit_tcp_listener_sup_:::5672',
{tcp_listener_sup,start_link,
[{0,0,0,0,0,0,0,0},
5672,
[inet6,binary,
{packet,raw},
{reuseaddr,true},
{backlog,128},
{nodelay,true},
{linger,{true,0}},
{exit_on_close,false}],
{rabbit_networking,tcp_listener_started,[amqp]},
{rabbit_networking,tcp_listener_stopped,[amqp]},
{rabbit_networking,start_client,[]},
"TCP Listener"]},
transient,infinity,supervisor,
[tcp_listener_sup]}}}}}}}}}}
检查下 5672端口是否被占用!
然后启动:
成功!
Virtual Hosts:
像mysql有数据库的概念并且可以指定用户对库和表等操作的权限。那RabbitMQ呢?RabbitMQ也有类似的权限管理。在RabbitMQ中可以虚拟消息服务器VirtualHost,每个VirtualHost相当月一个相对独立的RabbitMQ服务器,每个VirtualHost之间是相互隔离的。exchange、queue、message不能互通。
Guest这个默认的用户只能通过http://localhost:15672 来登录,不能使用IP地址登录,也就是不能远程访问,这对于服务器上没有安装桌面的情况是无法管理维护的。要解决这个问题增加用户。
/usr/local/rabbitmq/sbin/rabbitmqctl add_user admin admin
/usr/local/rabbitmq/sbin/rabbitmqctl list_users
/usr/local/rabbitmq/sbin/rabbitmqctl set_user_tags admin administrator
地址:192.168.91.6:15672
admin admin 登录: