Install RabbitMQ under Windows and operate common commands (GO)

Source: Internet
Author: User
Tags rabbitmq

RABBITMQ is an enterprise messaging system that is complete and can be taken on a standard based on the AMQP protocol. It follows the Mozilla Public License Open Source protocol, an industrial-grade Message Queuing (MQ) server implemented with Erlang, and Rabbit MQ is built on the Erlang OTP platform.

1. InstallationErlang

So before installing RABBITMQ, you need to install Erlang first.

Small series use is otp_win64_18.1, need other version or 32-bit system, can go to the official website to download.

Click "Next" to do it all.

Some choose other installation method, may need to add the system environment variable (also check under the normal installation):

There is no better, no words to add it manually.

2. InstallationRabbitMQ

Download run rabbitmq-server-3.6.5, need other version or 32-bit system, can go to the official website to download.

The installation can still be done without changing the default.

Note: The default installation of the RABBITMQ listening port is 5672

3. Configure activation RabbitMQ ' s Management Plugin

With the RABBITMQ management plug-in, you can better visualize the status of your rabbit MQ server instances.

To open a command window:

Enter the command:

"C:\Program files\rabbitmq server\rabbitmq_server-3.6.5\sbin\rabbitmq-plugins.bat" Enable Rabbitmq_ Management 

In this way, the installation of the plug-in, is not able to use it? Don't worry, you need to restart the service before you can use the command:

net stop RabbitMQ && net start RabbitMQ

At this time, the result may appear:

"Error occurred: System error 5 has occurred . access denied. "

What the hell is this? Looked down, originally, 5 represents: Not system administrator permissions.

Problem Resolution: Use the Administrator to open cmd and execute this command:

Is this the end of it? Of course not.

Create user, password, bind role

Use the RABBITMQCTL console command (located in C:\Program FILES\RABBITMQ server\rabbitmq_server-3.6.5\sbin>) to create a user, password, bind permission, and so on.

Note: The installation path is different please look carefully.

RABBITMQ user management includes adding users, deleting users, viewing the list of users, and modifying user passwords.

To view the roles of existing users and users:

Rabbitmqctl.bat list_users

Add a new User:

Rabbitmqctl.bat add_user username Password

Now look at our current user ha:

There's no "[Administrator]" behind Eric.

What is this administrator for? This involves a user role issue:

As I understand it, RABBITMQ user roles can be categorized into five categories: Super Admins, supervisors, strategists, general managers, and others.

(1) Super Administrator (Administrator)

You can access the admin console (with management plugin enabled) to view all the information and to operate on the user, policy.

(2) Monitor (monitoring)

Login to the admin console (with management plugin enabled), while you can view information about the RABBITMQ node (number of processes, memory usage, disk usage, etc.)

(3) strategy-makers (policymaker)

You can log in to the management console (with management plugin enabled) and manage the policy.

(4) General Manager (Management)

You can only log in to the administration console (with management plugin enabled), you cannot see the node information, and you cannot manage the policy.

(5) Other

Unable to login to the management console, usually the average producer and consumer.

Well, we'll also turn Eric into a "super admin" role:

Rabbitmqctl.bat set_user_tags username Administrator

And then look at the results, ha:

Of course, in addition to the above administrator there are monitoring, policymaker, management, custom names, corresponding to the different roles described above.

Like us people, our role in addition to the company's employees, or parents of children, children's parents and so on, users can also have multiple roles, set up the way:

Rabbitmqctl.bat  set_user_tags  username tag1 tag2 ...

Well, now always feel that guest this is not safe (its default password is guest), want to change the password, good:

Rabbitmqctl Change_password UserName NewPassword

Some people may say, I just look at guest uncomfortable, I added a administrator user, just want to kill it, you can:

Rabbitmqctl.bat Delete_user username

At this point, there may be someone to ask: Command box is only a user, how do you operate ah? How to check the implementation of the situation AH/

Of course there are ways:

Use your browser to open http://localhost:15672 access the admin console for rabbit MQ and use the account you just created to log in to the system:

In fact, in addition to view all the information, the above command additions and deletions, permission settings, can be done on this page, but also according to business needs to set up policies (policy), the specific is not here wordy, we can look at the online post.

Permission Settings

The user has a role, that also requires permission settings Ah, don't worry, slow down:

According to the official document, the user right refers to the user's operation rights to Exchange,queue, including the configuration permission, read and Write permission.

We configure permissions to affect Exchange, queue claims, and deletions.

Read and Write permissions affect the fetching of messages from a queue, sending messages to exchange, and binding (binding) operations for queue and exchange.

For example, if you bind a queue to an exchange, you need to have write permissions for the queue, as well as the readable permissions for Exchange, the ability to send messages to Exchange requires the Write permission to Exchange, and the ability to fetch data from the queue with the Read permission of the queue

Permission-related commands are:

(1) Set user permissions

Rabbitmqctl set_permissions-p vhostpath User CONFP writep readp

(2) view (specify Hostpath) permissions information for all users

Rabbitmqctl list_permissions [-P Vhostpath]

(3) View permission information for a specified user

Rabbitmqctl list_user_permissions User

(4) Clear User's permission information

Rabbitmqctl clear_permissions [-P Vhostpath] User

Now the environment is set up, the user, the role, the authority all sets up, starts the code (principle collation, and the code to be continued)

Reference:

Installation Reference http://www.rabbitmq.com/install-windows-manual.html

Permission Content Reference http://www.rabbitmq.com/man/rabbitmqctl.1.man.html

Permissions command excerpt from https://my.oschina.net/hncscwc/blog/262246

Install RabbitMQ under Windows and operate common commands (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.