1. Download the installation package wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.2.tgz unzip the tarball after the download is complete ZXF Mongodb-linux-i686-1.8.2.tgz 2. Install prepare to move MongoDB to/usr/local/server/mongdb folder MV Mongodb-linux-i686-1.8.2/usr/local/mongodb Create database folder and log file mkdir/usr/ Local/mongodb/datatouch/usr/local/mongodb/logs 3. Set up start-up to add MongoDB Startup items to rc.local ensure MongoDB starts when the server boots up echo "/usr/local/server/mongodb/bin/mongod--dbpath=/usr/local/ Server/mongodb/data–logpath=/usr/local/server/mongodb/logs–logappend--auth–port=27017 ">>/etc/rc.local 4. Start MONGODBCD to the Bin folder under the MongoDB directory to start mongodb//below this is the login method that requires permissions, user connection requires user name and password/usr/local/server/mongodb/bin/mongod-- Dbpath=/usr/local/server/mongodb/data--logpath=/usr/local/server/mongodb/logs--logappend--auth--port=27017-- Fork
This is a/usr/local/server/mongodb/bin/mongod--dbpath=/usr/local/server/mongodb/data--logpath=/usr/local/that does not require a password. Server/mongodb/logs--logappend--port=27017--fork
5. Parameter explanation:--dbpath database path (data file)--logpath log file path--master designated as the primary machine--slave designated as the IP address of the host machine--source Specifies that the log file size does not exceed 64M. Because the resync is extremely operational and time consuming, it is best to avoid resync by setting a large enough oplogsize (the default oplog size is 5% of the free disk size). --logappend log file at the end of the Add--port enable port number--fork run in the background--only specify which database to replicate only--slavedelay refers to the time interval from replication detection--auth Whether authentication permission is required to log on (user name and password)
-H [--help] Show this usage information--version & nbsp Show version information-f [--config] arg configuration file specifying Additi Onal options--port Arg specify Port number--bind_ip Arg &NBS P Local IP address to bind Listener-all local ips &NB Sp bound by default-v [--verbose]  BE more Verbose (include multiple times for more &NBS P verbosity e.g-VVVVV)--dbpath arg (=/data/db/) directory for datafiles Specify data storage directory--quiet & nbsp quieter output silent mode--logpath arg &NBSP ; file to send all output to instead of stdout specify log storage directory--logappend & nbsp APPND to LogPath instead of over-writing Specifies whether the log is written in append or overwrite to log file--fork &NB Sp fork Server process Run as child process--cpu &N Bsp Periodically show CPU and iowait utilization periodic display CPU and IO usage--noauth &N Bsp run without security no authentication mode run--auth run with sec Urity authentication Mode run--objcheck inspect client data for validity on receipt Check validation of client input data--quota Enable DB quota management Start Management of database Quotas--quotafiles Arg number of files Allower per db, requires--quota specifies the number of files allowed per database- -appSrvpath Arg root directory for the Babble app server --nocursors &NBS P diagnostic/debugging option Debug Diagnostics options--nohints & nbsp Ignore query hints ignore--nohttpinterface Disable HTTP interface turn off HTTP interface, default is 28017--noscrip Ting Disable scripting engine off scripting engines--noprealloc &NB Sp disable data file preallocation Close the database files size pre-allocation--smallfiles use A smaller the default file size uses a smaller--nssize arg (=16)  .NS file size (in megabytes) for new Databas Es the default size of the new database ns file--diaglog arg 0=off 1=w 2=r 3=both 7=w+some reads provides a way to be read only, write only, or Read/write, or main write + part reading mode--sysinfo Print some diagnostic system Informati On printing system Diagnostic information--upgrade Upgrade DB if needed update database if necessary--repair &NB Sp run repair on all DBS repair all databases--notablescan &N Bsp Do not allow table scans does not run--syncdelay Arg (=60) seconds between disk syncs (0 for never) the system synchronizes the time that the disks are flushed, by default is 60s
Replication options:--master Master Mode primary copy mode--slave slave mode--source arg from copy mode whe n slave:specify Master as <server:port> when it is from, specify the primary address and Port--only Arg when slave:specify a single database t O Replicate when it is from, specify a single library that needs to be copied from primary--pairwith arg address of server to pair with--arbiter arg address of arbiter Server arbiter server, using--autoresync automatically resync if slave data is stale to automatically synchronize data--oplogsize arg s in primary and pair Ize limit (in megabytes) for OP log specifies the size of the operation log--opidmem arg size limit (in bytes) for memory storage of OP IDs that specifies the storage operation log Memory size
Sharding Options:--configsvr Declare this is a config db of a cluster specify Shard in Configuration server--shardsvr Declar E This is a shard db of a cluster specified shard server 6. Enter the CLI management interface of the database CD to the Bin folder under the MongoDB directory and execute the command./mongo run as follows: [[email protected] mongodb]#./bin/mongomongodb Shell version: 1.8.2connecting to:test> use test;switched to DB testIf the database appears as unable to connect, it is a data directory under the Mongod.lock file problem, you can use the following repair command,Mongod--repairhttp://blog.csdn.net/yuwenruli/article/details/8529192
Linux under MongoDB installation and startup configuration