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
评论区