RabbitMQ笔记
2020-05-29 本文已影响0人
觉无知而求索
安装
- 安装brew - https://brew.sh/
- 执行
brew install rabbitmq
--- 需要点时间 - 安装目录(MQ_HOME):/usr/local/Cellar/rabbitmq/${version}
- 启动:
${MQ_HOME}/sbin/rabbitmq-server
默认端口 - 官网文档
- 5672 --- client端通信端口
- 15672 --- 管理后台界面端口(
http://127.0.0.1:15672/ guest guest
) - 25672 --- server间内部通信端口
用户授权
# 添加 Virtual Hosts
rabbitmqctl add_vhost <vhost>
eg:${MQ_HOME}/sbin/rabbitmqctl add_vhost test
# 删除 Virtual Hosts
rabbitmqctl delete_vhost <vhost>
eg:${MQ_HOME}/sbin/rabbitmqctl delete_vhost test
# 添加用户
rabbitmqctl add_user <username> <password>
eg:${MQ_HOME}/sbin/rabbitmqctl add_user admin admin
# 删除用户
delete_user <username>
eg:${MQ_HOME}/sbin/rabbitmqctl delete_user admin
# 用户授权
rabbitmqctl set_permissions [-p <vhost>] <user> <conf> <write> <read>
eg:${MQ_HOME}/sbin/rabbitmqctl set_permissions -p test admin '.*' '.*' '.*'
# 查看权限
rabbitmqctl list_user_permissions <user>
eg:${MQ_HOME}/sbin/rabbitmqctl list_user_permissions admin