RabbitMQ : Install2021/06/21 |
Install RabbitMQ which is the message broker software that implements AMQP (Advanced Message Queuing Protocol).
|
|
[1] | Install RabbitMQ. |
[root@dlp ~]#
dnf -y install centos-release-rabbitmq-38
[root@dlp ~]#
sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-Messaging-rabbitmq.repo
[root@dlp ~]#
[root@dlp ~]# dnf --enablerepo=centos-rabbitmq-38,powertools -y install rabbitmq-server systemctl enable --now rabbitmq-server |
[2] | If Firewalld is running, allow RabbitMQ port. |
[root@dlp ~]# firewall-cmd --add-port=5672/tcp --permanent success [root@dlp ~]# firewall-cmd --reload success |
[3] | 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" ... # 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" ... |
[4] | 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" ... |
[5] | 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" ... |
Sponsored Link |