CentOS7.2 安装RabbitMQ

CentOS上面使用yum安装比较方便

先记录一些rabbitmq的基本操作命令:

$ sudo chkconfig rabbitmq-server on  # 添加开机启动RabbitMQ服务
$ sudo /sbin/service rabbitmq-server start # 启动服务
$ sudo /sbin/service rabbitmq-server status  # 查看服务状态
$ sudo /sbin/service rabbitmq-server stop   # 停止服务

# 查看当前所有用户
$ sudo rabbitmqctl list_users

# 查看默认guest用户的权限
$ sudo rabbitmqctl list_user_permissions guest

# 由于RabbitMQ默认的账号用户名和密码都是guest。为了安全起见, 先删掉默认用户
$ sudo rabbitmqctl delete_user guest

# 添加新用户
$ sudo rabbitmqctl add_user username password

# 设置用户tag
$ sudo rabbitmqctl set_user_tags username administrator

# 赋予用户默认vhost的全部操作权限
$ sudo rabbitmqctl set_permissions -p / username ".*" ".*" ".*"

# 查看用户的权限
$ sudo rabbitmqctl list_user_permissions username

准备工作:

Centos自带yum,首先给yum换源,换成国内的阿里云

第一步:安装erlang

安装rpm仓库:

[[email protected] ~]$ sudo rpm -Uvh http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/e/epel-release-7-10.noarch.rpm

安装erlang

[[email protected] ~]$ yum install erlang

第二步:安装rabbitmq

先下载rpm

[[email protected] ~]$ sudo wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-3.6.10-1.el7.noarch.rpm

安装

[[email protected] ~]$ sudo yum install rabbitmq-server-3.6.10-1.el7.noarch.rpm

安装完成后启动服务:

[[email protected] ~]$ sudo yum install rabbitmq-server-3.6.10-1.el7.noarch.rpm

查看服务状态:

[[email protected] ~]$ service rabbitmq-server status

详细信息:

[[email protected] ~]$ sudo service rabbitmq-server status
[sudo] password for hongdada:
Redirecting to /bin/systemctl status  rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
   Active: active (running) since 日 2017-07-23 22:10:39 CST; 4min 3s ago
 Main PID: 34634 (beam.smp)
   Status: "Initialized"
   CGroup: /system.slice/rabbitmq-server.service
           ├─34634 /usr/lib64/erlang/erts-5.10.4/bin/beam.smp -W w -A 128 -P 1048576 -t 5000000 -stbt db -zdbbl 32000 -K true -- -root /...
           ├─34775 /usr/lib64/erlang/erts-5.10.4/bin/epmd -daemon
           ├─34977 inet_gethost 4
           └─34978 inet_gethost 4

7月 23 22:10:38 localhost.localdomain rabbitmq-server[34634]: RabbitMQ 3.6.10. Copyright (C) 2007-2017 Pivotal Software, Inc.
7月 23 22:10:38 localhost.localdomain rabbitmq-server[34634]: ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
7月 23 22:10:38 localhost.localdomain rabbitmq-server[34634]: ##  ##
7月 23 22:10:38 localhost.localdomain rabbitmq-server[34634]: ##########  Logs: /var/log/rabbitmq/[email protected]
7月 23 22:10:38 localhost.localdomain rabbitmq-server[34634]: ######  ##        /var/log/rabbitmq/[email protected]sasl.log
7月 23 22:10:38 localhost.localdomain rabbitmq-server[34634]: ##########
7月 23 22:10:38 localhost.localdomain rabbitmq-server[34634]: Starting broker...
7月 23 22:10:39 localhost.localdomain rabbitmq-server[34634]: systemd unit for activation check: "rabbitmq-server.service"
7月 23 22:10:39 localhost.localdomain systemd[1]: Started RabbitMQ broker.
7月 23 22:10:39 localhost.localdomain rabbitmq-server[34634]: completed with 0 plugins.

查看对应的日志文件:

[[email protected] ~]$ cd /var/log/rabbitmq/
[[email protected] rabbitmq]$ ls
[email protected]  [email protected]-sasl.log
[[email protected] rabbitmq]$ vi [email protected]

日志文件内容:

=INFO REPORT==== 23-Jul-2017::22:10:38 ===
Starting RabbitMQ 3.6.10 on Erlang R16B03-1
Copyright (C) 2007-2017 Pivotal Software, Inc.
Licensed under the MPL.  See http://www.rabbitmq.com/

=INFO REPORT==== 23-Jul-2017::22:10:38 ===
node           : [email protected]
home dir       : /var/lib/rabbitmq
config file(s) : /etc/rabbitmq/rabbitmq.config (not found)
cookie hash    : uyKwm1mYlbUecxvrRAhaaQ==
log            : /var/log/rabbitmq/[email protected]
sasl log       : /var/log/rabbitmq/[email protected]sasl.log
database dir   : /var/lib/rabbitmq/mnesia/[email protected]

=INFO REPORT==== 23-Jul-2017::22:10:39 ===
Memory limit set to 1509MB of 3774MB total.

=INFO REPORT==== 23-Jul-2017::22:10:39 ===
Enabling free disk space monitoring

=INFO REPORT==== 23-Jul-2017::22:10:39 ===
Disk free limit set to 50MB
"[email protected]" [只读] 75L, 2451C  

发现/etc/rabbitmq/rabbitmq.config不存在

先创建用户:

