CentOS Installation MongoDB

Source: Internet
Author: User
Tags mongodb
1, download the latest MongoDB from the official website, choose Linux, and then according to their own Linux system to choose the appropriate version.

2, unzip the download of the MongoDB tar bag

After decompression, the main running scripts are in the bin directory, the soft link is established: Ln-s/usr/soft/mongodb/bin/*/usr/local/bin. This allows you to directly use the various commands of MONGO.

3. Operation MONGO

Establish Data folder db, log folder logs, configuration folder conf

Create three script files: startmongo.sh, stopmongo.sh, mongostat.sh

(1) startmongo.sh start MONGO script

/usr/soft/mongodb/bin/mongod-f/usr/soft/mongodb/conf/mongodb_27021.conf--jour nal

(2) stopmongo.sh stop MONGO script

/usr/soft/mongodb/bin/mongod-f/usr/soft/mongodb/conf/mongodb_27021.conf--shut

Down

(3) mongostat.sh check MONGO status every 10 seconds

./mongostat--port 27021 10
4, attach the mongodb_27021.conf configuration content

# mongo.conf

#where to log
Logpath=/usr/soft/mongodb/logs/mongo_27021.log

Logappend=true

# fork and run in background
Fork = True

Port = 27021
# Dbpath=/var/lib/mongo

dbpath=/usr/soft/mongodb/db/

# Disables Write-ahead journaling

# Enables periodic logging of CPU utilization and I/O wait
#cpu = True

# Turn On/off Security. Off is currently the default
Noauth = True
#auth = True

# Verbose logging output.
#verbose = True

# Inspect all client data for validity on receipt (useful for
# Developing drivers)
#objcheck = True

# Enable DB Quota Management
#quota = True

# Set oplogging level where n is
# 0=off (default)
# 1=w
# 2=r
# 3=both
# 7=w+some Reads

# Ignore Query Hints
#nohints = True

# Disable The HTTP interface (Defaults to localhost:27018).
#nohttpinterface = True

# Turns off server-side scripting. This'll result in greatly limited
# functionality
#noscripting = True

# Turns off table scans. Any query so would do a table scan fails.
#notablescan = True

# Disable data File preallocation.
#noprealloc = True

# specify. ns file size for new databases.
# nssize =

# Accout token for Mongo monitoring server.
#mms-token =

# server name for Mongo monitoring server.
#mms-name =

# Ping interval for Mongo monitoring server.
#mms-interval =

# Replication Options

# in replicated MONGO databases, specify here whether this is a slave or master
#slave = True
#source = master.example.com
# Slave only:specify A single database to replicate
#only = master.example.com
# or
#master = True
#source = slave.example.com
#rest = True

Reprint Source: HTTP://WWW.16BOKE.COM/ARTICLE/DETAIL/37
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.