1.安裝erlang環境java
yum install http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el7.centos.x86_64.rpmweb
2.安裝rabbitmqcentos
yum install http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.15/rabbitmq-server-3.6.15-1.el7.noarch.rpmapp
3.啓動服務tcp
rabbitmq-server -detached【 /usr/local/rabbitmq/sbin/rabbitmq-server -detached 】oop
4.查看狀態spa
rabbitmqctl status【 /usr/local/rabbitmq/sbin/rabbitmqctl status 】插件
5.關閉服務rest
rabbitmqctl stop【 /usr/local/rabbitmq/sbin/rabbitmqctl stop 】server
6.列出角色
rabbitmqctllist_users
7.配置網頁插件
rabbitmq-plugins enable rabbitmq_management
8.配置防火牆(此項尤其重要,未配置好,分別會致使web管理界面沒法打開,java沒法連上MQ)
步驟一: firewall-cmd --permanent --add-port=15672/tcp
步驟二: firewall-cmd --permanent --add-port=5672/tcp
步驟三: firewall-cmd --reload
步驟四: systemctl restart firewalld.service
步驟一二開啓端口 步驟三加載設置 步驟四重啓 MQ
若是上面中止服務沒有做用能夠採用
1.中止服務 systemctl stop rabbitmq-server.service
2.啓動服務 systemctl start rabbitmq-server.service
緣由: RabbitMQ從3.3.0開始禁止使用guest/guest權限經過除localhost外的訪問。
解決: 在rabbitmq配置文件中(找到/rabbitmq_server-3.6.14/ebin下面的rabbit.app文件)中設置 loopback_users爲[]
而後重啓 systemctl restart rabbitmq-server.service