Centos7 Installing MongoDB

Source: Internet
Author: User

MongoDB Website: http://www.mongodb.org/

1: Installing MongoDB

Centos7 version of MongoDB without installation, as long as the decompression can be used. MONGODB provides pre-compiled binaries for both 32-bit and 64-bit systems, which you can download from MongoDB website, MongoDB precompiled binary package: https://www.mongodb.com/download-center#community

TAR-ZXVF mongodb-linux-x86_64-rhel70-3.6.4.tgz

MV Mongodb-linux-x86_64-rhel70-3.6.4/opt/mongodb

Then add MongoDB to the path of the system environment variable. Vim/etc/profile export Path=/opt/mongodb/bin: $PATH source/etc/profile

MongoDB stores the data directory in the DB directory. However, this data directory is not actively created, and we need to create it after the installation is complete.

Mkdir-p/data/db

You can then execute the mongod command to start the MONGDB service by executing the bin directory in the MongoDB installation directory of the command line.

If you need to make a directory, Mongod--dbpath=/opt/mongodb/data/db directly starts

If you need to go into MongoDB background management, execute the MONGO command file. The MongoDB Shell is an interactive JavaScript shell that comes with MongoDB and is used to manipulate and manage MongoDB. When you enter MongoDB background, it is linked to the test document (database) by default.

Set up MongoDB boot-Custom Service

Create a new mongodb.conf configuration file under the/opt/mongodb directory, as follows:

Create a log directory under Data

Then under/ETC/RC.D/INIT.D with VI new file Mongod, the contents are as follows:

Finally increase boot start:

chmod +x/etc/rc.d/init.d/mongod

Chkconfig--add Mongod

Chkconfig--level 345 Mongod on

Chkconfig--list Mongod

Service Mongod Start

After executing the script, you can start start|stop|restart|list your service.
After the shutdown and restart will automatically start MONGO, if the same machine needs to start more than Mongod this method.

Reference documents: 51441579

Centos7 Installing MongoDB

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: 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.