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