4 - 【RocketMQ 系列】CentOS 7.6 安装部署RocketMQ
五、自启动脚本
把下面内容填好后 按ESC 再输入 :wq! 保存退出 之后再修改权限
export JAVA_HOME='/usr/lib/jvm/jre-1.8.0'
export PATH=$JAVA_HOME/bin:$PATH
ROCKETMQ_HOME=/usr/local/rocketmq
ROCKETMQ_BIN=${ROCKETMQ_HOME}/bin
BROKER_IP='81.71.157.232:9876'
NAMESERVER_LOG=${LOG_DIR}/namesrv.log
BROKER_LOG=${LOG_DIR}/broker.log
nohup sh bin/mqnamesrv > ${NAMESERVER_LOG} 2>&1 &
echo -n "The Name Server boot success..."
nohup sh bin/mqbroker -n ${BROKER_IP} > ${BROKER_LOG} 2>&1 &
echo -n "The broker[%s, ${BROKER_IP}] boot success..."
echo $"Usage: $0 {start|stop|restart}"
chkconfig --add rocketmq 【添加系统服务】
chkconfig --del rocketmq 【删除系统服务】
ps -ef | grep rocketmq【查看是否有es的进程】
vim rocketmq-dashboard.service
Description=rocketmq dashboard service
ExecStart=/usr/lib/jvm/java/bin/java -jar /usr/local/rocketmq-dashboard/target/rocketmq-dashboard-1.0.0.jar
systemctl stop rocketmq-dashboard.service
systemctl start rocketmq-dashboard.service
systemctl restart rocketmq-dashboard.service
systemctl status rocketmq-dashboard.service
systemctl enable rocketmq-dashboard.service