最後更新: 2024-03-08
目錄
- Installation
Installation
Erlang
Before installing RabbitMQ, you must install a supported version of Erlang.
CentOS-derivative repositories provide Erlang versions that are typically out of date and
cannot be used to run latest RabbitMQ releases.
Team RabbitMQ produces a package stripped down to only provide those components needed to run RabbitMQ.
(Zero-dependency Erlang from RabbitMQ)
Zero-dependency Erlang from RabbitMQ
URL=https://github.com/rabbitmq/erlang-rpm
mkdir /usr/src/rabbitmq
cd /usr/src/rabbitmq
LINK="$URL/releases/download/v21.3.8.21/erlang-21.3.8.21-1.el7.x86_64.rpm"
wget $LINK
rpm -i erlang-26.2.2-1.el7.x86_64.rpm
Test
# To switch to Erlang shell, you can type the following command.
erl
rabbitmq-server 要的 package
yum install socat logrotate -y
rabbitmq-server
rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
https://github.com/rabbitmq/rabbitmq-server
Version
- 3.12.13 # Requires Erlang 25
- 3.7 # 最後支援 RHEL 6, 7 的 Version (V3.7 要 Erlang 21.3)
rpm -Uvh rabbitmq-server-3.7.28-1.el7.noarch.rpm
systemctl enable rabbitmq-server --now
systemctl status rabbitmq-server
Checking
rabbitmq-diagnostics ping
rabbitmq-diagnostics status
rabbitmq-diagnostics cluster_status
rabbitmq-diagnostics environment
Port
Checking
netstat -nlp | grep -beam -e epmd
346:tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 189585/beam.smp 750:tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 189626/epmd 1457:tcp6 0 0 :::5672 :::* LISTEN 189585/beam.smp 1659:tcp6 0 0 :::4369 :::* LISTEN 189626/epmd
beam.smp (5672)
By default, RabbitMQ will listen on port 5672 on all available interfaces.
/etc/rabbitmq/rabbitmq.conf
listeners.tcp.1 = 127.0.0.1:5672
systemctl restart rabbitmq-server
epmd (4369)
4369: epmd, a peer discovery service used by RabbitMQ nodes and CLI tools
/etc/rabbitmq/rabbitmq-env.conf
export ERL_EPMD_ADDRESS=127.0.0.1
distribution.listener (25672)
used for communication with other cluster members and CLI tools.
distribution.listener.interface = 127.0.0.1 distribution.listener.port_range.min = 25672 distribution.listener.port_range.max = 25672
Access Web Console
rabbitmq-plugins enable rabbitmq_management
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/
rabbitmqctl add_user admin StrongPassword
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
http://Your_Server_IP:15672/
Settings
/etc/rabbitmq/rabbitmq-env.conf
export RABBITMQ_NODENAME=rabbit@localhost
rabbitmq limit memory usage
The RabbitMQ server detects the total amount of RAM installed in the computer on startup and
when rabbitmqctl set_vm_memory_high_watermark fraction is executed.
By default, when the RabbitMQ server uses above 40% of the installed RAM,
it raises a memory alarm and blocks all connections.
Once the memory alarm has cleared normal service resumes.
(e.g. due to the server paging messages to disk or delivering them to clients)
* The limit does not prevent RabbitMQ nodes from using more than the computed limit,
it is merely the point at which publishers are throttled.
A value of 0 makes the memory alarm go off immediately and
thus disables all publishing (this may be useful if you wish to disable publishing globally;
(use rabbitmqctl set_vm_memory_high_watermark 0).
To prevent the memory alarm from going off at all, set some high multiplier such as 100.
Configuring the Absolute Memory Limit (or Threshold)
vm_memory_high_watermark.absolute = 1024MiB