CentOS7下安装rabbitmq消息队
安装如下步骤:
1、首先安装erlang
yum install erlang
注:如果出现No package erlang available.
rpm -Uvh http://download.Fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
2、安装rabbitmq rpm包
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm
yum install rabbitmq-server-3.6.6-1.el7.noarch.rpm
3、启动rabbitmq
service rabbitmq-server start
注:如果启动失败,报错如下:
则修改hosts,添加hostname:
vi /etc/hosts
添加hostname:
再次重启即可:
4、打开5672端口
/sbin/iptables -I INPUT -p tcp --dport 5672 -j ACCEPT /etc/rc.d/init.d/iptables save /etc/init.d/iptables restart
5、启用插件
rabbitmq-plugins enable rabbitmq_management
6、重启rabbitmq
service rabbitmq-server restart
7、web访问
8、无法登录请使用如下:
vim /etc/rabbitmq/rabbitmq.config
写入如下信息并保存:
[{rabbit, [{loopback_users, []}]}].
再重启:
再次访问即可:
9、修改默认的客户端侦听端口
a、修改/etc/rabbitmq/rabbitmq.config
[ {rabbit, [{tcp_listeners, [5700]}]} ].
b、修改/etc/rabbitmq/rabbitmq-env.conf
NODE_PORT=5700
10、添加用户
rabbitmqctl add_user admin admin rabbitmqctl set_user_tags admin administrator rabbitmqctl set_permissions -p '/' admin '.*' '.*' '.*'