# yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm -y
# yuminstall rabbitmq-server -y
# systemctl enable rabbitmq-server.service
# systemctl start rabbitmq-server.service
Job for rabbitmq-server.service failed becausethe control process exited with error code. See "systemctl statusrabbitmq-server.service"and"journalctl -xe" for details.
解决方法:
修改主机名和hosts
修改前:
# hostnamectl status
Static hostname: node1.server
Icon name: computer-vm
Chassis: vm
Machine ID: d359f0058624494aa3c144477c6d97b8
Boot ID: bdd32e5df98a41259a441a079c0c44b3
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
修改后:
# hostnamectl --static set-hostname node1
# hostnamectl status
Static hostname: node1
Transient hostname: node1.server
Icon name: computer-vm
Chassis: vm
Machine ID: d359f0058624494aa3c144477c6d97b8
Boot ID: bdd32e5df98a41259a441a079c0c44b3
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.150 node1
启用Rabbitmq的web管理插件
RabbitMQ提供了一套插件机制,方便功能扩展。这里介绍一个最常用的:rabbitmq_management。这款插件提供了完善的web管理和监控功能,提供了各项指标。
# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
Mochiweb
Webmachine
rabbitmq_web_dispatch
amqp_client
rabbitmq_management_agent
rabbitmq_management
Applying plugin configuration to rabbit@node1... started 6 plugins.
新建Rabbitmq用户并授权
# rabbitmqctl add_user openstack openstack
Creating user "openstack" ...
# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/" ...
# systemctl restart rabbitmq-server.service
查看Rabbit的端口,其中5672是服务端口,15672是web管理端口,25672是做集群的端口
# ss -tunlp|grep 5672
在web界面添加openstack用户,设置权限,首次登陆必须使用账号和密码,必须都是guest
![22.png wKioL1gWOHXRkW1lAAJMCdAqqEU399.png-wh_50]()
![33.png wKiom1gWOHaQ-W-BAAJ1Z3DWWvY074.png-wh_50]()
role设置为administrator,并设置openstack的密码为openstack
![44.png wKioL1gWOHeQkRD-AAJ1TYhSjXE006.png-wh_50]()
若想要监控Rabbit,即可使用下图中的API
![55.png wKiom1gWOHmx5b3ZAAJ8MtUUwMQ419.png-wh_50]()
本文转自 linuxzkq 51CTO博客,原文链接:http://blog.51cto.com/linuxzkq/1867488