Deployment-Service deployment and automation in a mongodb~linux environment

Source: Internet
Author: User

<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 [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]

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.