RabbitMQ在Ubuntu 16.04下的安装与配置

安装RabbitMQ

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

sudo apt-get install erlang-nox
安装rabbitMq命令:

2.$ sudo apt-get update
3.$ 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的情况

复制代码
[email protected]:~$ ps -ef|grep rabbit
rabbitmq 7991 1 0 00:12 ? 00:00:00 /bin/sh /usr/sbin/rabbitmq-server
rabbitmq 7999 7991 0 00:12 ? 00:00:00 /bin/sh -e /usr/lib/rabbitmq/bin/rabbitmq-server
rabbitmq 8077 1 0 00:12 ? 00:00:00 /usr/lib/erlang/erts-7.3/bin/epmd -daemon
rabbitmq 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 [email protected] -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/[email protected]"} -rabbit sasl_error_logger {file,"/var/log/rabbitmq/[email protected]"} -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/[email protected]" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/var/lib/rabbitmq/mnesia/[email protected]" -kernel inet_dist_listen_min 25672 -kernel inet_dist_listen_max 25672
rabbitmq 8256 8137 0 00:12 ? 00:00:00 inet_gethost 4
rabbitmq 8257 8256 0 00:12 ? 00:00:00 inet_gethost 4
hongdada 8631 6788 0 00:18 pts/18 00:00:00 grep --color=auto rabbit
[email protected]:~$ cd /usr/lib/rabbitmq/bin/
复制代码
看起来没有问题,现在进入安装文件夹查看Rabbit的状态:

复制代码
[email protected]:~$ cd /usr/lib/rabbitmq/bin/
[email protected]:/usr/lib/rabbitmq/bin$ sudo ./rabbitmqctl status
Status of node [email protected] ...
Error: unable to connect to node [email protected]: nodedown

DIAGNOSTICS

attempted to contact: [[email protected]]

[email protected]:

  • 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: ‘[email protected]‘
  • home dir: /home/hongdada
  • cookie hash: 0PRVafcTz6WKsC1GZlmK7Q==
    复制代码
    有错误,要修改配置,先停止服务

复制代码
[email protected]:/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_)<var_name>

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 "[email protected]"
复制代码
启用web管理台:

复制代码
[email protected]:/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_management

Applying plugin configuration to [email protected] failed.

  • Could not contact node [email protected]
    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://blog.csdn.net/sharetop/article/details/50523081

打开管理页面
sudo rabbitmq-plugins enable rabbitmq_management

查看安装的插件
sudo rabbitmqctl list_users

查看用户
sudo rabbitmqctl list_users

新增管理员用户
sudo rabbitmqctl add_user admin admin
sudo rabbitmqctl set_user_tags admin administrator

用刚设置的账户登录管理页面

http://127.0.0.1:15672

地图大数据云平台 www.favxu.com

三维地球云平台 3d.favxu.com

地图云平台交流合作 QQ:63747667

邮箱:[email protected]

原文地址:http://blog.51cto.com/535777/2103678

时间: 2024-11-25 12:27:13

RabbitMQ在Ubuntu 16.04下的安装与配置的相关文章

Ubuntu 16.04下的安装RabbitMQ

安装 添加源 echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list 新增公钥 wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add - 更新源 sudo apt-get update 安装rabbitmq-server sud

ubuntu 16.04下手动安装apache2\php7.0\mysql\phpmyadmin\ftp等环境

在ubuntu下安装一个web环境,应该说非常简单. 首先是防火墙:http://wiki.ubuntu.org.cn/Ufw%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97   参考地址https://linux.cn/article-8087-1.html ------------ sudo apt-get install ufw  安装 sudo systemctl start ufw 启动sudo systemctl enable ufw 启用 sudo ufw

Ubuntu 16.04下Samba相关配置

[转]:http://www.linuxidc.com/Linux/2016-12/138498.htm samba是 SMB/CIFS网络协议的重新实现,它作为NFS的补充使得在Linux和Windows系统之间进行文件共享.打印更容易实现. 相关介绍: SAMBA套件: (1)samba:这个套件主要包含了SAMBA的主要daemon档案(smbd及nmbd),SAMBA的文档(document),以及其它与SAMBA相关的logrotate设定文件及开机预设选项档案等. (2)samba-

Ubuntu 16.04 下安装Firefox的Flash插件

Ubuntu 16.04 下安装Firefox的Flash插件 在ubuntu系统环境下面打开优酷视频,发现无法播放视频.Adobe Flash Player 是一款轻量级浏览器插件,具有丰富的 Internet 应用运行时间,提供持续的迷人用户体验.绝妙的音频/视频回放效果和刺激的游戏. 虽然flash早晚会被html5代替,但目前还是不少网站在用,正好研究一下怎么安装flash插件,在优酷的提示下,点击进入Adobe Flash Player的下载页面: 选择.tar.gz的包, 下载后解压

Ubuntu 16.04下使用VirtualBox虚拟机安装Windows XP win7 linux 安装虚拟机

1. http://www.linuxidc.com/Linux/2016-09/135192.htm 2. 对于初次使用Ubuntu 16.04的多小伙伴来说,可能还不是很熟悉操作,有时候,我们就需要在这个Ubuntu系统中,再安装一个虚拟机来帮助自己完成Windows下的需求,那么这里就来讲讲如何在Ubuntu 16.04下安装VirtualBox虚拟机. 如果是Ubuntu16.04升级之后VirtualBox不能安装,提示缺少两个依赖库,分别为 1.libsdl1.2debian(lib

Ubuntu 16.04下安装MySQL详解

Ubuntu 16.04下安装MySQL详解分别依次输入以下3个命令: sudo apt-get install mysql-server sudo apt install mysql-client sudo apt install libmysqlclient-dev 安装成功后可以通过下面的命令测试是否安装成功: sudo netstat -tap | grep mysql 出现如下信息证明安装成功: >>> sudo netstat -tap | grep mysql tcp 0

我的淘宝:Ubuntu 16.04.2上安装 Oracle 11.2.0.4 RAC

进入淘宝店铺 教程:Ubuntu 16.04.2上安装 Oracle 11.2.0.4 RAC 请支持下.价格好商量!

Ubuntu 16.04下配置nginx与nodejs以及服务的部署

title: Ubuntu 16.04下配置nginx与nodejs以及服务的部署 date: 2019-05-05 22:45:49 tags: Linux --- 第一步:安装nginx sudo apt-get update sudo apt-get install nginx 如果遇到依赖问题,尝试执行sudo apt-get -f install命令 第二步:配置nginx 首先备份原先的配置文件:sudo cp /etc/nginx/sites-available/default /

Ubuntu 16.04 一系列软件安装命令,包括QQ、搜狗、Chrome、vlc、网易云音乐安装方法

1 简介 Ubuntu 16.04安装完后,还需要做一些配置才能愉快的使用,包括添加软件源.安装搜狗输入法.Chrome浏览器.网易云音乐.配置快捷键.安装git等等,下面就跟着我来配置吧,just do it 2 版本选择 如果你是小白,不想折腾,可以直接选择安装deepin linux,中文名”深度Linux”,这个是国内目前最好用的Linux之一,开箱即用,常用软件都安装好了,甚至连最新版的QQ都有,mac风格的界面也很漂亮. 但是,作为一个程序员,还是要使用Ubutnu,之前博主用过Ub