RabbitMQ : Install2016/09/03 |
Install RabbitMQ which is the message broker software that implements AMQP (Advanced Message Queuing Protocol).
|
|
[1] | Install RabbitMQ. |
# Install from EPEL
[root@dlp ~]#
[root@dlp ~]# yum --enablerepo=epel -y install rabbitmq-server systemctl start rabbitmq-server [root@dlp ~]# systemctl enable 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 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 Creating user "serverworld" ... ...done. # show user list [root@dlp ~]# rabbitmqctl list_users Listing users ... guest [administrator] serverworld [] ...done. # changing password of a user is like follows [root@dlp ~]# rabbitmqctl change_password serverworld strongpassword Changing password for user "serverworld" ... ...done. # granting admin role to a user is like follows [root@dlp ~]# rabbitmqctl set_user_tags serverworld administrator Setting tags for user "serverworld" to [administrator] ... ...done. # deleting a user is like follows [root@dlp ~]# rabbitmqctl delete_user serverworld Deleting user "serverworld" ... ...done. |
[4] | To use RabbitMQ, add virtualhost, too. |
# rabbitmqctl add_vhost [vhost] [root@dlp ~]# rabbitmqctl add_vhost /my_vhost Creating vhost "/my_vhost" ... ...done. # show vhost list [root@dlp ~]# rabbitmqctl list_vhosts Listing vhosts ... / /my_vhost ...done. # deleting vhost is like follows [root@dlp ~]# rabbitmqctl delete_vhost /my_vhost Deleting vhost "/my_vhost" ... ...done. |
[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" ... ...done. # show permission for a vhost [root@dlp ~]# rabbitmqctl list_permissions -p /my_vhost Listing permissions in vhost "/my_vhost" ... serverworld .* .* .* ...done. # show permission of a specific user [root@dlp ~]# rabbitmqctl list_user_permissions serverworld Listing permissions for user "serverworld" ... /my_vhost .* .* .* ...done. # 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" ... ...done. |
Sponsored Link |
|