rabbitmq在centos7下简单安装与配置管理

1、导入相关的签证

## primary RabbitMQ signing key
rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
## modern Erlang repository
rpm --import https://packagecloud.io/rabbitmq/erlang/gpgkey
## RabbitMQ server repository
rpm --import https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey

2、在/etc/yum.repos.d/目录下创建一个rabbitmq的镜像仓库文件(比如:rabbitmq.repo)

在新建的文件rabbitmq.repo里面添加下面的内容:

##
## Zero dependency Erlang
##

[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

##
## RabbitMQ server
##

[rabbitmq_server]
name=rabbitmq_server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_server-source]
name=rabbitmq_server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

3、更新yum仓库的元数据

yum update -y

4、安装rabbitmq

## 安装rabbitmq及依赖
yum install socat logrotate -y
yum install erlang rabbitmq-server -y

5、启动rabbitmq-server

systemctl start rabbitmq-server   
systemctl status rabbitmq-server	#查看rabbitmq状态
systemctl stop rabbitmq-server	#停止rabbitmq

6、访问

默认情况下只有guest用户(密码为guest),只能在本地访问, 且需要开启插件rabbitmq_management

rabbitmq-plugins enable rabbitmq_management

本地访问可以使用http://localhost:15672

远程访问的话,需要创建一个新的用户并设置权限标签

标签 Capabilities
(None) 不能访问管理插件
management 1、列出他们登录的virtual host
2、查看所有的队列,交换机和绑定他们的virtual host
3、查看和关闭他们自己的channels和连接
4、查看涵盖所有虚拟主机的“全局”统计信息,包括其中其他用户的活动
policymaker 1、查看、创建和删除他们可以通过 AMQP 登录的虚拟主机的策略和参数
monitoring 1、列出所有虚拟主机,包括他们无法使用消息传递协议访问的虚拟主机
2、查看其他用户的连接和channels
3、查看节点级数据,例如内存使用和集群
4、查看所有虚拟主机的真正全局统计信息
administrator 1、创建和删除virtual hosts
2、查看、创建和删除用户
3、查看、创建和删除权限
4、关闭其他用户的连接

创建一个用户tom设置密码为12345,并给用户tom设置权限标签

rabbitmqctl add_user tom 123456		#创建用户及设置密码
rabbitmqctl set_user_tags tom administrator #给用户设置权限标签

7、管理

查看rabbitmq配置、版本、使用情况

rabbitmqctl status

配置文件(插件)的位置/etc/rabbitmq/下,默认是没有配置文件,可以自己创建一个文件名为rabbitmq的配置文件

配置文件参考:

https://github.com/rabbitmq/rabbitmq-server/blob/master/deps/rabbit/docs/rabbitmq.conf.example

官方文档参考

https://www.rabbitmq.com/documentation.html

上一篇:centos7安装RabbitMQ


下一篇:Windows(10)中安装本地RabbitMQ - 简单安装