1.前置工作
1.1 下载erlang和rabbitMQ
erlang-otp-OTP-27.1-0-g9ae2ef5.tar.gz
rabbitmq-server-generic-unix-4.0.2.tar.xz
2.安装系统依赖包
# ⾸先安装依赖包
yum install -y gcc gcc-c++ ncurses-devel unixODBC unixODBC-devel mesa-libGL-devel
freeglut-devel wxGTK3-devel --nogpgcheck
3.部署erlang和rabbitMQ
3.1 解压安装包
# 解压安装包
tar zxf $HOME/setup/erlang-otp-OTP-27.1-0-g9ae2ef5.tar.gz -C $HOME/setup/
# 解压 RabbitMQ 可直接使⽤
tar xf $HOME/setup/rabbitmq-server-generic-unix-4.0.2.tar.xz -C $HOME
mv rabbitmq_server-4.0.2 rabbitmq
4.配置erlang和rabbitMQ并验证
# 编译安装erlang
cd $HOME/setup/erlang-otp-83d009c/
./configure \
--prefix=$HOME/erlang-otp
# ========================
# 关注最后的是否为yes
checking for standard build of wxWidgets... yes
checking for wxwidgets 3.0 compatibility ... yes
checking for wxwidgets opengl support... yes
checking for GLintptr... yes
checking for GLintptrARB... yes
checking for GLchar... yes
checking for GLcharARB... yes
checking for GLhalfARB... yes
checking for GLint64EXT... yes
checking GLU Callbacks uses Tiger Style... no
checking if we can link wxwidgets programs... yes
checking if we can add -Werror=return-type to CFLAGS (via CFLAGS)... yes
checking if we can add -Werror=return-type to CXXFLAGS (via CFLAGS)... yes
configure: creating aarch64-unknown-linux-gnu/config.status
config.status: creating config.mk
config.status: creating c_src/Makefile
# ========================
# 编译安装
make && make install
# 验证erlang
cd $HOME/erlang-otp/bin/
./erl
Erlang/OTP 27 [erts-15.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit]
Eshell V15.1 (press Ctrl+G to abort, type help(). for help)
1> halt(). # 可退出
# 注:证明成功
5.配置环境变量
# erlang和rabbitMQ 环境变量
vi $HOME/.bashrc
export PATH=$PATH:$HOME/erlang-otp/bin
export PATH=$PATH:$HOME/rabbitmq/sbin
export PATH
source $HOME/.bashrc
5.启动rabbitMQ
# 启动rabbitMQ
rabbitmq-server -detached
6.查看rabbitMQ状态
# 查看rabbitMQ状态
rabbitmqctl status
# 提示如下:
Status of node rabbit@ecs-6ca1 ...
Runtime
OS PID: 197719
OS: Linux
Uptime (seconds): 10
Is under maintenance?: false
RabbitMQ version: 4.0.2
RabbitMQ release series support status: see https://www.rabbitmq.com/release-information
Node name: rabbit@ecs-6ca1
Erlang configuration: Erlang/OTP 27 [erts-15.1] [source] [64-bit] [smp:2:2] [ds:2:2:10]
[async-threads:1] [jit]
Crypto library: OpenSSL 1.1.1f 31 Mar 2020
Erlang processes: 298 used, 1048576 limit
Scheduler run queue: 1
Cluster heartbeat timeout (net_ticktime): 60
Plugins
Enabled plugin file: /root/rabbitmq/etc/rabbitmq/enabled_plugins
Enabled plugins:
Data directory
Node data directory: /root/rabbitmq/var/lib/rabbitmq/mnesia/rabbit@ecs-6ca1
Raft data directory: /root/rabbitmq/var/lib/rabbitmq/mnesia/rabbit@ecs-
6ca1/quorum/rabbit@ecs-6ca1
Config files
Log file(s)
* /root/rabbitmq/var/log/rabbitmq/[email protected]
* <stdout>
Alarms
(none)
Memory
Total memory used: 0.0923 gb
Calculation strategy: rss
Memory high watermark setting: 0.6 of available memory, computed to: 4.2861 gb
reserved_unallocated: 0.0376 gb (40.67 %)
code: 0.0162 gb (17.54 %)
other_proc: 0.0156 gb (16.91 %)
other_system: 0.0149 gb (16.11 %)
allocated_unused: 0.0041 gb (4.4 %)
other_ets: 0.0021 gb (2.31 %)
atom: 0.001 gb (1.03 %)
metrics: 0.0006 gb (0.68 %)
msg_index: 0.0001 gb (0.14 %)
mnesia: 0.0001 gb (0.08 %)
binary: 0.0 gb (0.04 %)
metadata_store: 0.0 gb (0.04 %)
quorum_ets: 0.0 gb (0.03 %)
plugins: 0.0 gb (0.01 %)
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 %)
connection_other: 0.0 gb (0.0 %)
queue_procs: 0.0 gb (0.0 %)
stream_queue_coordinator_procs: 0.0 gb (0.0 %)
mgmt_db: 0.0 gb (0.0 %)
File Descriptors
Total: 0, limit: 65438
Free Disk Space
Low free disk space watermark: 0.05 gb
Free disk space: 52.1926 gb
Totals
Connection count: 0
Queue count: 0
Virtual host count: 1
Listeners
Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool
communication
Interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
7.查看rabbitMQ进程
# 查看 rabbitMQ 进程
ps -ef|grep rabbit
# 提示如下:
root 197719 1 3 00:32 ? 00:00:01 /root/erlang-otp/lib/erlang/erts-15.1/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -pc unicode -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -sbwt none -sbwtdcpu none -sbwtdio none -B i -- -root /root/erlang-otp/lib/erlang -bindir /root/erlang-otp/lib/erlang/erts-15.1/bin -progname erl -- -home /root -- -pa -noshell -noinput -s rabbit boot -boot start_sasl -syslog logger [] -syslog syslog_error_logger false -kernel prevent_overlapping_partitions false -detached -noshell -noinput --
root 197750 197723 0 00:32 ? 00:00:00 /bin/sh -s rabbit_disk_monitor
8.配置rabbitMQ
# 验证后配置rabbitMQ
rabbitmqctl stop
# 提示如下:
Stopping and halting node rabbit@ecs-6ca1 ...
# 配置⽹⻚插件
rabbitmq-plugins enable rabbitmq_management
# 提示如下:
Enabling plugins on node rabbit@ecs-6ca1:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@ecs-6ca1...
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. # 提示重启服务
# 重启服务
rabbitmq-server -detached
rabbitmqctl status
# 提示如下:
Status of node rabbit@ecs-6ca1 ...
Runtime
OS PID: 197902
OS: Linux
Uptime (seconds): 7
Is under maintenance?: false
RabbitMQ version: 4.0.2
RabbitMQ release series support status: see https://www.rabbitmq.com/release-information
Node name: rabbit@ecs-6ca1
Erlang configuration: Erlang/OTP 27 [erts-15.1] [source] [64-bit] [smp:2:2] [ds:2:2:10]
[async-threads:1] [jit]
Crypto library: OpenSSL 1.1.1f 31 Mar 2020
Erlang processes: 390 used, 1048576 limit
Scheduler run queue: 1
Cluster heartbeat timeout (net_ticktime): 60
Plugins
Enabled plugin file: /root/rabbitmq/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: /root/rabbitmq/var/lib/rabbitmq/mnesia/rabbit@ecs-6ca1
Raft data directory: /root/rabbitmq/var/lib/rabbitmq/mnesia/rabbit@ecs-
6ca1/quorum/rabbit@ecs-6ca1
Config files
Log file(s)
* /root/rabbitmq/var/log/rabbitmq/[email protected]
* <stdout>
Alarms
(none)
Memory
Total memory used: 0.1047 gb
Calculation strategy: rss
Memory high watermark setting: 0.6 of available memory, computed to: 4.2861 gb
reserved_unallocated: 0.0436 gb (41.68 %)
code: 0.0188 gb (17.95 %)
other_proc: 0.0157 gb (14.99 %)
other_system: 0.0156 gb (14.94 %)
allocated_unused: 0.0059 gb (5.6 %)
other_ets: 0.0024 gb (2.31 %)
atom: 0.0011 gb (1.03 %)
metrics: 0.0006 gb (0.62 %)
plugins: 0.0005 gb (0.43 %)
mgmt_db: 0.0001 gb (0.13 %)
msg_index: 0.0001 gb (0.12 %)
mnesia: 0.0001 gb (0.07 %)
binary: 0.0001 gb (0.05 %)
metadata_store: 0.0 gb (0.03 %)
quorum_ets: 0.0 gb (0.02 %)
metadata_store_ets: 0.0 gb (0.01 %)
connection_other: 0.0 gb (0.0 %)
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 %)
File Descriptors
Total: 0, limit: 65438
Free Disk Space
Low free disk space watermark: 0.05 gb
Free disk space: 52.1925 gb
Totals
Connection count: 0
Queue count: 0
Virtual host count: 1
Listeners
Interface: [::], port: 15672, protocol: http, purpose: HTTP API # 多出来web⻚⾯
Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool
communication
Interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
9.页面访问权限配置
# 可访问地址
http://192.168.19.128:15672/
默认⽤户:guest # ⽆法正常远程登录
默认密码:guest
9.1 权限配置
# 远程访问配置注意点:
# 默认⽹⻚是不允许访问的,需要增加⼀个⽤户修改⼀下权限,代码如下:
# 添加⽤户(⽤户名 密码):rabbitmqctl add_user <username> <password>
rabbitmqctl add_user <username> <password>
# 提示创建
Adding user "<username>" ...
# Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more.
# 添加权限(最⾼权限):
rabbitmqctl set_permissions -p "/" <username> ".*" ".*" ".*"
# Setting permissions for user "<username>" in vhost "/" ...
# 修改⽤户⻆⾊(管理员):rabbitmqctl set_user_tags <username> administrator
rabbitmqctl set_user_tags <username> administrator
# Setting tags for user "<username>" to [administrator] ...
# 然后就可以远程访问了,接下来可直接配置其他⽤户权限等信息。
标签:...,4.0,RibbitMQ,部署,0.0,rabbitmq,gb,rabbit,erlang
From: https://www.cnblogs.com/imTxl/p/18512171