安装rabbitmq

栏目:云苍穹知识作者:金蝶来源:金蝶云社区发布:2024-09-23浏览:1

安装rabbitmq

1 安装

1.1 安装erlang

rabbitmq依赖erlang语言,需要先编译安装该软件,可以选择源码编译安装,rpm包安装等。

erlang和rabbitmq有版本之间的对应关系,参考官网查看他们之间版本的对应关系。

以下示例是选择源码安装

#!/bin/bash
#usage: sh installmq_master.sh
## ENV ##
source /etc/profile
pd=$PWD
##install otp##################################
cd $pd
otp_ver=23.3
tar zxf otp_src_23.3.tar.gz
cd $pd/otp_src_$otp_ver
export ERL_TOP=`pwd`
./configure
make
#make release_tests
#cd release/tests/test_server
#$ERL_TOP/bin/erl -s ts install -s ts smoke_test batch -s init stop
make install

1.2 安装rabbitmq

以下选择使用二进制的方式安装rabbitmq。

##Install rabbitMQ from Generic Binary Build###########

mq_ver=3.8.19
cd $pd
#xz -d rabbitmq-server-generic-unix-$mq_ver.tar.xz
tar xf rabbitmq-server-generic-unix-$mq_ver.tar
echo PATH=$PATH:$HOME/bin:$pd/rabbitmq_server-$mq_ver/sbin  >>/etc/profile
echo export PATH >>/etc/profile
source /etc/profile
##create rabbitmq user to start mq#########################
groupadd rabbitmq
useradd -b /var/lib/ -s /sbin/nologin -g rabbitmq rabbitmq
chown -R rabbitmq:rabbitmq $pd/rabbitmq_server-$mq_ver
echo "HOME=/var/lib/rabbitmq"  >> $pd/rabbitmq_server-$mq_ver/etc/rabbitmq/rabbitmq-env.conf
chown rabbitmq:rabbitmq $pd/rabbitmq_server-$mq_ver/etc/rabbitmq/rabbitmq-env.conf

1.3 注册rabbitmq系统服务

##add rabbitmq to systemd service ############

cat > /usr/lib/systemd/system/rabbitmq-server.service << EOF
[Unit]
Description=RabbitMQ broker
After=syslog.target network.target
[Service]
Type=notify
User=rabbitmq
Group=rabbitmq
UMask=0027
NotifyAccess=all
TimeoutStartSec=3600
LimitNOFILE=32768
Restart=on-failure
RestartSec=10
WorkingDirectory=$pd/rabbitmq_server-$mq_ver/var/lib/rabbitmq
ExecStart=$pd/rabbitmq_server-$mq_ver/sbin/rabbitmq-server
ExecStop=$pd/rabbitmq_server-$mq_ver/sbin/rabbitmqctl shutdown
SuccessExitStatus=69
[Install]
WantedBy=multi-user.target

EOF

1.4 启停rabbitmq服务

####enable and start rabbitmq service####
systemctl daemon-reload
systemctl enable rabbitmq-server
systemctl start rabbitmq-server
rabbitmq-plugins enable rabbitmq_management
systemctl restart rabbitmq-server









安装rabbitmq

1 安装1.1 安装erlangrabbitmq依赖erlang语言,需要先编译安装该软件,可以选择源码编译安装,rpm包安装等。erlang和rabbitmq有版本之间...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息