授权用户Vhost
##授权admin 用户Vhost / 所有权限
rabbitmqctl set_permissions [-p vhost] {user} {conf} {write} {read}
如:
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
#添加exchange
rabbitmqctl eval 'rabbit_exchange:declare({resource, <<"/">>, exchange, <<"exchange_pent">>}, topic, true, false, false, []).'
#添加队列
rabbitmqctl eval 'rabbit_amqqueue:declare({resource, <<"/">>, queue, <<"pre.queue">>}, true, false, [], none).'
#绑定队列
rabbitmqctl eval 'rabbit_binding:add({binding, {resource, <<"test">>, exchange, <<"ac.exchange.alarm">>}, <<"ac.routing.key.alarm">>, {resource, <<"test">>, queue, <<"ac.queue.alarm">>}, []}).'
rabbitmqctl eval 'rabbit_binding:add({binding, {resource, <<"/">>, exchange, <<"exchange_pent">>}, <<"#">>, {resource, <<"/">>, queue, <<"pre.queue">>}, []}).'
参考:https://blog.csdn.net/hncscwc/article/details/79048647
https://blog.csdn.net/liao0801_123/article/details/91524878