RabbitMQ

Ports:

  • 5672: RabbitMQ-Server

  • 15672: RabbitMQ Web-Interface

Installation

RabbitMQ ist in Erlang geschrieben und benötigt dessen Runtime. RabbitMQ 3.10.0+ setzt auf Erlang 25+. Letzteres setzt auf OpenSSL 1.1, welches erst ab RHEL 8 zur Verfügung steht. Hier wird eine spezielle „Zero-Dependency“ Version von Erlang installiert:

## primary RabbitMQ signing key
rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
## modern Erlang repository
rpm --import 'https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key'
/etc/yum.repos.d/rabbitmq_erlang.repo
##
## Zero dependency Erlang
##

[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/8/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
/etc/yum.repos.d/rabbitmq_server.repo
##
## RabbitMQ server
##

[rabbitmq_server]
name=rabbitmq_server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/8/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_server-source]
name=rabbitmq_server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
dnf --quiet makecache -y --disablerepo='*' --enablerepo='rabbitmq_erlang' --enablerepo='rabbitmq_server'
dnf -y install socat logrotate
dnf -y install --repo rabbitmq_erlang --repo rabbitmq_server erlang rabbitmq-server
systemctl enable --now rabbitmq-server

Web-Interface aktivieren:

rabbitmq-plugins enable rabbitmq_management

Admin-User anlegen:

rabbitmqctl add_user rabbitmq-admin mypassword
rabbitmqctl set_user_tags rabbitmq-admin administrator
rabbitmqctl set_permissions --vhost / rabbitmq-admin ".*" ".*" ".*"

Port 15672/tcp öffnen.

Zugriff auf http://rabbitmq:15672/ (Name: „beam.smp“)

Version ermitteln:

rabbitmqctl status | grep RabbitMQ

Admin-Tool installieren:

dnf -y install python3

cd /usr/local/bin/
wget http://127.0.0.1:15672/cli/rabbitmqadmin
chmod +x rabbitmqadmin

Test des Admin-Tools:

rabbitmqadmin show overview

Test eines RabbitMQ-Servers

Python-Fragment zum Testen eines RabbitMQ-Servers. Siehe auch https://www.rabbitmq.com/tutorials/tutorial-one-python.html.

pip install pika --upgrade
test-rabbitmq
#!/usr/bin/env python
import pika

connection = pika.BlockingConnection(pika.URLParameters('amqps://user:password@rabbitmq:port/topacc'))
channel = connection.channel()
print(channel)

Built on 2023-01-27