安装rabbitmq
1 安装
1.1 安装erlang
rabbitmq依赖erlang语言,需要先编译安装该软件,可以选择源码编译安装,rpm包安装等。
erlang和rabbitmq有版本之间的对应关系,参考官网查看他们之间版本的对应关系。
以下示例是选择源码安装
#!/bin/bash
#usage: sh installmq_master.sh
#usage: sh installmq_master.sh
## ENV ##
source /etc/profile
pd=$PWD
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
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.19cd $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
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
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
[Unit]
Description=RabbitMQ broker
After=syslog.target network.target
[Service]
Type=notify
User=rabbitmq
Group=rabbitmq
UMask=0027
NotifyAccess=all
TimeoutStartSec=3600
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
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
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
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有版本之间...
点击下载文档
本文2024-09-23 01:13:58发表“云苍穹知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-cangqiong-144628.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章