In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "Windows installation and configuration of RabbitMQ server tutorial", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and study the "Windows installation and configuration of RabbitMQ server tutorial" bar!
RabbitMQ is a complete and reusable enterprise message system based on AMQP protocol standard. It follows the Mozilla Public License open source protocol, uses Erlang to implement an industrial-grade message queuing (MQ) server, and Rabbit MQ is built on the Erlang OTP platform.
To install the RabbitMQ server, you must first install the Erlang runtime environment.
Install Erlang
When installing Erlang, you should pay attention to the version of Erlang that the RabbityMQ installation depends on. Choose a version according to the requirements of RabbitMQ. Here, the version of RabbitMQ I want to install is 3.7.7, and the range of Erlang versions it depends on is
19.3.6.4 to 21.0.x, so I chose version OTP 20.3. Erlang download address. Download the Erlang installation package and install it directly.
Set the ERLANG_HOME environment variable
I have the default installation here, so the installation path for Erlang is:
C:\ Program Files\ erl9.3\ bin\ erl.exe
Click OK to add the ERLANG_HOME you just added to the system environment variable
Note: if you previously installed another version of Erlang, you need to uninstall and reinstall it.
Look for Erlang in the start menu, click launch to open the following interface, and Erlang will be installed successfully. Next, install RabbitMQ.
Install RabbitMQ
You can download the latest version of the RabbitMQ server installer, RabbitMQ download address, from RabbitMQ's official website. Here I download the latest officially recommended version of rabbitmq-server-3.7.7.exe, and then click default installation.
After RabbitMQ is installed, it runs in the background as windows service.
Set the RabbitMQ environment variable
After RabbitMQ is installed, type rabbitmq in the start menu and you will see three menus:
The three menus here provide commands to control Windows service. In order to be able to manipulate RabbitMQ services on any Windows command window, you need to add an environment variable to the system and configure it in the system's PHTH environment variable.
First add a RABBITQM_SERVER variable:
Then configure it in the system's path variable as follows:
This allows you to manipulate the RabbitMQ service in the CMD window started by windows administrator. You don't need to navigate to:
C:\ Program Files\ RabbitMQ Server\ rabbitmq_server-3.7.7\ sbin >
Install rabbitmq_management
Let's take a look at all the plug-ins for RabbtitMQ with the command:
C:\ WINDOWS\ system32 > rabbitmq-plugins list
See that RabbtitMQ lists many plug-ins.
We install the rabbitmq_management plug-in with the following command, which can visually view the status of the RabbitMQ server instance and manipulate the RabbitMQ server.
C:\ WINDOWS\ system32 > rabbitmq-plugins enable rabbitmq_management
After running the command, the following figure indicates that the installation is successful.
Now we type: http://localhost:15672 in the browser to see a login interface:
The interface after logging in using the default account guest/guest is as follows:
Enter http://localhost:15672/api/ in the browser and you can see the RabbitMQ Management HTTP API document, as shown below:
This allows you to view information about the status of the RabbitMQ server instance.
Users who manage rabbitmq_management
Check the current rabbitmq_management registered users with the command rabbitmqctl list_users
It is found that there is only one user guest, and its tag is administrator.
Then create a user under the command line, and the commands to create the user are:
Rabbitmqctl add_user [username] [password]
Now create a user for username=rabbit1 password=rabbit1 with the following command:
Rabbitmqctl add_user rabbit1 rabbit1
Created successfully:
Now take a look at how many users there are and run the command:
Rabbitmqctl list_users
A user rabbit1 is found in the user list, but the tag is empty. Use the command to set the tag for rabbit and set the command format for tag:
Rabbitmqctl set_user_tag [tag1] [tag2]...
You can set multiple tag for one user at a time, or you can set one.
Now rabbit1 has two tag, one is administrator, the other is none.
There are five tag to choose from, which are: administrator, monitoring,policymaker,management and none students who are interested can come here to understand the meaning of each tag. In fact, tag here represents permissions, administrator is the highest permission, none means no access, where the combination of administrator and none, permissions should be in line with high, ignore none, using the permissions of administrator. We use rabbit1/rabbit1 to log in to rabbitmq_management.
In fact, with the visual plug-in rabbitmq_management, a lot of things can be done in this plug-in, including creating users, creating switches (Exchange) and creating queues (Queque).
The basic configuration of Rabbit under windows has come to an end. For more and more advanced configurations, please refer to the official website. It is really convenient to have the rabbitmq_management plug-in. Let's start to create a client for testing.
test
Create two applications of type .net Core Console, one for sending messages and one for receiving messages.
1. Send side code: using System;using System.Text;using RabbitMQ.Client;namespace Q.Demo.Send {class Program {static void Main (string [] args) {var factory = new ConnectionFactory () {HostName = "localhost"} Using (var connection = factory.CreateConnection ()) using (var channel = connection.CreateModel ()) {channel.QueueDeclare (queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null) While (true) {var input = Console.ReadLine (); string message = input; var body = Encoding.UTF8.GetBytes (message) Channel.BasicPublish (exchange: ", routingKey:" hello ", basicProperties: null, body: body); Console.WriteLine (" [x] Sent {0} ", message) }} Console.WriteLine ("Press [enter] to exit."); Console.ReadLine ();}} 2.Receive side Code: using System;using System.Text;using RabbitMQ.Client;using RabbitMQ.Client.Events Namespace Q.Demo.Receive {class Program {static void Main (string [] args) {var factory = new ConnectionFactory () {HostName = "localhost"} Using (var connection = factory.CreateConnection ()) using (var channel = connection.CreateModel ()) {channel.QueueDeclare (queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null) Var consumer = new EventingBasicConsumer (channel); consumer.Received + = (model, ea) = > {var body = ea.Body; var message = Encoding.UTF8.GetString (body); Console.WriteLine ("[x] Received {0}", message);} Channel.BasicConsume (queue: "hello", autoAck: true, consumer: consumer); Console.WriteLine ("Press [enter] to exit."); Console.ReadLine ();}
The effect of running the input message is as follows:
Summary:
About the installation and basic setup steps of RabbitMQ under windows:
1. Install the corresponding version of Erlang and set the environment variable
two。 Install RabbitMQ
3. Set environment variabl
4. Install the plug-in rabbitmq_management
5. With the plug-in rabbitmq_management, a lot of things can be done in this visual plug-in.
Thank you for reading, the above is the content of the "tutorial on installing RabbitMQ server and configuration under Windows". After the study of this article, I believe you have a deeper understanding of the problem of installing RabbitMQ server and configuration tutorial under Windows, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.