<MONGODB deployment on Linux >
In fact, Redis installation program is very good, directly help us to build the service, directly can use SYSTEMCTL to start it, and MongoDB in this respect is not so smart, we need to write their own service script, and then add it to boot from the inside on it, The main process is divided into the following steps:
MongoDB I installed in the/root/tools directory
A profile, ANSI, Notepad written, UTF8 may have a problem
dbpath=/root/tools/mongodb-linux-x86_64-amazon-3.4. 2/dblogpath=/root/tools/mongodb-linux-x86_64-amazon-3.4. 2/log/mongo.loglogappend=true port=27017 Fork =true nohttpinterface=true auth=false
Two service files, files located at:/usr/lib/systemd/system
[Unit] Description=MongoDB After=network.target Remote-fs.target nss-Lookup.target [Service] Type=forking Execstart=/root/tools/mongodb-linux-x86_64-amazon-3.4.2/bin/mongod--config/root/tools/mongodb-linux-x86_64-amazon-3.4.2/bin/mongodb.conf execreload=/bin/kill-s HUP $MAINPID execstop=/root/tools/mongodb-linux-x86_64-amazon-3.4.2/bin/mongod--shutdown--config/root/tools/mongodb-linux-x86_64-amazon-3.4.2/bin/mongodb.conf privatetmp=true[Install] Wantedby=multi-user.target
Three service commands
#文件权限 754 mongodb.service #启动服务 systemctl start Mongodb.service # Close service systemctl stop mongodb.service #开机启动 systemctl enable Mongodb.service
After you have a few steps, our MongoDB service is ready!
Thank you for reading!
Deployment-Service deployment and automation in a mongodb~linux environment