CENTOS6 Source Installation MongoDB

Source: Internet
Author: User
Tags set background

MongoDB is a database based on distributed file storage. Written by the C + + language. Designed to provide scalable, high-performance data storage solutions for Web applications.

MongoDB is a product between a relational database and a non-relational database, and is the most versatile and most like relational database in a non-relational database. The data structure he supports is very loose and is a JSON-like Bson format, so you can store more complex data types. MONGO's biggest feature is that the query language he supports is very powerful, and its syntax is a bit like an object-oriented query language that almost implements most of the functionality of a relational database single-table query, and also supports indexing of data.


1. Download the MongoDB installation package

[Email protected] src]# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.4.5.tgz


2. Unzip

[Email protected] src]# TAR-ZXVF mongodb-linux-x86_64-rhel62-3.4.5.tgz


3. Renaming

[Email protected] src]# MV Mongodb-linux-x86_64-rhel62-3.4.5/opt/mongodb


4. Create a DB data storage location and log location, and create a log file

[Email protected] src]# mkdir/opt/mongodb/data [[email protected] src]# Mkdir/opt/mongodb/data/db[[email protected] Sr c]# Mkdir/opt/mongodb/data/logs[[email protected] src]# Touch/opt/mongodb/data/logs/mongodb.log


5. Create a configuration MongoDB file

[Email protected] ~]# cat/opt/mongodb/data/mongodb.conf

#端口号port = 27017 #数据目录dbpath =/opt/mongodb/data/db# log directory LogPath =/opt/mongodb/data/logs/mongodb.log# Set background run fork = true# Log output Mode Logappend = true# turn on authentication #auth = True


6. Start the service

[Email protected] bin]# pwd

/opt/mongodb/bin

./mongod--config/opt/mongodb/data/mongodb.conf


7. See if the port is started


8. You can access the database.


# #附加: Create a startup script to facilitate the management of the service

[Email protected] ~]# cd/etc/init.d/

[email protected] init.d]# cat MongoDB

#!/bin/bash#chkconfig:2345 90#description:mongodbstart () {/opt/mongodb/bin/mongod--config/opt/mongodb/data/ Mongodb.conf}stop () {/opt/mongodb/bin/mongod--config/opt/mongodb/data/mongodb.conf--shutdown}case "$" in start) St  Art;;  stop) stop;;  restart) stop start;; *) echo $ "Usage: $ Start|stop|restart}" Exit 1esac

[Email protected] init.d]# chkconfig--add MongoDB

[Email protected] init.d]# chmod +x MongoDB

[[email protected] init.d]# chkconfig MongoDB on


Next, you can replace!!!!! with the server startup service.

CENTOS6 Source Installation 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.