博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ubuntu16.04 安装RabbitMQ
阅读量:6630 次
发布时间:2019-06-25

本文共 4826 字,大约阅读时间需要 16 分钟。

安装RabbitMQ

由于rabbitMq需要erlang语言的支持,在安装rabbitMq之前需要安装erlang,执行命令:

sudo apt-get install erlang-nox

 安装rabbitMq命令:

2.$ sudo apt-get update3.$ sudo apt-get install rabbitmq-server

启动、停止、重启、状态rabbitMq命令:

启动:sudo rabbitmq-server start关闭: sudo rabbitmq-server stop重启: sudo rabbitmq-server restart查看状态:sudo rabbitmqctl status

安装好了以后可以使用 ps -ef|grep rabbit查看RabbitMQ的情况

hongdada@ubuntu:~$ ps -ef|grep rabbit rabbitmq   7991      1  0 00:12 ?        00:00:00 /bin/sh /usr/sbin/rabbitmq-serverrabbitmq   7999   7991  0 00:12 ?        00:00:00 /bin/sh -e /usr/lib/rabbitmq/bin/rabbitmq-serverrabbitmq   8077      1  0 00:12 ?        00:00:00 /usr/lib/erlang/erts-7.3/bin/epmd -daemonrabbitmq   8137   7999  0 00:12 ?        00:00:03 /usr/lib/erlang/erts-7.3/bin/beam.smp -W w -A 64 -P 1048576 -K true -B i -- -root /usr/lib/erlang -progname erl -- -home /var/lib/rabbitmq -- -pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.5.7/sbin/../ebin -noshell -noinput -s rabbit boot -sname rabbit@ubuntu -boot start_sasl -kernel inet_default_connect_options [{nodelay,true}] -sasl errlog_type error -sasl sasl_error_logger false -rabbit error_logger {file,"/var/log/rabbitmq/rabbit@ubuntu.log"} -rabbit sasl_error_logger {file,"/var/log/rabbitmq/rabbit@ubuntu-sasl.log"} -rabbit enabled_plugins_file "/etc/rabbitmq/enabled_plugins" -rabbit plugins_dir "/usr/lib/rabbitmq/lib/rabbitmq_server-3.5.7/sbin/../plugins" -rabbit plugins_expand_dir "/var/lib/rabbitmq/mnesia/rabbit@ubuntu-plugins-expand" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/var/lib/rabbitmq/mnesia/rabbit@ubuntu" -kernel inet_dist_listen_min 25672 -kernel inet_dist_listen_max 25672rabbitmq   8256   8137  0 00:12 ?        00:00:00 inet_gethost 4rabbitmq   8257   8256  0 00:12 ?        00:00:00 inet_gethost 4hongdada   8631   6788  0 00:18 pts/18   00:00:00 grep --color=auto rabbithongdada@ubuntu:~$ cd /usr/lib/rabbitmq/bin/

看起来没有问题,现在进入安装文件夹查看Rabbit的状态:

hongdada@ubuntu:~$ cd /usr/lib/rabbitmq/bin/hongdada@ubuntu:/usr/lib/rabbitmq/bin$ sudo ./rabbitmqctl statusStatus of node rabbit@ubuntu ...Error: unable to connect to node rabbit@ubuntu: nodedownDIAGNOSTICS===========attempted to contact: [rabbit@ubuntu]rabbit@ubuntu:  * connected to epmd (port 4369) on ubuntu  * epmd reports node 'rabbit' running on port 25672  * TCP connection succeeded but Erlang distribution failed  * suggestion: hostname mismatch?  * suggestion: is the cookie set correctly?  * suggestion: is the Erlang distribution using TLS?current node details:- node name: 'rabbitmq-cli-8673@ubuntu'- home dir: /home/hongdada- cookie hash: 0PRVafcTz6WKsC1GZlmK7Q==

有错误,要修改配置,先停止服务

hongdada@ubuntu:/usr/lib/rabbitmq/bin$ invoke-rc.d rabbitmq-server stop==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===需要通过认证才能停止“rabbitmq-server.service”。Authenticating as: hongda,,, (hongdada)Password: ==== AUTHENTICATION COMPLETE ===

进入安装文件夹/usr/lib/rabbitmq/bin

修改rabbitmqctl文件

添加一行Home配置:加红色的地方

#!/bin/sh -e##  The contents of this file are subject to the Mozilla Public License##  Version 1.1 (the "License"); you may not use this file except in##  compliance with the License. You may obtain a copy of the License##  at http://www.mozilla.org/MPL/####  Software distributed under the License is distributed on an "AS IS"##  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See##  the License for the specific language governing rights and##  limitations under the License.####  The Original Code is RabbitMQ.####  The Initial Developer of the Original Code is GoPivotal, Inc.##  Copyright (c) 2007-2015 Pivotal Software, Inc.  All rights reserved.### Get default settings with user overrides for (RABBITMQ_)
# Non-empty defaults should be set in rabbitmq-env. `dirname $0`/rabbitmq-env# We specify Mnesia dir and sasl error logger since some actions# (e.g. forget_cluster_node --offline) require us to impersonate the# real node.RABBITMQ_USE_LONGNAME=${RABBITMQ_USE_LONGNAME} \HOME=/var/lib/rabbitmq \exec ${ERL_DIR}erl \ -pa "${RABBITMQ_HOME}/ebin" \ -noinput \ -hidden \ ${RABBITMQ_CTL_ERL_ARGS} \ -boot "${CLEAN_BOOT_FILE}" \ -sasl errlog_type error \ -mnesia dir "\"${RABBITMQ_MNESIA_DIR}\"" \ -s rabbit_control_main \ -nodename $RABBITMQ_NODENAME \ -extra "$@"

 启用web管理台:

hongdada@ubuntu:/usr/lib/rabbitmq/bin$ sudo ./rabbitmq-plugins enable rabbitmq_management The following plugins have been enabled:  mochiweb  webmachine  rabbitmq_web_dispatch  amqp_client  rabbitmq_management_agent  rabbitmq_managementApplying plugin configuration to rabbit@ubuntu... failed. * Could not contact node rabbit@ubuntu.   Changes will take effect at broker restart. * Options: --online  - fail if broker cannot be contacted.            --offline - do not try to contact broker.

查看web管理器

127.0.0.1:15672 

 

 

转载地址:http://mswvo.baihongyu.com/

你可能感兴趣的文章
C# WinForm控件之Dock顺序调整
查看>>
NSPredicate过滤数组数据
查看>>
spark 数据预处理 特征标准化 归一化模块
查看>>
正则表达式中参数g、i、m的作用(share)
查看>>
使用Solr构建企业级的全文检索(四)---------写入文档
查看>>
squid的正向代理和反向代理
查看>>
linux下命令与文件的查询
查看>>
SEO意识的网站设计:设计和SEO的完美结合可能么?
查看>>
IP 算法
查看>>
IBM_System_x3650服务器固件升级手顺
查看>>
awk单行脚本
查看>>
软件开发之通病解析
查看>>
python wxPython 5 (框架 wx.Frame)
查看>>
windows server backup 功能备份虚拟机
查看>>
PHP多进程
查看>>
现代前端开发路线图:从零开始,一步步成为前端工程师
查看>>
ESXi 5.0设置时间
查看>>
怎么在win7让WAMP下的apache自动启动
查看>>
WIN2008R2下安装plsqldeveloper和toad
查看>>
jquery 通过点击事件获取id
查看>>