按照顺序先后启动mqnamesrv、mqbroker、可视化管理工具
脚本随便放一个路径下,写完之后chmod 777 赋予权限。
启动脚本
#!/bin/bash
nohup sh /opt/software/rocketmq-all-4.9.4-bin-release/bin/mqnamesrv &
nohup sh /opt/software/rocketmq-all-4.9.4-bin-release/bin/mqbroker -n localhost:9876 &
nohup java -jar /opt/software/rocketmq-console-ng-1.0.0.jar &
停止脚本
#!/bin/bash
sh /opt/software/rocketmq-all-4.9.4-bin-release/bin/mqshutdown broker
sh /opt/software/rocketmq-all-4.9.4-bin-release/bin/mqshutdown namesrv
启动+停止脚本
#!/bin/bash
if [ $1 == "start" ]
then
nohup sh /opt/software/rocketmq-all-4.9.4-bin-release/bin/mqnamesrv &
nohup sh /opt/software/rocketmq-all-4.9.4-bin-release/bin/mqbroker -n localhost:9876 &
nohup java -jar /opt/software/rocketmq-console-ng-1.0.0.jar &
echo 开启rocketmq namessrv,broker,可视化工具
fi
if [ $1 == "shutdown" ]
then
sh /opt/software/rocketmq-all-4.9.4-bin-release/bin/mqshutdown broker
sh /opt/software/rocketmq-all-4.9.4-bin-release/bin/mqshutdown namesrv
fi
echo 关闭rocketmq broker,namessrv
启动脚本我的是存放再script目录下,source一下
vim /etc/profile
增加如下代码
# 添加这个内容,注意路径不要写错了
export PATH=$PATH:/root/soft/script
export PATH
source /etc/profile
任意目录下都可以使用
>>>myrocketmq.sh