RabbitMQ adalah perangkat lunak perantara pesan sumber terbuka yang mengimplementasikan Protokol Antrian Pesan Lanjutan (AMQP). RabbitMQ bekerja dengan menerima pesan dari penerbit (aplikasi yang menerbitkannya) dan mengarahkannya ke konsumen (aplikasi yang memprosesnya).
Konten Terkait
- Cara menginstal Erlang di FreeBSD 13
- Cara menginstal RabbitMQ di FreeBSD 13
- Cara menginstal Erlang di Ubuntu 20.04
- Cara menginstal Erlang pada OpenSUSE Leap 15.3
- Cara menginstal Erlang di Fedora 35
- Cara menginstal RabbitMQ di Fedora 35
- Cara menginstal Erlang di Rocky Linux/Alma Linux/CentOS 8
- Cara Memasang dan Mengaktifkan Repositori EPEL di Rocky Linux/Centos 8
Prasyarat
Untuk mengikuti, pastikan Anda memiliki yang berikut
- Server/workstation OpenSUSE Leap yang diperbarui
- Akses ke internet
- Akses root atau pengguna dengan akses Sudo
Daftar Isi
- Memperbarui sistem
- Menginstal Erlang
- Menginstal RabbitMQ
- Memulai dan mengaktifkan layanan server rabbitmq
- Opsional:Mengaktifkan Dasbor RabbitMQ
- Perintah Manajemen Pengguna RabbitMQ Dasar
1. Memperbarui sistem
Sebelum melanjutkan, pastikan paket server sudah diperbarui. Gunakan perintah ini untuk mencapainya:
sudo zypper ref
sudo zypper up -y
2. Memasang Erlang
Paket RabbitMQ ditemukan di repo OpenSUSE default. Instal menggunakan perintah ini:
sudo zypper install -y erlang
Ini adalah output di server saya
~> sudo zypper install -y erlang
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following recommended package was automatically selected:
psqlODBC
The following 6 NEW packages are going to be installed:
erlang erlang-epmd libltdl7 libpq5 psqlODBC unixODBC
6 new packages to install.
Overall download size: 28.9 MiB. Already cached: 0 B. After the operation, additional 52.3 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package libltdl7-2.4.6-3.4.1.x86_64 (1/6), 32.6 KiB ( 38.6 KiB unpacked)
Retrieving: libltdl7-2.4.6-3.4.1.x86_64.rpm ....................................................................................[done]
Retrieving package libpq5-14.0-5.3.1.x86_64 (2/6), 172.2 KiB (679.2 KiB unpacked)
Retrieving: libpq5-14.0-5.3.1.x86_64.rpm .......................................................................................[done]
Retrieving package unixODBC-2.3.6-3.2.1.x86_64 (3/6), 306.1 KiB ( 1.0 MiB unpacked)
Retrieving: unixODBC-2.3.6-3.2.1.x86_64.rpm ....................................................................................[done]
Retrieving package psqlODBC-13.01.0000-3.9.1.x86_64 (4/6), 405.1 KiB ( 1.3 MiB unpacked)
Retrieving: psqlODBC-13.01.0000-3.9.1.x86_64.rpm ..................................................................[done (16.3 KiB/s)]
Retrieving package erlang-22.3-1.26.x86_64 (5/6), 27.9 MiB ( 49.2 MiB unpacked)
Retrieving: erlang-22.3-1.26.x86_64.rpm ...........................................................................[done (29.6 MiB/s)]
Retrieving package erlang-epmd-22.3-1.26.x86_64 (6/6), 145.4 KiB ( 55.3 KiB unpacked)
Retrieving: erlang-epmd-22.3-1.26.x86_64.rpm ......................................................................[done (16.4 KiB/s)]
Checking for file conflicts: ...................................................................................................[done]
(1/6) Installing: libltdl7-2.4.6-3.4.1.x86_64 ..................................................................................[done]
(2/6) Installing: libpq5-14.0-5.3.1.x86_64 .....................................................................................[done]
(3/6) Installing: unixODBC-2.3.6-3.2.1.x86_64 ..................................................................................[done]
(4/6) Installing: psqlODBC-13.01.0000-3.9.1.x86_64 .............................................................................[done]
Additional rpm output:
odbcinst: Driver installed. Usage count increased to 1.
Target directory is /etc/unixODBC
(5/6) Installing: erlang-22.3-1.26.x86_64 ......................................................................................[done]
(6/6) Installing: erlang-epmd-22.3-1.26.x86_64 .................................................................................[done]
Additional rpm output:
Created symlink /etc/systemd/system/sockets.target.wants/epmd.socket -> /usr/lib/systemd/system/epmd.socket.
4. Memasang Rabbitmq
RabbitMQ dapat ditemukan di repo OpenSUSE default. Instal menggunakan perintah ini:
sudo zypper install -y rabbitmq-server
Anda akan melihat output yang mirip dengan ini:
~> sudo zypper install -y rabbitmq-server
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 3 NEW packages are going to be installed:
rabbitmq-server rabbitmq-server-plugins socat
3 new packages to install.
Overall download size: 15.2 MiB. Already cached: 0 B. After the operation, additional 16.4 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package socat-1.7.3.2-4.10.x86_64 (1/3), 227.4 KiB (710.5 KiB unpacked)
Retrieving: socat-1.7.3.2-4.10.x86_64.rpm ......................................................................................[done]
Retrieving package rabbitmq-server-plugins-3.8.11-3.3.3.x86_64 (2/3), 3.6 MiB ( 3.7 MiB unpacked)
Retrieving: rabbitmq-server-plugins-3.8.11-3.3.3.x86_64.rpm ..........................................................[done (954 B/s)]
Retrieving package rabbitmq-server-3.8.11-3.3.3.x86_64 (3/3), 11.4 MiB ( 12.0 MiB unpacked)
Retrieving: rabbitmq-server-3.8.11-3.3.3.x86_64.rpm ...............................................................[done (16.6 KiB/s)]
Checking for file conflicts: ...................................................................................................[done]
(1/3) Installing: socat-1.7.3.2-4.10.x86_64 ....................................................................................[done]
(2/3) Installing: rabbitmq-server-plugins-3.8.11-3.3.3.x86_64 ..................................................................[done]
(3/3) Installing: rabbitmq-server-3.8.11-3.3.3.x86_64 ..........................................................................[done]
Detail paket dapat ditanyakan menggunakan rpm
perintah dengan opsi -qi
.
$ rpm -qi rabbitmq-server Name : rabbitmq-server Version : 3.8.23 Release : 1.fc34 Architecture: x86_64 Install Date: Fri 12 Nov 2021 07:14:47 PM UTC Group : Unspecified Size : 16503697 License : MPLv1.1 Signature : RSA/SHA256, Wed 20 Oct 2021 03:42:27 PM UTC, Key ID 1161ae6945719a39 Source RPM : rabbitmq-server-3.8.23-1.fc34.src.rpm Build Date : Wed 20 Oct 2021 03:16:35 PM UTC Build Host : buildvm-x86-11.iad2.fedoraproject.org Packager : Fedora Project Vendor : Fedora Project URL : https://www.rabbitmq.com/ Bug URL : https://bugz.fedoraproject.org/rabbitmq-server Summary : The RabbitMQ server Description : RabbitMQ is an implementation of AMQP, the emerging standard for high performance enterprise messaging. The RabbitMQ server is a robust and scalable implementation of an AMQP broker.
5. Memulai dan mengaktifkan layanan server rabbitmq
Mulai layanan
sudo systemctl start rabbitmq-server
Kemudian periksa statusnya untuk mengonfirmasi berjalannya
~> sudo systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2021-11-14 17:46:33 UTC; 10s ago
Main PID: 2478 (beam.smp)
Status: "Initialized"
Tasks: 24 (limit: 8192)
CGroup: /system.slice/rabbitmq-server.service
├─2474 /bin/sh /usr/sbin/rabbitmq-server
├─2478 /usr/lib64/erlang/erts-10.7/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128>
├─2489 erl_child_setup 65535
├─2538 inet_gethost 4
└─2539 inet_gethost 4
Nov 14 17:46:26 ip-10-2-40-188 systemd[1]: Starting RabbitMQ broker...
Nov 14 17:46:33 ip-10-2-40-188 systemd[1]: rabbitmq-server.service: Supervising process 2478 which is not our child. We'll most likely not notice when it exits.
Nov 14 17:46:33 ip-10-2-40-188 systemd[1]: Started RabbitMQ broker.
Sekarang Anda dapat mengaktifkannya saat boot
sudo systemctl enable rabbitmq-server
Anda bisa mendapatkan status internal rabbitmq:
$ sudo rabbitmqctl status
6. Opsional:Mengaktifkan Dasbor RabbitMQ
Gunakan rabbitmq-plugins enable
perintah untuk mengaktifkan dasbor manajemen:
~> sudo rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node [email protected]:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to [email protected]
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
set 3 plugins.
Offline change; changes will take effect at broker restart.
Layanan web sedang mendengarkan pada port 15672
$ ss -tunlp | grep 15672
tcp LISTEN 0 128 0.0.0.0:15672 0.0.0.0:*
Jika Anda memiliki layanan Firewalld yang aktif, izinkan porta 5672
dan 15672
$ ss -tunlp | grep 15672
tcp LISTEN 0 1024 0.0.0.0:15672 0.0.0.0:*
Akses dengan membuka URL http://[server IP]:15672
seperti http://127.0.0.1:15672
Secara default, tamu pengguna ada dan hanya dapat terhubung dari localhost
. Anda dapat masuk dengan pengguna ini secara lokal dengan sandi “tamu”
Untuk bisa login di jaringan, buat user admin seperti di bawah ini:
$ sudo rabbitmqctl add_user admin Secr3t Adding user "admin" ... Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more. $ sudo rabbitmqctl set_user_tags admin administrator Setting tags for user "admin" to [administrator] ...
Masuk dengan nama pengguna admin ini dan kata sandi yang diberikan. Anda akan melihat antarmuka yang mirip dengan di bawah ini:
7. Perintah Manajemen Pengguna RabbitMQ Dasar
Hapus Pengguna:
sudo rabbitmqctl delete_user user
Ubah Kata Sandi Pengguna:
sudo rabbitmqctl change_password user strongpassword
Buat Virtualhost baru:
sudo rabbitmqctl add_vhost /my_vhost
Daftar Virtualhost yang tersedia:
sudo rabbitmqctl list_vhosts
Hapus host virtual:
sudo rabbitmqctl delete_vhost /myvhost
Berikan izin pengguna untuk vhost:
sudo rabbitmqctl set_permissions -p /myvhost user ".*" ".*" ".*"
Daftar izin vhost:
sudo rabbitmqctl list_permissions -p /myvhost
Untuk membuat daftar izin pengguna:
rabbitmqctl list_user_permissions user
Hapus izin pengguna:
rabbitmqctl clear_permissions -p /myvhost user
Kesimpulan
Kami telah berhasil menginstal Rabbitmq dalam panduan ini