Kamis, 27 April 2023

RABBITMQ-install

 

Install RabbitMQ on Ubuntu 20.04

https://cloudinfrastructureservices.co.uk/install-rabbitmq-on-ubuntu-server-20-04/

By default, RabbitMQ is not available in the Ubuntu 20.04 default repository. So you will need to install the RabbitMQ repository to your system. Run the following command to install the RabbitMQ repository:

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | bash

Now, update the repository and install the RabbitMQ with the following command:

apt-get update -y
apt-get install rabbitmq-server -y

You can check the status of the RabbitMQ using the following command:

systemctl status  rabbitmq-server

You will get the following output:

● rabbitmq-server.service - RabbitMQ broker
     Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2021-12-02 09:17:12 UTC; 12s ago
   Main PID: 19117 (beam.smp)
      Tasks: 22 (limit: 2353)
     Memory: 87.0M
     CGroup: /system.slice/rabbitmq-server.service
             ├─19117 /usr/lib/erlang/erts-12.1.5/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 10485>
             ├─19128 erl_child_setup 32768
             ├─19168 /usr/lib/erlang/erts-12.1.5/bin/epmd -daemon
             ├─19188 inet_gethost 4
             └─19189 inet_gethost 4

Dec 02 09:17:09 server rabbitmq-server[19117]:   Doc guides:  https://rabbitmq.com/documentation.html
Dec 02 09:17:09 server rabbitmq-server[19117]:   Support:     https://rabbitmq.com/contact.html
Dec 02 09:17:09 server rabbitmq-server[19117]:   Tutorials:   https://rabbitmq.com/getstarted.html
Dec 02 09:17:09 server rabbitmq-server[19117]:   Monitoring:  https://rabbitmq.com/monitoring.html
Dec 02 09:17:09 server rabbitmq-server[19117]:   Logs: /var/log/rabbitmq/rabbit@server.log
Dec 02 09:17:09 server rabbitmq-server[19117]:         /var/log/rabbitmq/rabbit@server_upgrade.log
Dec 02 09:17:09 server rabbitmq-server[19117]:         <stdout>
Dec 02 09:17:09 server rabbitmq-server[19117]:   Config file(s): (none)
Dec 02 09:17:12 server rabbitmq-server[19117]:   Starting broker... completed with 0 plugins.
Dec 02 09:17:12 server systemd[1]: Started RabbitMQ broker.

Create an Administrative User

By default, RabbitMQ can be connected without any username or password. So it is a good idea to set an admin user and password to connect to the RabbitMQ.

You can create an administrator user, set a password, set an administrator tag and set permission using the following commands:

rabbitmqctl add_user admin securepassword
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

You can list all users permission using the following command:

rabbitmqctl list_permissions -p /

You will get the following output:

Listing permissions for vhost "/" ...
user	configure	write	read
guest	.*	.*	.*
admin	.*	.*	.*

Enable RabbitMQ Web UI

RabbitMQ provides a web based interface to manage the RabbitMQ instance. To access the RabbitMQ web interface, you will need to enable it first.

Run the following command to enable the RabbitMQ web interface:

rabbitmq-plugins enable rabbitmq_management

You will get the following output:

Enabling plugins on node rabbit@server:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@server...
The following plugins have been enabled:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch

started 3 plugins.

By default, the RabbitMQ web interface listens on port 15672. You can check it using the following command:

ss -tunelp | grep 15672

You will get the following output:

tcp   LISTEN 0      1024                           0.0.0.0:15672        0.0.0.0:*                                                                                users:(("beam.smp",pid=19117,fd=35)) uid:118 ino:57672 sk:19 <->

Access RabbitMQ Web Interface

Now, open your web browser and access the RabbitMQ web interface using the URL http://your-server-ip:15672. You should see the RabbitMQ login page:

rabbitMQ WEB interface

Provide your admin username, password and click on the Login button. You will be redirected to the RabbitMQ dashboard:

RabbitMQ dashboard

Tidak ada komentar:

Posting Komentar