下载脚本
1
2
| curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash
|
安装
1
2
| yum -y install erlang
yum -y install rabbitmq-server
|
命令
1
2
3
4
5
6
7
8
| #启动服务
systemctl start rabbitmq-server
#查看状态
systemctl status rabbitmq-server
#设置为开机启动
systemctl enable rabbitmq-server
|
添加用户并授权
1
2
3
4
5
6
7
8
9
10
11
12
13
| #添加用户
rabbitmqctl add_user admin admin
#设置用户角色
rabbitmqctl set_user_tags admin administrator
#tag(administrator,monitoring,policymaker,management)
#设置用户权限(接受来自所有Host的所有操作)
rabbitmqctl set_permissions -p "/" admin '.*' '.*' '.*'
#查看用户权限
rabbitmqctl list_user_permissions admin
|
配置用户远程访问
1
2
3
4
5
6
7
| #修改配置文件
vi /etc/rabbitmq/rabbitmq.config
#保存以下内容
[
{rabbit, [{tcp_listeners, [5672]}, {loopback_users, ["test"]}]}
].
|
重启服务
systemctl restart rabbitmq-server
文章作者
lim
上次更新
2024-11-21
(1dac9ff)
许可协议
CC BY-NC-ND 4.0