RabbitMQ是基于AMQP协议构建的开源消息代理软件。
什么是RabbitMQ ?
RabbitMQ是一种开源消息代理软件(有时称为面向消息的中间件),最初实现了高级消息队列协议(AMQP),并已通过插件体系结构进行了扩展,以支持面向流文本的消息协议(STOMP),MQ遥测传输(MQTT)和其他协议。
RabbitMQ服务器程序是用Erlang编程语言编写的,并建立在Open Telecom Platform框架上,用于集群和故障转移。与代理交互的客户端库适用于所有主要编程语言,包括Java,Erlang和.NET Framework。
环境规格:
- CPU :4C
- 内存:4GB
- 储存空间:50 GB
- 作业系统:AnolisOS 8.4
- 主机名:anolis8
- IP地址:192.168.100.86
第一步:更新您的Linux服务器
[root@localhost ~]# dnf update -y
... ...
已升级:
NetworkManager-1:1.36.0-9.0.1.an8_6.x86_64 NetworkManager-libnm-1:1.36.0-9.0.1.an8_6.x86_64
NetworkManager-team-1:1.36.0-9.0.1.an8_6.x86_64 NetworkManager-tui-1:1.36.0-9.0.1.an8_6.x86_64
anolis-gpg-keys-8.6-4.an8.noarch anolis-release-8.6-4.an8.x86_64
anolis-repos-8.6-4.an8.x86_64 audit-3.0.7-2.an8.2.x86_64
audit-libs-3.0.7-2.an8.2.x86_64 authselect-1.2.2-3.0.1.an8.x86_64
authselect-libs-1.2.2-3.0.1.an8.x86_64 bash-4.4.20-4.an8_6.x86_64
bpftool-4.18.0-372.32.1.an8_6.x86_64 c-ares-1.13.0-6.an8.x86_64
ca-certificates-2022.2.54-80.2.an8_6.noarch chkconfig-1.19.1-1.an8.x86_64
coreutils-8.30-12.an8.x86_64 coreutils-common-8.30-12.an8.x86_64
cpio-2.12-11.0.1.an8.x86_64 cronie-1.5.2-6.an8.x86_64
cronie-anacron-1.5.2-6.an8.x86_64 crypto-policies-20211116-1.gitae470d6.an8.noarch
crypto-policies-scripts-20211116-1.gitae470d6.an8.noarch cryptsetup-libs-2.3.7-2.an8.x86_64
curl-7.61.1-22.an8_6.4.x86_64 cyrus-sasl-lib-2.1.27-6.an8_5.x86_64
dbus-1:1.12.8-18.an8_6.1.x86_64 dbus-common-1:1.12.8-18.an8_6.1.noarch
dbus-daemon-1:1.12.8-18.an8_6.1.x86_64 dbus-libs-1:1.12.8-18.an8_6.1.x86_64
dbus-tools-1:1.12.8-18.an8_6.1.x86_64 device-mapper-8:1.02.181-3.0.1.an8_6.2.x86_64
device-mapper-event-8:1.02.181-3.0.1.an8_6.2.x86_64 device-mapper-event-libs-8:1.02.181-3.0.1.an8_6.2.x86_64
device-mapper-libs-8:1.02.181-3.0.1.an8_6.2.x86_64 device-mapper-persistent-data-0.9.0-6.an8.x86_64
dmidecode-1:3.3-4.an8.x86_64 dracut-049-202.git20220511.an8_6.x86_64
dracut-config-rescue-049-202.git20220511.an8_6.x86_64 dracut-network-049-202.git20220511.an8_6.x86_64
dracut-squash-049-202.git20220511.an8_6.x86_64 elfutils-debuginfod-client-0.186-1.an8.x86_64
elfutils-default-yama-scope-0.186-1.an8.noarch elfutils-libelf-0.186-1.an8.x86_64
elfutils-libs-0.186-1.an8.x86_64 epel-release-8-18.el8.noarch
ethtool-2:5.13-1.an8.x86_64 expat-2.2.5-8.an8_6.3.x86_64
file-5.33-20.an8.x86_64 file-libs-5.33-20.an8.x86_64
filesystem-3.8-6.an8.x86_64 firewalld-0.9.3-13.0.1.an8.noarch
firewalld-filesystem-0.9.3-13.0.1.an8.noarch fuse-2.9.7-15.an8.x86_64
fuse-common-3.3.0-15.an8.x86_64 fuse-libs-2.9.7-15.an8.x86_64
gawk-4.2.1-4.an8.x86_64 glib2-2.56.4-158.0.1.an8.x86_64
gnupg2-2.2.20-3.an8_6.x86_64 gnupg2-smime-2.2.20-3.an8_6.x86_64
gnutls-3.6.16-5.0.1.an8_6.x86_64 gobject-introspection-1.56.1-1.0.1.an8.x86_64
gpgme-1.13.1-11.0.1.an8.x86_64 grub2-common-1:2.02-123.0.2.an8_6.8.noarch
grub2-pc-1:2.02-123.0.2.an8_6.8.x86_64 grub2-pc-modules-1:2.02-123.0.2.an8_6.8.noarch
grub2-tools-1:2.02-123.0.2.an8_6.8.x86_64 grub2-tools-extra-1:2.02-123.0.2.an8_6.8.x86_64
grub2-tools-minimal-1:2.02-123.0.2.an8_6.8.x86_64 grubby-8.40-42.0.1.an8.x86_64
gzip-1.9-13.an8_5.x86_64 hdparm-9.54-4.an8.x86_64
hostname-3.20-6.0.1.an8.x86_64 hwdata-0.314-8.12.0.2.an8.noarch
ima-evm-utils-1.3.2-12.0.1.an8_4.x86_64 info-6.5-7.0.1.an8.x86_64
initscripts-10.00.17-1.an8.x86_64 iproute-5.15.0-4.an8_6.1.x86_64
iptables-1.8.4-22.0.2.an8.1.x86_64 iptables-ebtables-1.8.4-22.0.2.an8.1.x86_64
iptables-libs-1.8.4-22.0.2.an8.1.x86_64 iputils-20180629-9.0.1.an8.x86_64
iwl100-firmware-39.31.5.1-108.an8_6.1.noarch iwl1000-firmware-1:39.31.5.1-108.an8_6.1.noarch
iwl105-firmware-18.168.6.1-108.an8_6.1.noarch iwl135-firmware-18.168.6.1-108.an8_6.1.noarch
iwl2000-firmware-18.168.6.1-108.an8_6.1.noarch iwl2030-firmware-18.168.6.1-108.an8_6.1.noarch
iwl3160-firmware-1:25.30.13.0-108.an8_6.1.noarch iwl3945-firmware-15.32.2.9-108.an8_6.1.noarch
iwl4965-firmware-228.61.2.24-108.an8_6.1.noarch iwl5000-firmware-8.83.5.1_1-108.an8_6.1.noarch
iwl5150-firmware-8.24.2.2-108.an8_6.1.noarch iwl6000-firmware-9.221.4.1-108.an8_6.1.noarch
iwl6000g2a-firmware-18.168.6.1-108.an8_6.1.noarch iwl6050-firmware-41.28.5.1-108.an8_6.1.noarch
iwl7260-firmware-1:25.30.13.0-108.an8_6.1.noarch jansson-2.14-1.an8.x86_64
kernel-headers-4.18.0-372.32.1.an8_6.x86_64 kernel-tools-4.18.0-372.32.1.an8_6.x86_64
kernel-tools-libs-4.18.0-372.32.1.an8_6.x86_64 kexec-tools-2.0.24-6.0.2.an8.x86_64
kmod-25-19.an8.x86_64 kmod-libs-25-19.an8.x86_64
kpartx-0.8.4-28.0.1.an8_6.2.x86_64 less-530-1.0.1.an8.x86_64
libaio-0.3.112-1.0.1.an8.x86_64 libarchive-3.3.3-3.0.1.an8_5.x86_64
libassuan-2.5.1-3.0.1.an8.x86_64 libblkid-2.32.1-35.0.1.an8.x86_64
libbpf-0.4.0-3.an8.x86_64 libcap-2.48-2.an8.x86_64
libcap-ng-0.7.11-1.an8.x86_64 libcomps-0.1.18-1.an8.x86_64
libcurl-7.61.1-22.an8_6.4.x86_64 libdb-5.3.28-42.0.1.an8.x86_64
libdb-utils-5.3.28-42.0.1.an8.x86_64 libdrm-2.4.108-1.an8.x86_64
libedit-3.1-23.20170329cvs.0.1.an8.x86_64 libestr-0.1.10-1.0.1.an8.x86_64
libfastjson-0.99.9-1.0.1.an8.x86_64 libfdisk-2.32.1-35.0.1.an8.x86_64
libffi-3.1-23.0.1.an8.x86_64 libgcrypt-1.8.5-7.an8_6.x86_64
libibverbs-37.2-1.0.1.an8.x86_64 libksba-1.3.5-8.0.1.an8_6.x86_64
libldb-2.4.1-1.0.1.an8.x86_64 libmetalink-0.1.3-7.0.1.an8.x86_64
libmnl-1.0.4-6.0.1.an8.x86_64 libmount-2.32.1-35.0.1.an8.x86_64
libmspack-0.7-0.3.alpha.0.1.an8.4.x86_64 libndp-1.7-6.0.1.an8.x86_64
libnfsidmap-1:2.3.3-51.0.1.an8.x86_64 libnftnl-1.1.5-5.an8.x86_64
libpcap-14:1.9.1-5.0.1.an8.x86_64 libpciaccess-0.14-1.0.1.an8.x86_64
libpipeline-1.5.0-2.0.1.an8.x86_64 libpwquality-1.4.4-3.0.1.an8.x86_64
libreport-filesystem-2.9.5-15.0.3.an8.x86_64 libseccomp-2.5.2-1.0.1.an8.x86_64
libsecret-0.18.6-1.0.1.an8.x86_64 libsemanage-2.9-9.an8_6.x86_64
libsigsegv-2.11-5.0.1.an8.x86_64 libsmartcols-2.32.1-35.0.1.an8.x86_64
libssh-0.9.6-3.an8.x86_64 libssh-config-0.9.6-3.an8.noarch
libsss_autofs-2.6.2-4.an8_6.1.x86_64 libsss_certmap-2.6.2-4.an8_6.1.x86_64
libsss_idmap-2.6.2-4.an8_6.1.x86_64 libsss_nss_idmap-2.6.2-4.an8_6.1.x86_64
libsss_sudo-2.6.2-4.an8_6.1.x86_64 libsysfs-2.1.0-25.0.1.an8.x86_64
libtalloc-2.3.3-1.an8.x86_64 libtdb-1.4.4-1.an8.x86_64
libtevent-0.11.0-0.an8.x86_64 libtirpc-1.3.2-1.0.1.an8.x86_64
libtool-ltdl-2.4.6-25.0.2.an8.x86_64 libunistring-0.9.9-3.0.1.an8.x86_64
libuser-0.62-24.0.1.an8.x86_64 libutempter-1.1.6-14.0.1.an8.x86_64
libuuid-2.32.1-35.0.1.an8.x86_64 libxml2-2.9.7-13.0.1.an8_6.1.x86_64
linux-firmware-20220210-108.git6342082c.an8_6.noarch lshw-B.02.19.2-6.0.1.an8.x86_64
lsscsi-0.32-3.0.1.an8.x86_64 lua-libs-5.3.4-12.0.2.an8.x86_64
lvm2-8:2.03.14-3.0.1.an8_6.2.x86_64 lvm2-libs-8:2.03.14-3.0.1.an8_6.2.x86_64
lz4-libs-1.8.3-3.an8.x86_64 man-db-2.7.6.1-18.an8.x86_64
memstrack-0.1.11-1.0.1.an8.x86_64 microcode_ctl-4:20220207-1.20220510.1.0.1.an8_6.x86_64
ncurses-6.1-9.20180224.an8.x86_64 ncurses-base-6.1-9.20180224.an8.noarch
ncurses-libs-6.1-9.20180224.an8.x86_64 nettle-3.4.1-7.0.1.an8.x86_64
nftables-1:0.9.3-25.an8.x86_64 numactl-libs-2.0.12-13.an8.x86_64
open-vm-tools-11.3.5-1.an8_6.1.x86_64 openldap-2.4.46-18.an8.x86_64
openssh-8.0p1-13.0.1.an8.x86_64 openssh-clients-8.0p1-13.0.1.an8.x86_64
openssh-server-8.0p1-13.0.1.an8.x86_64 openssl-pkcs11-0.4.10-2.0.1.an8.x86_64
os-prober-1.74-9.0.1.an8.x86_64 pam-1.3.1-16.0.1.an8_6.1.x86_64
parted-3.2-39.0.1.an8.x86_64 passwd-0.80-4.0.1.an8.x86_64
pcre-8.42-6.an8.x86_64 pcre2-10.32-3.0.1.an8_6.x86_64
pcre2-devel-10.32-3.0.1.an8_6.x86_64 pcre2-utf16-10.32-3.0.1.an8_6.x86_64
pcre2-utf32-10.32-3.0.1.an8_6.x86_64 perf-4.18.0-372.32.1.an8_6.x86_64
perl-Carp-1.42-396.0.1.an8.noarch perl-Digest-1.17-395.0.1.an8.noarch
perl-Digest-MD5-2.55-396.0.1.an8.x86_64 perl-Errno-1.28-421.0.1.an8.x86_64
perl-Exporter-5.72-396.0.1.an8.noarch perl-File-Path-2.15-2.0.1.an8.noarch
perl-File-Temp-0.230.600-1.0.1.an8.noarch perl-Getopt-Long-1:2.50-4.0.1.an8.noarch
perl-HTTP-Tiny-0.074-1.0.1.an8.noarch perl-IO-1.38-421.0.1.an8.x86_64
perl-IO-Socket-IP-0.39-5.0.1.an8.noarch perl-MIME-Base64-3.15-396.0.1.an8.x86_64
perl-Net-SSLeay-1.88-2.module+an8.6.0+10739+55eb7d62.x86_64 perl-Pod-Escapes-1:1.07-395.0.1.an8.noarch
perl-Pod-Perldoc-3.28-396.0.1.an8.noarch perl-Pod-Simple-1:3.35-395.0.1.an8.noarch
perl-Pod-Usage-4:1.69-395.0.1.an8.noarch perl-Term-ANSIColor-4.06-396.0.1.an8.noarch
perl-Term-Cap-1.17-395.0.1.an8.noarch perl-Text-ParseWords-3.30-395.0.1.an8.noarch
perl-Text-Tabs+Wrap-2013.0523-395.0.1.an8.noarch perl-Time-Local-1:1.280-1.0.1.an8.noarch
perl-constant-1.33-396.0.1.an8.noarch perl-interpreter-4:5.26.3-421.0.1.an8.x86_64
perl-libnet-3.11-3.0.1.an8.noarch perl-libs-4:5.26.3-421.0.1.an8.x86_64
perl-macros-4:5.26.3-421.0.1.an8.x86_64 perl-parent-1:0.237-1.0.1.an8.noarch
perl-podlators-4.11-1.0.1.an8.noarch platform-python-3.6.8-47.0.1.an8_6.x86_64
platform-python-pip-9.0.3-22.an8.noarch plymouth-0.9.4-11.20200615git1e36e30.0.1.an8.x86_64
plymouth-core-libs-0.9.4-11.20200615git1e36e30.0.1.an8.x86_64 plymouth-scripts-0.9.4-11.20200615git1e36e30.0.1.an8.x86_64
policycoreutils-2.9-19.an8.x86_64 polkit-0.115-13.an8.2.x86_64
polkit-libs-0.115-13.an8.2.x86_64 python3-firewall-0.9.3-13.0.1.an8.noarch
python3-gpg-1.13.1-11.0.1.an8.x86_64 python3-libcomps-0.1.18-1.an8.x86_64
python3-libs-3.6.8-47.0.1.an8_6.x86_64 python3-linux-procfs-0.7.0-1.an8.noarch
python3-nftables-1:0.9.3-25.an8.x86_64 python3-perf-4.18.0-372.32.1.an8_6.x86_64
python3-pip-wheel-9.0.3-22.an8.noarch python3-rpm-4.14.3-24.0.1.an8_6.x86_64
python3-unbound-1.7.3-17.an8.x86_64 rdma-core-37.2-1.0.1.an8.x86_64
rng-tools-6.14-6.git.b2b7934e.an8_6.x86_64 rpm-4.14.3-24.0.1.an8_6.x86_64
rpm-build-libs-4.14.3-24.0.1.an8_6.x86_64 rpm-libs-4.14.3-24.0.1.an8_6.x86_64
rpm-plugin-selinux-4.14.3-24.0.1.an8_6.x86_64 rpm-plugin-systemd-inhibit-4.14.3-24.0.1.an8_6.x86_64
rsyslog-8.2102.0-7.an8_6.1.x86_64 sed-4.5-5.0.1.an8.x86_64
selinux-policy-3.14.3-95.0.1.an8_6.4.noarch selinux-policy-targeted-3.14.3-95.0.1.an8_6.4.noarch
setup-2.12.2-6.0.1.an8.noarch shadow-utils-2:4.6-16.an8.x86_64
sqlite-libs-3.26.0-16.an8_6.x86_64 sssd-client-2.6.2-4.an8_6.1.x86_64
sssd-common-2.6.2-4.an8_6.1.x86_64 sssd-kcm-2.6.2-4.an8_6.1.x86_64
sssd-nfs-idmap-2.6.2-4.an8_6.1.x86_64 sudo-1.8.29-8.an8.x86_64
systemd-239-58.0.4.an8_6.8.x86_64 systemd-libs-239-58.0.4.an8_6.8.x86_64
systemd-pam-239-58.0.4.an8_6.8.x86_64 systemd-udev-239-58.0.4.an8_6.8.x86_64
tar-2:1.30-5.0.2.an8.x86_64 tuned-2.18.0-2.0.1.an8_6.1.noarch
tzdata-2022f-1.an8.noarch unbound-libs-1.7.3-17.an8.x86_64
util-linux-2.32.1-35.0.1.an8.x86_64 vim-minimal-2:8.0.1763-19.0.1.an8_6.4.x86_64
virt-what-1.18-13.0.1.an8.x86_64 which-2.21-17.an8.x86_64
xfsprogs-5.0.0-10.0.3.an8.x86_64 xkeyboard-config-2.28-1.0.1.an8.noarch
xz-5.2.4-4.an8_6.x86_64 xz-libs-5.2.4-4.an8_6.x86_64
已安装:
NetworkManager-initscripts-updown-1:1.36.0-9.0.1.an8_6.noarch grub2-tools-efi-1:2.02-123.0.2.an8_6.8.x86_64 kernel-4.18.0-372.32.1.an8_6.x86_64
kernel-core-4.18.0-372.32.1.an8_6.x86_64 kernel-devel-4.18.0-372.32.1.an8_6.x86_64 kernel-modules-4.18.0-372.32.1.an8_6.x86_64
psmisc-23.1-5.an8.x86_64 tpm2-tss-2.3.2-4.an8.x86_64
完毕!
[root@localhost ~]# cat /etc/anolis-release
Anolis OS release 8.6
[root@localhost ~]# uname -a
Linux localhost.localdomain 4.18.0-372.32.1.an8_6.x86_64 #1 SMP Fri Oct 28 12:06:23 CST 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# reboot
Linux服务器上安装EPEL Yum存储库
RabbitMQ服务器所需的某些软件包可在EPEL(企业Linux的额外软件包) yum存储库中获得。
因此,在安装RabbitMQ之前,您需要在Linux服务器上启用/安装EPEL yum存储库。
rpm -Uvh --force --nodeps https://kojipkgs.fedoraproject.org/packages/epel-release/8/17.el8/noarch/epel-release-8-17.el8.noarch.rpm
#列出所有存储库
dnf repolist all
#启用epel源
dnf config-manager --set-enable epel
#查看epel源的状态
dnf repolist epel
#清空缓存
dnf clean all
#建立元数据缓存
dnf makecache
Linux服务器上安装RabbitMQ官方Yum存储库
要安装最新版本的RabbitMQ服务器,您可以编译首选Linux发行版的源代码
也可以添加RabbitMQ官方yum存储库以从预编译的RPM软件包中安装RabbitMQ软件。
执行以下命令以在Linux服务器上安装RabbitMQ yum存储库。
在/etc/yum.repos.d/下创建rabbitmq.repo文件,内容填写如下
为RabbitMQ 和 Modern Erlang添加YUM存储库
# In /etc/yum.repos.d/rabbitmq.repo
##
## Zero dependency Erlang RPM
##
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/8/$basearch
repo_gpgcheck=1
enabled=1
# Cloudsmith's repository key and RabbitMQ package signing key
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
[rabbitmq_erlang-noarch]
name=rabbitmq_erlang-noarch
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/8/noarch
repo_gpgcheck=1
enabled=1
# Cloudsmith's repository key and RabbitMQ package signing key
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/8/SRPMS
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
gpgcheck=0
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
##
## RabbitMQ Server
##
[rabbitmq_server]
name=rabbitmq_server
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/rpm/el/8/$basearch
repo_gpgcheck=1
enabled=1
# Cloudsmith's repository key and RabbitMQ package signing key
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
[rabbitmq_server-noarch]
name=rabbitmq_server-noarch
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/rpm/el/8/noarch
repo_gpgcheck=1
enabled=1
# Cloudsmith's repository key and RabbitMQ package signing key
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
[rabbitmq_server-source]
name=rabbitmq_server-source
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/rpm/el/8/SRPMS
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key
gpgcheck=0
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
更新yum包元数据
yum update -y
[root@localhost yum.repos.d]# yum -q makecache -y --disablerepo='*' --enablerepo='rabbitmq_erlang-noarch' --enablerepo='rabbitmq_server-noarch'
导入 GPG 公钥 0xCC4BBE5B:
Userid: "Cloudsmith Package (rabbitmq/rabbitmq-erlang) <support@cloudsmith.io>"
指纹: A16A 4251 6F6A 691B C1FF 5621 E495 BB49 CC4B BE5B
来自: https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
导入 GPG 公钥 0x6026DFCA:
Userid: "RabbitMQ Release Signing Key <info@rabbitmq.com>"
指纹: 0A9A F211 5F46 87BD 2980 3A20 6B73 A36E 6026 DFCA
来自: https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
导入 GPG 公钥 0x26208342:
Userid: "Cloudsmith Package (rabbitmq/rabbitmq-server) <support@cloudsmith.io>"
指纹: C072 C960 4725 BAA2 18E1 F247 9F45 87F2 2620 8342
来自: https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key
导入 GPG 公钥 0x6026DFCA:
Userid: "RabbitMQ Release Signing Key <info@rabbitmq.com>"
指纹: 0A9A F211 5F46 87BD 2980 3A20 6B73 A36E 6026 DFCA
来自: https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
从标准库中安装依赖项
[root@localhost yum.repos.d]# yum install socat logrotate -y
软件包 logrotate-3.14.0-4.an8.x86_64 已安装。
依赖关系解决。
============================================================================================================================================================================
软件包 架构 版本 仓库 大小
============================================================================================================================================================================
安装:
socat x86_64 1.7.4.1-1.an8 AppStream 322 k
事务概要
============================================================================================================================================================================
安装 1 软件包
总下载:322 k
安装大小:1.2 M
下载软件包:
socat-1.7.4.1-1.an8.x86_64.rpm 1.2 MB/s | 322 kB 00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 1.2 MB/s | 322 kB 00:00
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
准备中 : 1/1
安装 : socat-1.7.4.1-1.an8.x86_64 1/1
运行脚本: socat-1.7.4.1-1.an8.x86_64 1/1
验证 : socat-1.7.4.1-1.an8.x86_64 1/1
已安装:
socat-1.7.4.1-1.an8.x86_64
完毕!
然后,安装最新的Erlang 和 RabbitMQ:
## install RabbitMQ and zero dependency Erlang from the above repositories,
## ignoring any versions provided by the standard repositories
[root@localhost yum.repos.d]# yum install --repo rabbitmq_erlang --repo rabbitmq_server-noarch erlang rabbitmq-server
Repository epel is listed more than once in the configuration
rabbitmq_erlang 277 B/s | 659 B 00:02
rabbitmq_server-noarch 279 B/s | 659 B 00:02
依赖关系解决。
============================================================================================================================================================================
软件包 架构 版本 仓库 大小
============================================================================================================================================================================
安装:
erlang x86_64 25.2-1.el8 rabbitmq_erlang 20 M
rabbitmq-server noarch 3.11.5-1.el8 rabbitmq_server-noarch 17 M
事务概要
============================================================================================================================================================================
安装 2 软件包
总下载:37 M
安装大小:58 M
确定吗?[y/N]: y
下载软件包:
(1/2): rabbitmq-server-3.11.5-1.el8.noarch.rpm 1.6 MB/s | 17 MB 00:10
(2/2): erlang-25.2-1.el8.x86_64.rpm 1.3 MB/s | 20 MB 00:15
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 2.4 MB/s | 37 MB 00:15
rabbitmq_erlang 1.2 kB/s | 1.3 kB 00:01
导入 GPG 公钥 0xCC4BBE5B:
Userid: "Cloudsmith Package (rabbitmq/rabbitmq-erlang) <support@cloudsmith.io>"
指纹: A16A 4251 6F6A 691B C1FF 5621 E495 BB49 CC4B BE5B
来自: https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
确定吗?[y/N]: y
导入公钥成功
rabbitmq_erlang 1.2 kB/s | 3.1 kB 00:02
导入 GPG 公钥 0x6026DFCA:
Userid: "RabbitMQ Release Signing Key <info@rabbitmq.com>"
指纹: 0A9A F211 5F46 87BD 2980 3A20 6B73 A36E 6026 DFCA
来自: https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
确定吗?[y/N]: y
导入公钥成功
rabbitmq_server-noarch 1.2 kB/s | 1.3 kB 00:01
导入 GPG 公钥 0x26208342:
Userid: "Cloudsmith Package (rabbitmq/rabbitmq-server) <support@cloudsmith.io>"
指纹: C072 C960 4725 BAA2 18E1 F247 9F45 87F2 2620 8342
来自: https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key
确定吗?[y/N]: y
导入公钥成功
rabbitmq_server-noarch 51 B/s | 3.1 kB 01:02
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc 的 GPG 公钥(0x6026DFCA)已安装
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
准备中 : 1/1
安装 : erlang-25.2-1.el8.x86_64 1/2
运行脚本: rabbitmq-server-3.11.5-1.el8.noarch 2/2
安装 : rabbitmq-server-3.11.5-1.el8.noarch 2/2
运行脚本: rabbitmq-server-3.11.5-1.el8.noarch 2/2
[/usr/lib/tmpfiles.d/rabbitmq-server.conf:1] Line references path below legacy directory /var/run/, updating /var/run/rabbitmq → /run/rabbitmq; please update the tmpfiles.d/ drop-in file accordingly.
验证 : erlang-25.2-1.el8.x86_64 1/2
验证 : rabbitmq-server-3.11.5-1.el8.noarch 2/2
已安装:
erlang-25.2-1.el8.x86_64 rabbitmq-server-3.11.5-1.el8.noarch
完毕!
启动RabbitMQ,查看RabbitMQ服务的状态
[root@localhost yum.repos.d]# systemctl status rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@localhost yum.repos.d]# systemctl start rabbitmq-server.service
[root@localhost yum.repos.d]# systemctl status rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2023-01-05 16:29:42 CST; 2s ago
Main PID: 6701 (beam.smp)
Tasks: 29 (limit: 23636)
Memory: 110.0M
CGroup: /system.slice/rabbitmq-server.service
├─6701 /usr/lib64/erlang/erts-13.1.3/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 1>
├─6715 erl_child_setup 32768
├─6744 /usr/lib64/erlang/erts-13.1.3/bin/epmd -daemon
├─6769 /usr/lib64/erlang/erts-13.1.3/bin/inet_gethost 4
├─6770 /usr/lib64/erlang/erts-13.1.3/bin/inet_gethost 4
└─6773 /bin/sh -s rabbit_disk_monitor
1月 05 16:29:38 localhost.localdomain rabbitmq-server[6701]: Doc guides: https://rabbitmq.com/documentation.html
1月 05 16:29:38 localhost.localdomain rabbitmq-server[6701]: Support: https://rabbitmq.com/contact.html
1月 05 16:29:38 localhost.localdomain rabbitmq-server[6701]: Tutorials: https://rabbitmq.com/getstarted.html
1月 05 16:29:38 localhost.localdomain rabbitmq-server[6701]: Monitoring: https://rabbitmq.com/monitoring.html
1月 05 16:29:38 localhost.localdomain rabbitmq-server[6701]: Logs: /var/log/rabbitmq/rabbit@localhost.log
1月 05 16:29:38 localhost.localdomain rabbitmq-server[6701]: /var/log/rabbitmq/rabbit@localhost_upgrade.log
1月 05 16:29:38 localhost.localdomain rabbitmq-server[6701]: <stdout>
1月 05 16:29:38 localhost.localdomain rabbitmq-server[6701]: Config file(s): (none)
1月 05 16:29:42 localhost.localdomain rabbitmq-server[6701]: Starting broker... completed with 0 plugins.
1月 05 16:29:42 localhost.localdomain systemd[1]: Started RabbitMQ broker.
安装RabbitMQ管理界面
尽管RabbitMQ软件包已经包含CLI(命令行)工具来管理RabbitMQ服务器。
但是,您也可以选择安装RabbitMQ管理UI来执行基于GUI的管理。
执行以下命令在Linux服务器上安装RabbitMQ管理UI。
1.启用网页版后台管理插件:
rabbitmq-plugins enable rabbitmq_management
[root@localhost yum.repos.d]# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@localhost:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@localhost...
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
started 3 plugins.
2.新建一个用户名为admin,密码为admin的管理员,并授予管理员(administrator)权限。
rabbitmqctl add_user admin admin
rabbitmqctl set_user_tags admin administrator
[root@localhost yum.repos.d]# rabbitmqctl add_user admin admin
Adding user "admin" ...
Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more.
[root@localhost yum.repos.d]# rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...
3.设置admin可以使用的虚机权限。
rabbitmqctl add_vhost admin
rabbitmqctl set_permissions -p admin admin "." "." ".*"
[root@localhost yum.repos.d]# rabbitmqctl add_vhost admin
Adding vhost "admin" ...
[root@localhost yum.repos.d]# rabbitmqctl set_permissions -p admin admin ".*" ".*" ".*"
Setting permissions for user "admin" in vhost "admin" ...
3.1用户管理
查看所有用户
rabbitmqctl list_users
[root@localhost yum.repos.d]# rabbitmqctl list_users
Listing users ...
user tags
admin [administrator]
guest [administrator]
添加一个用户
rabbitmqctl add_user admin admin
配置权限
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
查看用户权限
rabbitmqctl list_user_permissions admin
[root@localhost yum.repos.d]# rabbitmqctl list_user_permissions admin
Listing permissions for user "admin" ...
vhost configure write read
admin .* .* .*
设置tag
rabbitmqctl set_user_tags admin administrator
删除用户(安全起见,删除默认用户)
rabbitmqctl delete_user guest
[root@localhost yum.repos.d]# rabbitmqctl delete_user guest
Deleting user "guest" ...
[root@localhost yum.repos.d]# rabbitmqctl list_users
Listing users ...
user tags
admin [administrator]
4.插件管理:
插件列表:
rabbitmq-plugins list
启动插件:
rabbitmq-plugins enable XXX (XXX为插件名)
停用插件:
rabbitmq-plugins disable XXX
5.打开后台web管理界面:http://192.168.100.91:15672,刚才我们设置了admin用户,所以可以使用admin登录,也可以使用默认账号和密码都是guest登录。进入管理界面后可以看到:
image.png
我们可以在后台管理用户、队列等信息。
6.修改RabbitMQ默认端口
RabbitMQ默认开启了几个端口:
4369:erlang发现口
5672:client端通信口,客户端要连接RabbitMQ服务时要用到
15672:后台管理界面ui端口,进入管理后台时访问url如:http://localhost:15672/
25672:server间内部通信口
有时候在生产环境下,我们出于安全等原因希望修改掉默认的端口号。
我们安装新版的RabbitMQ后,发现找不到它的配置文件,按常理,服务的端口开发都可以在配置文件里配置的。但是事实上RabbitMQ并没有生成配置文件,需要我们手动添加配置文件。
官方建议配置文件的位置:/etc/rabbitmq/rabbitmq.conf
我们现在要做的是把默认端口5672改成56720,并且允许远程访问。把web管理默认端口15672改成56271。只需如下配置:
7.其他配置
我们可以到官网地址:https://www.rabbitmq.com/configure.html,了解RabbitMQ的性能优化方面的配置。
RabbitMQ启动出错:- unable to connect to epmd on xxxx: timeout (timed out)
因为本机主机名到IP地址的解析对应不起来;
vim /etc/hosts
192.168.100.251 test-web2
保存退出,再次启动
rpm包安装
安装依赖,安装依赖前已经安装好了epel源
[root@anolis8 ~]# yum install socat logrotate -y
Repository epel is listed more than once in the configuration
上次元数据过期检查:0:42:58 前,执行于 2023年01月06日 星期五 11时02分53秒。
软件包 logrotate-3.14.0-4.an8.x86_64 已安装。
依赖关系解决。
============================================================================================================================================================================
软件包 架构 版本 仓库 大小
============================================================================================================================================================================
安装:
socat x86_64 1.7.4.1-1.an8 AppStream 322 k
事务概要
============================================================================================================================================================================
安装 1 软件包
总下载:322 k
安装大小:1.2 M
下载软件包:
socat-1.7.4.1-1.an8.x86_64.rpm 1.3 MB/s | 322 kB 00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 1.3 MB/s | 322 kB 00:00
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
准备中 : 1/1
安装 : socat-1.7.4.1-1.an8.x86_64 1/1
运行脚本: socat-1.7.4.1-1.an8.x86_64 1/1
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-6.0.0-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
验证 : socat-1.7.4.1-1.an8.x86_64 1/1
已安装:
socat-1.7.4.1-1.an8.x86_64
完毕!
下载rpm包
先到RabbitMQ官网看下版本对应关系。
https://www.rabbitmq.com/which-erlang.html
RabbitMQ下载地址:
https://www.rabbitmq.com/install-rpm.html#downloads
erlang下载地址:
https://github.com/rabbitmq/erlang-rpm/releases
当前最新版rabbitmq-server是rabbitmq-server-3.11.5-1.el8.noarch.rpm,对应版Erlang是erlang-25.1.2-1.el8.x86_64.rpm。分别在Github和RabbitMQ官网下载对应的版本的rpm包。
上传好rpm包后,接下来我们使用rpm进行安装:
[root@anolis8 ~]# rpm -ivh erlang-25.1.2-1.el8.x86_64.rpm
警告:erlang-25.1.2-1.el8.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID cc4bbe5b: NOKEY
Verifying... ################################# [100%]
准备中... ################################# [100%]
正在升级/安装...
1:erlang-25.1.2-1.el8 ################################# [100%]
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-6.0.0-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
[root@anolis8 ~]# rpm -ivh rabbitmq-server-3.11.5-1.el8.noarch.rpm
警告:rabbitmq-server-3.11.5-1.el8.noarch.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 6026dfca: NOKEY
Verifying... ################################# [100%]
准备中... ################################# [100%]
正在升级/安装...
1:rabbitmq-server-3.11.5-1.el8 ################################# [100%]
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-6.0.0-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
[/usr/lib/tmpfiles.d/rabbitmq-server.conf:1] Line references path below legacy directory /var/run/, updating /var/run/rabbitmq → /run/rabbitmq; please update the tmpfiles.d/ drop-in file accordingly.
- 我因为升级了 系统核心版本 所以会有一些提示
查看rabbitmq-server.service状态,并尝试启动rabbitmq-server.service服务
[root@anolis8 ~]# systemctl status rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@anolis8 ~]# systemctl start rabbitmq-server.service
[root@anolis8 ~]# systemctl status rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2023-01-06 11:50:34 CST; 19s ago
Main PID: 58131 (beam.smp)
Tasks: 29 (limit: 24888)
Memory: 105.4M
CGroup: /system.slice/rabbitmq-server.service
├─58131 /usr/lib64/erlang/erts-13.1.2/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl >
├─58167 erl_child_setup 32768
├─58198 /usr/lib64/erlang/erts-13.1.2/bin/epmd -daemon
├─58225 /usr/lib64/erlang/erts-13.1.2/bin/inet_gethost 4
├─58226 /usr/lib64/erlang/erts-13.1.2/bin/inet_gethost 4
└─58229 /bin/sh -s rabbit_disk_monitor
1月 06 11:50:31 anolis8 rabbitmq-server[58131]: Doc guides: https://rabbitmq.com/documentation.html
1月 06 11:50:31 anolis8 rabbitmq-server[58131]: Support: https://rabbitmq.com/contact.html
1月 06 11:50:31 anolis8 rabbitmq-server[58131]: Tutorials: https://rabbitmq.com/getstarted.html
1月 06 11:50:31 anolis8 rabbitmq-server[58131]: Monitoring: https://rabbitmq.com/monitoring.html
1月 06 11:50:31 anolis8 rabbitmq-server[58131]: Logs: /var/log/rabbitmq/rabbit@anolis8.log
1月 06 11:50:31 anolis8 rabbitmq-server[58131]: /var/log/rabbitmq/rabbit@anolis8_upgrade.log
1月 06 11:50:31 anolis8 rabbitmq-server[58131]: <stdout>
1月 06 11:50:31 anolis8 rabbitmq-server[58131]: Config file(s): (none)
1月 06 11:50:34 anolis8 rabbitmq-server[58131]: Starting broker... completed with 0 plugins.
1月 06 11:50:34 anolis8 systemd[1]: Started RabbitMQ broker.
开启网页版后台管理插件和其他配置同上边的操作;
Config file(s): (none) 表示在/etc/rabbitmq/下没有rabbitmq.conf配置文件
配置文件的例子下载地址:
https://github.com/rabbitmq/rabbitmq-server/blob/master/deps/rabbit/docs/rabbitmq.conf.example
网友评论