侧边栏壁纸
博主头像
CYC的个人博客博主等级

学习使人进步

  • 累计撰写 91 篇文章
  • 累计创建 11 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录

Rabbitmq将rabbitmq加入开机自启动

Administrator
2023-12-03 / 0 评论 / 0 点赞 / 162 阅读 / 1441 字

Rabbitmq将rabbitmq加入开机自启动

vim /etc/init.d/rabbitmq


#!/bin/sh
#
# chkconfig: 2345 80 05
# description: rabbitmq
# processname: rabbitmq
#RabbitMQ安装目录
export PATH=$PATH:/data/erlang/bin/
export HOME=/data/rabbitmq
case "$1" in
 start)
 echo "Starting RabbitMQ ..."
 cd $HOME/sbin
 ./rabbitmq-server -detached
 ;;
stop)
 echo "Stopping RabbitMQ ..."
 cd $HOME/sbin/
 ./rabbitmqctl stop
 ;;
status)
 echo "Status RabbitMQ ..."
 cd $HOME/sbin/
 ./rabbitmqctl status
 ;;
restart)
 echo "Restarting RabbitMQ ..."
 $0 stop
 $0 start
 ;;
*)
 echo "Usage: $prog {start|stop|status|restart}"
 ;;
esac
exit 0




#设置开机启动

chkconfig rabbitmq on

#查看自启动项是否设置成功
chkconfig --list rabbitmq






设置开机自启动 (方式二)
创建rabbitmq-server.service 文件

vi /usr/lib/systemd/system/rabbitmq-server.service

[Unit]
Description=RabbitmQ broker
After=syslog,target network ,target
[Service]
#Type=notify
User=root
Group=root
WorkingDirectory=/usr/local/rabbitmq/rabbitmg_server-3.10.18
ExecStart=/usr/local/rabbitmg/rabbitmq server-3.10.18/sbin/rabbitmg-server
ExecStop=/usr/local/rabbitmg/rabbitmg server-3.10.18/sbin/rabbitmgctl stop
[Install]
WantedBy=multi-user.target


#设置开机启动
systemctl enable rabbitmq-server


解决erlang问题
find / -name *.cookie

cp xx/xx.cookie   /root/.xxx.cookie


rabbitmqctl add_user cc 123232!
  894  ./rabbitmqctl  add_user cc   123232!
  909  ./rabbitmqctl set_user_tags cc administrator


0

评论区