RibbitMQ-安装
本文主要介绍RibbitMQ的安装
RabbitMQ依赖于Erlang,因此首先需要安装Erlang环境。分别下载erlang-26.2.5-1.el7.x86_64.rpm
、rabbitmq-server-4.0.3-1.el8.noarch.rpm
官网地址:https://www.rabbitmq.com/
官网文档:https://www.rabbitmq.com/docs/which-erlang
源码地址:https://github.com/rabbitmq/rabbitmq-server
下载地址:https://github.com/rabbitmq/rabbitmq-server
Erlang地址:https://github.com/rabbitmq/erlang-rpm
Erlang下载:https://github.com/rabbitmq/erlang-rpm/releases
安装erlang环境
# 查看系统环境
cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
cd /soft
# 安装erlang
rpm -ivh erlang-26.2.5-1.el7.x86_64.rpm
# 查看是否安装成功
erl -version
Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 14.2.5
安装RibbitMQ
cd /soft
# 安装ribbitmq
rpm -ivh rabbitmq-server-4.0.3-1.el8.noarch.rpm
# 编辑配置文件 (末尾的点不能少)
vim /etc/rabbitmq/rabbitmq.config
[
{rabbit, [{tcp_listeners, [{"172.17.123.108", 5672}]}]},
{rabbitmq_management, [
{listener, [{port,15672}, {ssl, false}]}
]}
].
# 启动rabbitmq
systemctl start rabbitmq-server
# 查看rabbitmq状态
systemctl status rabbitmq-server
# 暂停rabbitmq
systemctl stop rabbitmq-server
# 设置rabbitmq服务开机自启动
systemctl enable rabbitmq-server
# 关闭rabbitmq服务
systemctl stop rabbitmq-server
# 重启rabbitmq服务
systemctl restart rabbitmq-server
Status of node rabbit@iZ2zee1rd1atxz543lbnbcZ ...
Runtime
OS PID: 7056
OS: Linux
Uptime (seconds): 15
Is under maintenance?: false
RabbitMQ version: 4.0.3
RabbitMQ release series support status: see https://www.rabbitmq.com/release-information
Node name: rabbit@iZ2zee1rd1atxz543lbnbcZ
Erlang configuration: Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
Crypto library: OpenSSL 1.1.1k 25 Mar 2021
Erlang processes: 302 used, 1048576 limit
Scheduler run queue: 1
Cluster heartbeat timeout (net_ticktime): 60
Plugins
Enabled plugin file: /etc/rabbitmq/enabled_plugins
Enabled plugins:
Data directory
Node data directory: /var/lib/rabbitmq/mnesia/rabbit@iZ2zee1rd1atxz543lbnbcZ
Raft data directory: /var/lib/rabbitmq/mnesia/rabbit@iZ2zee1rd1atxz543lbnbcZ/quorum/rabbit@iZ2zee1rd1atxz543lbnbcZ
Config files
# 启动ribbitweb管理界面
rabbitmq-plugins enable rabbitmq_management
查看ribbitmq的信息
# 查看当前进程状态
rabbitmq-diagnostics status
Status of node rabbit@iZ2zee1rd1atxz543lbnbcZ ...
Runtime
OS PID: 8618
OS: Linux
Uptime (seconds): 722
Is under maintenance?: false
RabbitMQ version: 4.0.3
RabbitMQ release series support status: see https://www.rabbitmq.com/release-information
Node name: rabbit@iZ2zee1rd1atxz543lbnbcZ
Erlang configuration: Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
Crypto library: OpenSSL 1.1.1k 25 Mar 2021
Erlang processes: 397 used, 1048576 limit
Scheduler run queue: 1
Cluster heartbeat timeout (net_ticktime): 60
Plugins
Enabled plugin file: /etc/rabbitmq/enabled_plugins
Enabled plugins:
* rabbitmq_management
* rabbitmq_management_agent
* rabbitmq_web_dispatch
* amqp_client
* cowboy
* cowlib
* oauth2_client
* jose
Data directory
Node data directory: /var/lib/rabbitmq/mnesia/rabbit@iZ2zee1rd1atxz543lbnbcZ
Raft data directory: /var/lib/rabbitmq/mnesia/rabbit@iZ2zee1rd1atxz543lbnbcZ/quorum/rabbit@iZ2zee1rd1atxz543lbnbcZ
Config files
* /etc/rabbitmq/rabbitmq.config
Log file(s)
* /var/log/rabbitmq/rabbit@iZ2zee1rd1atxz543lbnbcZ.log
* <stdout>
Alarms
(none)
Memory
Total memory used: 0.0708 gb
Calculation strategy: rss
Memory high watermark setting: 0.6 of available memory, computed to: 9.6659 gb
code: 0.0208 gb (26.1 %)
allocated_unused: 0.0196 gb (24.62 %)
other_system: 0.0168 gb (21.18 %)
other_proc: 0.0156 gb (19.64 %)
other_ets: 0.0025 gb (3.15 %)
atom: 0.0011 gb (1.37 %)
plugins: 0.0011 gb (1.37 %)
metrics: 0.0008 gb (1.06 %)
binary: 0.0005 gb (0.63 %)
mgmt_db: 0.0003 gb (0.43 %)
msg_index: 0.0002 gb (0.2 %)
mnesia: 0.0001 gb (0.09 %)
metadata_store: 0.0 gb (0.06 %)
connection_other: 0.0 gb (0.04 %)
quorum_ets: 0.0 gb (0.03 %)
metadata_store_ets: 0.0 gb (0.01 %)
quorum_queue_procs: 0.0 gb (0.0 %)
quorum_queue_dlx_procs: 0.0 gb (0.0 %)
stream_queue_procs: 0.0 gb (0.0 %)
stream_queue_replica_reader_procs: 0.0 gb (0.0 %)
connection_readers: 0.0 gb (0.0 %)
connection_writers: 0.0 gb (0.0 %)
connection_channels: 0.0 gb (0.0 %)
queue_procs: 0.0 gb (0.0 %)
stream_queue_coordinator_procs: 0.0 gb (0.0 %)
reserved_unallocated: 0.0 gb (0.0 %)
File Descriptors
Total: 0, limit: 32671
Free Disk Space
Low free disk space watermark: 0.05 gb
Free disk space: 62.298 gb
Totals
Connection count: 0
Queue count: 0
Virtual host count: 1
Listeners
Interface: [::], port: 15672, protocol: http, purpose: HTTP API
Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Interface: 172.17.123.108, port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
# 配置文件地址
/etc/rabbitmq/rabbitmq.config
# 数据文件地址
/var/lib/rabbitmq/mnesia/rabbit@iZ2zee1rd1atxz543lbnbcZ
# 日志文件地址
/var/log/rabbitmq/rabbit@iZ2zee1rd1atxz543lbnbcZ.log
创建一个新的用户
# 创建用户
rabbitmqctl add_user xiaoyuan xiaoyuan
# 设置权限
rabbitmqctl set_permissions -p / xiaoyuan ".*" ".*" ".*"
# 设置为管理员
rabbitmqctl set_user_tags xiaoyuan administrator
访问RibbitMQ的WEB界面 ‘http://8.140.224.210:15672/’ 账号&密码 guest/guest
使用新建管理员账号 xiaoyuan/xiaoyuan