Debian 12 bookworm
Sponsored Link

RabbitMQ : Install2023/07/20

 
Install RabbitMQ which is the message broker software that implements AMQP (Advanced Message Queuing Protocol).
[1] Install RabbitMQ.
root@dlp:~#
apt -y install rabbitmq-server
[2] To use RabbitMQ, add User Accounts first.
By default, only guest user exists and he can connect only localhost.
# rabbitmqctl add_user [user] [password]

[root@dlp ~]#
rabbitmqctl add_user serverworld password

Adding user "serverworld" ...
Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more.
# show user list

[root@dlp ~]#
rabbitmqctl list_users

Listing users ...
user    tags
serverworld     []
guest   [administrator]

# changing password of a user is like follows

[root@dlp ~]#
rabbitmqctl change_password serverworld strongpassword

Changing password for user "serverworld" ...
# granting admin role to a user is like follows

[root@dlp ~]#
rabbitmqctl set_user_tags serverworld administrator

Setting tags for user "serverworld" to [administrator] ...
# deleting a user is like follows

[root@dlp ~]#
rabbitmqctl delete_user serverworld

Deleting user "serverworld" ...
[3] To use RabbitMQ, add Virtualhost, too.
# rabbitmqctl add_vhost [vhost]

[root@dlp ~]#
rabbitmqctl add_vhost /my_vhost

Adding vhost "/my_vhost" ...
# show vhost list

[root@dlp ~]#
rabbitmqctl list_vhosts

Listing vhosts ...
name
/my_vhost
/

# deleting vhost is like follows

[root@dlp ~]#
rabbitmqctl delete_vhost /my_vhost

Deleting vhost "/my_vhost" ...
[4] To grant permissions to a user for virtualhosts, configure like follows.
# rabbitmqctl set_permissions [-p vhost] [user] [permission ⇒ (modify) (write) (read)]

[root@dlp ~]#
rabbitmqctl set_permissions -p /my_vhost serverworld ".*" ".*" ".*"

Setting permissions for user "serverworld" in vhost "/my_vhost" ...
# show permission for a vhost

[root@dlp ~]#
rabbitmqctl list_permissions -p /my_vhost

Listing permissions for vhost "/my_vhost" ...
user    configure       write   read
serverworld     .*      .*      .*

# show permission of a specific user

[root@dlp ~]#
rabbitmqctl list_user_permissions serverworld

Listing permissions for user "serverworld" ...
vhost   configure       write   read
/my_vhost       .*      .*      .*

# deleting permission of a specific user is like follows

[root@dlp ~]#
rabbitmqctl clear_permissions -p /my_vhost serverworld

Clearing permissions for user "serverworld" in vhost "/my_vhost" ...
Matched Content