CentOS 7 server configuration-install MongoDB, centosmongodb

Source: Internet
Author: User
Tags install mongodb

CentOS 7 server configuration-install MongoDB, centosmongodb
# Download the MongoDB source file: wget unzip-zxvf mongodb-linux-x86_64-rhel70-3.4.7.tgz # rename the decompressed file mv mongodb-linux-x86_64-rhel70-3.4.7 mongodb # create the mongodb data file and log file directory mkdir-p/data/dbmkdir-p/data/logs note: the file directory created here is under the root directory # enter the mongodb bin directory cd mongodb/bin # create the mongodb configuration file vi. /mongodb. conf # Add the following information: dbpath =/data/db # data file storage directory logpath =/data/logs/mongodb. log # log file storage directory port = 27017 # port fork = true # enabled as a daemon, that is, run nohttpinterface = true # Save in the background and start Mongodb. /mongod -- config mongodb. conf: Set MongoDB startup # create a mongodb instance in the/lib/systemd/system folder. service file vi/lib/systemd/system/mongodb. service # Add the following content [Unit] Description = mongodb afterappsnetwork.tar get remote-fs.target nss-lookup.target [Service] Type = forking ExecStart =/home/mongodb/bin/mongod -- config/home/mongodb/bin/ mongodb. conf ExecReload =/bin/kill-s HUP $ MAINPID ExecStop =/home/mongodb/bin/mongod -- shutdown -- config/home/mongodb/bin/mongodb. conf PrivateTmp = true [Install] wantedby=multi user.tar get # Is mongodb. service permission chmod 754 mongodb. service # Set systemctl enable mongodb to start at startup. service # enable systemctl restart mongodb. service Note: After Mongodb is installed, if it has been started, an error may occur when starting the service here, because port 27017 is occupied. In this case, you only need to restart the server, and the mongodb service will automatically start.

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: info-contact@alibabacloud.com 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.