[[email protected] system]$ sudo chkconfig rabbitmq-server on
注意:正在将请求转发到“systemctl enable rabbitmq-server.service”。
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
[[email protected] system]$ sudo rabbitmqctl list_users
Listing users
guest    [administrator]
[[email protected] system]$ sudo rabbitmqctl add_user hongdada hongdada
Creating user "hongdada"
[[email protected] system]$ sudo rabbitmqctl set_user_tags hongdada administrator
Setting tags for user "hongdada" to [administrator]
[[email protected] system]$ sudo rabbitmqctl list_user_permissions hongdada
Listing permissions for user "hongdada"
[[email protected] system]$ sudo rabbitmqctl set_permissions -p / hongdada ".*" ".*" ".*"
Setting permissions for user "hongdada" in vhost "/"
[[email protected] system]$ sudo rabbitmqctl list_user_permissions hongdada
Listing permissions for user "hongdada"
/    .*    .*    .*

创建rabbitmq.config文件

[
 {rabbit,
  [%%
  %% Network Connectivity
  %% ====================
  %%
  %% By default, RabbitMQ will listen on all interfaces, using
  %% the standard (reserved) AMQP port.
  %%
  {tcp_listeners, [5672]},
  {loopback_users, ["hongda"]}
  ]}
].

最后启动Web管理器界面:(主要是找不到rabbitmq的安装位置了,可以用文件夹搜索)

[email protected] rabbitmq_server-3.6.10]$ cd /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.10
[[email protected] rabbitmq_server-3.6.10]$ ls
ebin  include  plugins  sbin
[[email protected] rabbitmq_server-3.6.10]$ sudo rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  amqp_client
  cowlib
  cowboy
  rabbitmq_web_dispatch
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to [email protected] started 6 plugins.

在虚拟机端访问:

打开防火墙端口:15672

http://www.cnblogs.com/uptothesky/p/6094357.html

http://www.cnblogs.com/crazylqy/p/6567253.html

http://mirrors.aliyun.com/help/centos?spm=5176.bbsr150321.0.0.d6ykiD

http://blog.csdn.net/weixin_35934768/article/details/52637273

时间: 2024-10-25 03:02:38

CentOS7.2 安装RabbitMQ的相关文章

CentOS7下安装RabbitMQ

一.简介 RabbitMQ是流行的开源消息队列系统,用erlang语言开发.RabbitMQ是AMQP(高级消息队列协议)的标准实现. 官网:https://www.rabbitmq.com 二.安装 1.安装erlang环境 yum -y install epel-release yum -y update yum -y install erlang socat 2.可以使用 erl -version测试是否安装成功. 3.安装RabbitMQ wget https://www.rabbitm

centos7.4 安装rabbitmq

centos7.4 安装rabbitmq ======================================= 1.安装 erlang:yum install -y erlang 2.下载rabbitmq:wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm 3.下载后安装:yum install -y rabbitmq-server-3.6

centos7.3安装rabbitmq

前言:对于centos7.3我使用yum安装不上erlang,才有了这边编译安装erlang的文章.在安装erlang过程中遇到不少坑,最终经过努力把rabbitmq装上. 按照官方的办法安装erlang报错,rpm包也是一样: Error: Package: erlang-wx-20.0rc1-3.el7.centos.x86_64 (erlang-solutions) Requires: libwx_baseu-2.8.so.0()(64bit) Error: Package: erlang

centos7.2安装rabbitmq教程

环境: centos7.2 rabbitmq依赖erlang,需要先安装erlang 1 安装erlang rpm -Uvh https://download.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum -y install erlang 2 安装RabbitMq wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-serve

在CentOS7上安装RabbitMQ

Installing on RPM-based Linux (RHEL, CentOS, Fedora, openSUSE) 首先需要安装erlang,参考:http://fedoraproject.org/wiki/EPEL/FAQ#howtouse rpm -Uvh http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm yum install erlang 安装过程中会有提示,一路输

Centos7下安装rabbitmq问题

在部署腾讯蓝鲸中需要安装rabbitmq,直接通过yum安装了rabbitmq,但重新部署的时候报错,add rabbitmq user admin failed: 通过搜索发现通过yum源进行安装的erlang和rabbitmq版本不匹配导致.erlang版本: erlang-21.0-1.el7.centos.x86_64rabbitmq版本:rabbitmq-server-3.7.6-1.el7.noarch 解决方法: 卸载rabbitmq版本,从官网下载最新的rabbitmq-serv

centos7离线安装rabbitmq

首先安装依赖 下载erlang, 在https://packagecloud.io/rabbitmq/erlang页面选择对应版本的erlang的rpm安装包(centos7需要19.3以上版本. 推荐 erlang-22.2.2-1.el7.x86_64.rpm 然后下载socat, 在http://www.rpmfind.net/linux/rpm2html/search.php?query=socat(x86-64)页面下载centos7版本的socat的rpm安装包. 推荐CentOS 

CentOS7 1708 安装 rabbitMQ

yum install wget //最小化安装系统需安装 wget 一 rpm安装   参考:hobinly 安装最新版 1 打开官网 http://www.rabbitmq.com/install-rpm.html 下载erlang环境 https://github.com/rabbitmq/erlang-rpm/releases wget -c https://github.com/rabbitmq/erlang-rpm/releases/download/v20.1.4/erlang-2

CentOS7上安装、配置、监控RabbitMQ

CentOS7上安装.配置.监控RabbitMQ RabbitMQ是流行的开源消息队列系统,是AMQP(Advanced Message Queuing Protocol高级消息队列协议)的标准实现,用erlang语言开发.RabbitMQ据说具有良好的性能和时效性,同时还能够非常好的支持集群和负 载部署,非常适合在较大规模的分布式系统中使用,具体特性还在验证中,待检验.由于项目需要,安装并配置了RabbitMQ,服务器操作系统是CentOS7. 环境:CentOS7.2 步骤 一.安装Erla