CentOS7 安装配置RabbitMQ3.8.x [yum方式]

相关记录链接地址 :

  • 第一篇 CentOS7 安装配置RabbitMQ3.8.x [yum方式]
  • 第二篇-CentOS7 配置RabbitMQ3.8.x集群 [mirroring queue]

一、基本安装

1.1 主机信息

主机名称 ip地址 操作系统 角色 软件版本 备注
tjdatarabbitmq-shqstst-10 10.122.151.8 CentOS 7 erlang, rabbitmq erlang22.3 rabbitmq v3.8.7

1.2 配置erlang与rabbitmq yum仓库

这里安装的erlang是专用于rabbitmq的[the package strips off some Erlang modules and dependencies that are not essential for running RabbitMQ.]
仓库有2种选择,Package Cloud 和 Bintray。这里选择使用Bintray
vi /etc/yum.repos.d/rabbitmq.repo

[rabbitmq-erlang]
name=rabbitmq-erlang
baseurl=https://dl.bintray.com/rabbitmq-erlang/rpm/erlang/22/el/7
gpgcheck=1
gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
repo_gpgcheck=0
enabled=1

[rabbitmq-server]
name=rabbitmq-server
baseurl=https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.8.x/el/7/
gpgcheck=0
repo_gpgcheck=0
enabled=1

1.3 安装erlang

yum install erlang -y
==============================================================================================
 Package                                 Arch                             Version             
==============================================================================================
Installing:
 erlang                                  x86_64                           22.3.4.10-1.el7     
Updating for dependencies:
 openssl                                 x86_64                           1:1.0.2k-16.el7_6.1 
 openssl-devel                           x86_64                           1:1.0.2k-16.el7_6.1 
 openssl-libs                            x86_64                           1:1.0.2k-16.el7_6.1 
==============================================================================================

1.4 安装rabbitmq-server

yum install rabbitmq-server socat -y
================================================================================================
 Package                               Arch                                   Version           
================================================================================================
Installing:
 socat                                 x86_64                                 1.7.3.2-2.el7     
 rabbitmq-server                             noarch                             3.8.7-1.el7 
================================================================================================

二、配置与验证

2.1 启动rabbitmq-server

systemctl start rabbitmq-server.service
systemctl enable rabbitmq-server.service
systemctl status rabbitmq-server.service

2.2 启用UI以及prometheus插件

# 启用插件
rabbitmq-plugins enable rabbitmq_management rabbitmq_prometheus

# 查看启用的插件
rabbitmq-plugins list
.... 省略其他
[E*] rabbitmq_management               3.8.7
[e*] rabbitmq_management_agent         3.8.7
[E*] rabbitmq_prometheus               3.8.7
[e*] rabbitmq_web_dispatch             3.8.7

# 重启服务
systemctl restart rabbitmq-server.service

netstat -pltn
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      3081/beam.smp       
tcp        0      0 0.0.0.0:15692           0.0.0.0:*               LISTEN      3081/beam.smp  # prometheus metrics     
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN      3211/epmd                  
tcp        0      0 0.0.0.0:15672           0.0.0.0:*               LISTEN      3081/beam.smp       
tcp6       0      0 :::5672                 :::*                    LISTEN      3081/beam.smp    

# 验证metrics API
curl localhost:15692/metrics

# 验证UI
浏览器访问 10.122.151.8:15672 (本地IP地址 10.122.151.8)
备注:当前版本guest/guest默认只支持localhost访问[User can only log in via localhost],如果需要可以修改默认配置

2.3 创建admin账户,设置角色,并授权

这里授予做大权限了,可以根据实际需要进行授权

rabbitmqctl add_user admin admin
rabbitmqctl set_user_tags admin  administrator
rabbitmqctl set_permissions -p / admin  ".*" ".*" ".*"

浏览器访问,直接使用admin/admin登录
CentOS7 安装配置RabbitMQ3.8.x [yum方式]_第1张图片

到这里,单机版本的rabbitmq-server就配置完成了。接下来配置3节点的集群[mirrors queue模式]

你可能感兴趣的:(Linux,rabbitmq,erlang)