安裝
- 安裝brew - https://brew.sh/
- 執(zhí)行
brew install rabbitmq
--- 需要點(diǎn)時(shí)間 - 安裝目錄(MQ_HOME):/usr/local/Cellar/rabbitmq/${version}
- 啟動(dòng):
${MQ_HOME}/sbin/rabbitmq-server
默認(rèn)端口 - 官網(wǎng)文檔
- 5672 --- client端通信端口
- 15672 --- 管理后臺(tái)界面端口(
http://127.0.0.1:15672/ guest guest
) - 25672 --- server間內(nèi)部通信端口
用戶(hù)授權(quán)
# 添加 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
# 添加用戶(hù)
rabbitmqctl add_user <username> <password>
eg:${MQ_HOME}/sbin/rabbitmqctl add_user admin admin
# 刪除用戶(hù)
delete_user <username>
eg:${MQ_HOME}/sbin/rabbitmqctl delete_user admin
# 用戶(hù)授權(quán)
rabbitmqctl set_permissions [-p <vhost>] <user> <conf> <write> <read>
eg:${MQ_HOME}/sbin/rabbitmqctl set_permissions -p test admin '.*' '.*' '.*'
# 查看權(quán)限
rabbitmqctl list_user_permissions <user>
eg:${MQ_HOME}/sbin/rabbitmqctl list_user_permissions admin