不可直接安装,需要erlang
环境,否则报错:
Error: Package: rabbitmq-server-3.10.0-1.el7.noarch (/rabbitmq-server-3.10.0-1.el7.noarch)
Requires: erlang >= 23.2
Available: erlang-R16B-03.18.el7.x86_64 (epel)
erlang = R16B-03.18.el7
2.2 erlang环境下载
下载前可查看rabbitmq-server不同版本依赖erlang环境版本的对照表,也可以直接安装rabbitmq-server从报错信息里获取需要的版本,由于是同一个网站,下载的方式是一样的,这次也是直接下载安装文件erlang-23.3.4.11-1.el7.x86_64.rpm
。
2.3 安装
# 首先安装erlang环境
[root@tcloud rabbitmq]# rpm -ivh erlang-23.3.4.11-1.el7.x86\_64.rpm
warning: erlang-23.3.4.11-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 6026dfca: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:erlang-23.3.4.11-1.el7 ################################# [100%]
# 安装rabbitmq-server
[root@tcloud rabbitmq]# rpm -ivh rabbitmq-server-3.10.0-1.el7.noarch.rpm
warning: rabbitmq-server-3.10.0-1.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 6026dfca: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:rabbitmq-server-3.10.0-1.el7 ################################# [100%]
3.简单使用
3.1 服务启动
# 加入开机自启
[root@tcloud rabbitmq]# systemctl enable rabbitmq-server
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
# 启动服务
systemctl start rabbitmq-server
# 查看启动状态
[root@tcloud rabbitmq]# systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2023-03-01 14:52:49 CST; 36s ago
Main PID: 30095 (beam.smp)
CGroup: /system.slice/rabbitmq-server.service
├─30095 /usr/lib64/erlang/erts-11.2.2.10/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -sbwt none -sbwtdcpu none -sbwtdio none...
├─30110 erl_child_setup 32768
├─30139 /usr/lib64/erlang/erts-11.2.2.10/bin/epmd -daemon
├─30159 inet_gethost 4
└─30160 inet_gethost 4
Mar 01 14:52:47 tcloud rabbitmq-server[30095]: Doc guides: https://rabbitmq.com/documentation.html
Mar 01 14:52:47 tcloud rabbitmq-server[30095]: Support: https://rabbitmq.com/contact.html
Mar 01 14:52:47 tcloud rabbitmq-server[30095]: Tutorials: https://rabbitmq.com/getstarted.html
Mar 01 14:52:47 tcloud rabbitmq-server[30095]: Monitoring: https://rabbitmq.com/monitoring.html
Mar 01 14:52:47 tcloud rabbitmq-server[30095]: Logs: /var/log/rabbitmq/rabbit@tcloud.log
Mar 01 14:52:47 tcloud rabbitmq-server[30095]: /var/log/rabbitmq/rabbit@tcloud_upgrade.log
Mar 01 14:52:47 tcloud rabbitmq-server[30095]: <stdout>
Mar 01 14:52:47 tcloud rabbitmq-server[30095]: Config file(s): (none)
Mar 01 14:52:49 tcloud systemd[1]: Started RabbitMQ broker.
Mar 01 14:52:49 tcloud rabbitmq-server[30095]: Starting broker... completed with 0 plugins.
3.2 WEB配置使用
此时服务已经可以使用了,但是,默认情况下,RabbitMQ是没有安装WEB端插件的,需要手动积获才可以生效。命令如下:
[root@tcloud ~]# rabbitmq-plugins enable rabbitmq\_management
Enabling plugins on node rabbit@tcloud:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@tcloud...
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
started 3 plugins.
更多插件可以到Community Plugins
页面进行【下载安装】。插件配置完成后使用地址http://服务器IP:15672/
用户名密码guest/guest
即可登录:
3.3 首次登录问题处理
- 方法 1️⃣ 添加
非guest
用户
# 1.添加用户及登录密码
[root@tcloud ~]# rabbitmqctl add\_user admin admin
Adding user "admin" ...
Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more.
# 2.设置用户标签(标签跟guest一致)
[root@tcloud ~]# rabbitmqctl set\_user\_tags admin administrator
Setting tags for user "admin" to [administrator] ...
# 3.设置权限 admin 用户可访问虚拟主机 / 并在所有的资源上具备可配置、可写、可读
[root@tcloud ~]# rabbitmqctl set\_permissions -p / admin ".\*" ".\*" ".\*"
Setting permissions for user "admin" in vhost "/" ...
# 查看帮助
rabbitmqctl help
# 查看具体命令
[root@tcloud ~]# rabbitmqctl help set\_permissions
Usage
rabbitmqctl [--node <node>] [--longnames] [--quiet] set_permissions [--vhost <vhost>] <username> <conf> <write> <read>
Sets user permissions for a vhost.
使用admin/admin
即可登录:
- 方法 2️⃣ 修改
loopback_users
列表
找到rabbit.app
文件并loopback_users
列表里的:
# 查找文件
[root@tcloud ~]# find / -name rabbit.app
/usr/lib/rabbitmq/lib/rabbitmq_server-3.10.0/plugins/rabbit-3.10.0/ebin/rabbit.app
# 修改文件
vim /usr/lib/rabbitmq/lib/rabbitmq_server-3.10.0/plugins/rabbit-3.10.0/ebin/rabbit.app
# 删除 loopback\_users 列表里的 <<"guest">> 仅保留如下空列表
{loopback_users, []},
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
升。**
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!