首页 > 数据库技术 > 详细

【mongodb】- 自启动脚本

时间:2021-07-10 11:17:30      阅读:18      评论:0      收藏:0      [点我收藏+]

1、设置mongodb.service启动服务

cd /lib/systemd/system
vi mongodb.service

2、服务内容

[Unit]  
Description=mongodb  
After=network.target remote-fs.target nss-lookup.target  
  
[Service]  
Type=forking  
RuntimeDirectory=mongodb
RuntimeDirectoryMode=0751
PIDFile=/var/run/mongodb/mongod.pid
ExecStart=/usr/mongodb/bin/mongod --config /usr/mongodb/mongodb.conf  
ExecStop=/usr/mongodb/bin/mongod --shutdown --config /usr/mongodb/mongodb.conf  
PrivateTmp=false  
  
[Install]  
WantedBy=multi-user.target

3、设置mongodb.service权限

chmod 754 mongodb.service

4、启动服务

systemctl start mongodb.service

5、开机启动

systemctl enable mongodb.service

6、关闭服务

systemctl stop mongodb.service

7、服务启动测试

service mongodb start

 

【mongodb】- 自启动脚本

原文:https://www.cnblogs.com/minihu/p/14993280.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!