Centos7下RabbitMQ的安装与配置

2020-06-19 11:28:36 浏览数 (1)

具体按照步骤以此为准

  • 第一步:安装最新版的erlang依赖

通过github设置版本号:https://github.com/rabbitmq/erlang-rpm

代码语言:javascript复制
vi /etc/yum.repos.d/rabbitmq_erlang.repo
代码语言:javascript复制
[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://dl.bintray.com/rabbitmq/Keys/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
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
  • 第二步:查看线上版本号是否生效,如果生效执行安装即可
代码语言:javascript复制
yum info erlange

执行安装命令

代码语言:javascript复制
yum install erlang
  • 第三步:安装RabbitMQ服务
代码语言:javascript复制
https://bintray.com/rabbitmq/rpm/download_file?file_path=rabbitmq-server/v3.7.x/el/8/noarch/rabbitmq-server-3.7.22-1.el8.noarch.rpm

MQ基本操作

代码语言:javascript复制
启动RabbitMQ服务
#service rabbitmq-server start
状态查看
#rabbitmqctl status
启用插件
#rabbitmq-plugins enable rabbitmq_management
重启服务
#service rabbitmq-server restart
添加帐号:name 密码:passwd
#rabbitmqctl add_user name passwd
赋予其administrator角色
#rabbitmqctl set_user_tags name administrator
设置权限
#rabbitmqctl set_permissions -p / name ".*" ".*" ".*"
#后台方式启动
rabbitmq-server -detached 开启rabbitmq 服务

参考博客:https://blog.csdn.net/weixin_37641832/article/details/85266867#commentsedit

1.下载安装依赖环境

代码语言:javascript复制
wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -ivh erlang-solutions-1.0-1.noarch.rpm
yum install erlang
yum install socat

2.下载安装RabbitMQ

代码语言:javascript复制
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm
yum install rabbitmq-server-3.6.6-1.el7.noarch.rpm 

3.开启web管理后台

代码语言:javascript复制
cd /usr/sbin/
./rabbitmq-plugins enable rabbitmq_management

4.配置RabbitMQ

  • 创建用户名和密码
代码语言:javascript复制
./rabbitmqctl add_user admin admin123
  • 查看用户角色列表
代码语言:javascript复制
./rabbitmqctl list_users
  • 设置用户角色
代码语言:javascript复制
./rabbitmqctl  set_user_tags  admin  administrator
  • 设置用户权限
代码语言:javascript复制
./rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
  • 登陆web端输入用户名和密码访问

访问地址

0 人点赞