1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# cat init_rabbitmq.sh
#!/bin/bash
# reset first node
echo "1、Reset first rabbitmq node."
docker exec rabbitmq /bin/bash -c 'rabbitmqctl stop_app'
docker exec rabbitmq /bin/bash -c 'rabbitmqctl reset'
docker exec rabbitmq /bin/bash -c 'rabbitmqctl start_app'
# add user and userrole
echo "2、Starting to create user."
docker exec rabbitmq /bin/bash -c 'rabbitmqctl add_user admin admin'
echo "3、Set tags for new user."
docker exec rabbitmq /bin/bash -c 'rabbitmqctl set_user_tags admin administrator'
echo "4、Grant permissions to new user."
docker exec rabbitmq /bin/bash -c "rabbitmqctl set_permissions -p '/' admin '.*' '.*' '.*'"
echo "5、Delete guest user"
docker exec rabbitmq /bin/bash -c "rabbitmqctl delete_user guest"
|