How to install RabbitMQ on Ubuntu

28/12/2020

In this post, we will see how we can install one of the most popular asynchronous messaging tools, RabbitMQ. According to their official website: “RabbitMQ is the most widely deployed open source message broker”, but what is messaging and being a message broker? Let’s find out.

Messaging

A message is a way of exchanging information between application, servers and processes. When two applications share data among themselves, they can decide when to react to it when they receive the data. To exchange data effectively, one application should be independent of another application. This independence part is where a message broker comes in.

Message Broker

A message broker is an application which stores messages for an application. Whenever an application wants to send data to another application, the app publishes the message onto the message broker. The message broker then finds out which queue this message belongs to, finds out the apps which are connected to that queue and so, those apps can now consume that message.

The message broker app, like RabbitMQ, is responsible for saving that message until there is a consumer for that message. Queues are just virtually infinite buffers which store message packets.

What is RabbitMQ

RabbitMQ is one of the most widely deployed open source message brokers. It is an implementation of the Advanced Message Queuing Protocol which is an open standard. Let’s get started by installing RabbitMQ on our Ubuntu-based machine.

Installing RabbitMQ

We will begin by updating the Ubuntu’s application toolset:

sudo apt-get update
sudo apt-get -y upgrade

Once this is done, we can enable the RabbitMQ application repository:

echo "deb http://www.rabbitmq.com/debian/ testing main" >> /etc/apt/sources.list

This command won’t produce any output:

Now, we can add the verification key of The RabbitMQ package:

curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add

This cmmand can take upto a few minutes to complete depending upo on the Internet speed:

We can again run the update command now:

apt-get update

We can now finally move on to downloading and installing RabbitMQ server:

sudo apt-get install rabbitmq-server

Let’s see the output for this command:

If you’re willing to manage maximum number of connection from the launch itself, edit the following RabbitMQ config file:

sudo nano /etc/default/rabbitmq-server

Enabling RabbitMQ Management Console

RabbitMQ Management Console is a very useful web application through which we can achieve many tasks very easily, like:

  • Manage users and their permissions and roles
  • Create new queues
  • Manage queues, monitor their consumption rate etc.
  • Purge data which is currently on queues
  • Send and receive messages
  • Memory usage against each queue and by the overall process

Run the following command to enable the RabbitMQ Management Console:

sudo rabbitmq-plugins enable rabbitmq_management

Once this is done, we can visit the following IP to access the RabbitMQ Management Console:

http://localhost:15672/

Once this is done, we can see that management plugin is enabled and consuole is up on above mentioned URL:

Default credentials for this is guest/guest. You can login and see what all operations we can perform:

Use following commands to manage the RabbitMQ server further:

# To start the service:
service rabbitmq-server start

# To stop the service:
service rabbitmq-server stop

# To restart the service:
service rabbitmq-server restart

# To check the status:
service rabbitmq-server status

Conclusion

In general, no manual configuration will be needed with RabbitMQ as it already comes packaged with production-grade configuration. In this lesson, we learned how we can install RabbitMQ and it’s management console.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

[Netbox] [Phần 2] Hướng dẫn tạo Organization trên Netbox

Phần Organization được sử dụng để khai báo các đối tượng khách hàng, vị trí địa lý của trung...
30/12/2020

[Graylog] [LAB] [Phần 2] Thu thập log của Linux thông qua graylog sidecar

Ở bài trước ta đã cấu hình Graylog 3.1 trên CentOS 7, ở bài này mình sẽ hướng dẫn cấu hình thu...
30/12/2020

Moodle [Part 2] – Cài đặt Moodle 3.8.1 trên CentOS7

Moodle là nền tảng học tập trực tuyến (LMS – Learning Management System) được sử dụng nhiều...
30/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024