RabbitMQ is a complete standards based on the AMQP protocol, you can take the enterprise messaging system. It follows the open source Mozilla Public License Agreement, the use of industrial-grade Erlang implementation of the Message Queue (MQ) server, Rabbit MQ is based on the Erlang OTP platform.
First, related materials
Erlang installation package: otp_win64_18.1
Erlang official website Download: http://www.erlang.org/downloads
RabbitMQ installation package: rabbitmq-server-3.6.5
RabbitMQ official website Download: http://www.rabbitmq.com/download.html
Second, install Erlang
Download otp_win64_18.1, all click "Next", you can.
After installation is complete, add a system environment variables:
Third, install RabbitMQ
You can use the default installation options, default listening port is 5672
Four, RabbitMQ configuration
1) activation RabbitMQ's Management Plugin
Use RabbitMQ management plug-in, you can better visual way to view Rabbit MQ server instance state.
命令:"C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.5\sbin\rabbitmq-plugins.bat" enable rabbitmq_management
After installation is complete, you need to restart the service to take effect.
命令:net stop RabbitMQ && net start RabbitMQ
2) Create a user, password, binding role
Use rabbitmqctl console command (located in C: \ Program Files \ RabbitMQ Server \ rabbitmq_server-3.6.5 \ sbin>) to create users, passwords, and other binding authority.
rabbitmq user management include increasing users, delete users, view the list of users, change user passwords.
View existing users and user roles: rabbitmqctl.bat list_users
New users: rabbitmqctl.bat add_user username password
Assign user roles: rabbitmqctl.bat set_user_tags username administrator
The same user can configure multiple roles: rabbitmqctl.bat set_user_tags username tag1 tag2 ...
Change the user password: rabbitmqctl change_password userName newPassword
Delete User: rabbitmqctl.bat delete_user username
Five, RabbitMQ Management Console
Default access address: http: // localhost: 15672, using the username and password login system
RabbitMQ management console can view all the information, including CRUD user permission settings, can be done in this page, you can also set policies (policy) based on business needs
Sixth, permission settings
According to official documents, user permission to refer to the user operating authority for exchange, queue, including configuring permissions and access permissions.
We configure permissions will affect the exchange, queue and delete statements.
Read and write permissions to take affect in the message queue, and sends a message queue, and binding of the exchange (Binding) operation to the exchange.
For example: the queue bound to an exchange, is required to have a queue write permission, read permission, and the exchange; exchange sends a message exchange required to have write permission; taken from the queue in the queue of data needs to have read permission .
设置用户权限:rabbitmqctl set_permissions -p VHostPath User ConfP WriteP ReadP
查看(指定hostpath)所有用户的权限信息:rabbitmqctl list_permissions [-p VHostPath]
查看指定用户的权限信息:rabbitmqctl list_user_permissions User
清除用户的权限信息:rabbitmqctl clear_permissions [-p VHostPath] User
七、知识点
1)RabbitMQ用户角色:
rabbitmq用户角色可分为五类:超级管理员, 监控者, 策略制定者, 普通管理者以及其他。
(1) 超级管理员(administrator)
可登陆管理控制台(启用management plugin的情况下),可查看所有的信息,并且可以对用户,策略(policy)进行操作。
(2) 监控者(monitoring)
可登陆管理控制台(启用management plugin的情况下),同时可以查看rabbitmq节点的相关信息(进程数,内存使用情况,磁盘使用情况等)
(3) 策略制定者(policymaker)
可登陆管理控制台(启用management plugin的情况下), 同时可以对policy进行管理。
(4) 普通管理者(management)
仅可登陆管理控制台(启用management plugin的情况下),无法看到节点信息,也无法对策略进行管理。
(5) 其他的(自定义名称)
无法登陆管理控制台,通常就是普通的生产者和消费者。
八、FAQ
1)重启RabbitMQ服务时提示
原因:5代表的是:不是系统管理员权限
解决方法:
使用管理员打开cmd再执行命令
参考材料:
https://www.cnblogs.com/ericli-ericli/p/5902270.html
http://www.rabbitmq.com/install-windows-manual.html