1. Download the installation package
wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.2.tgz
Unzip the package after download is complete
Tar zxf mongodb-linux-i686-1.8. 2. tgz
2. Install ready to move MongoDB to the/usr/local/server/mongdb folder
MV mongodb-linux-i686-1.8. 2 /usr/local/mongodb
Creating database folders and log files
mkdir/usr/local/mongodb//usr/local/mongodb/logs
3. Set up start-up to add MongoDB boot project to rc.local to ensure MongoDB starts when the server is powered on
" /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//The following is a login method that requires permissions, user name and password required for connection
/usr/local/server/mongodb/bin/mongod--dbpath=/usr/local/server/mongodb/data--logpath=/usr/local/server/mongodb /logs--logappend --auth --port=27017 --fork
This one doesn't need a password.
/usr/local/server/mongodb/bin/mongod--dbpath=/usr/local/server/mongodb/data--logpath=/usr/local/server/mongodb /logs--logappend --port=27017 --fork
5. Parameter interpretation:--dbpath database path (data file)
--logpath log file path--Master designated as the primary machine--slave specified as slave machine--source Specifies the IP address of the host machine--POLOGSIZE specifies that the log file size does not exceed 64M. Because Resync is extremely operational and time consuming, it is best to avoid resync by setting a sufficiently large oplogsize (the default oplog size is 5% of the free disk size). --logappend log file end add--Port Enable port number--Fork runs in the background--only specifies which database to replicate--Slavedelay refers to the time interval from which replication is detected--Auth If you need to verify permissions login (username and password)-H [--help] Show Thisusage Information--version Show version information-F [--Config] arg configuration file specifying additional options--Port Arg Specify port number--BIND_IP arg local IP address to bind listener-All local IPs bound bydefault-V [--verbose] is more verbose (include multiple times forMore verbosity e.g.-VVVVV)--dbpath Arg (=/data/db/) directory fordatafiles specifying the data storage directory--quiet quieter output silent mode--logpath arg file to send all output to instead of stdout specify log storage directory--logappend APPND to LogPath instead of over-writing Specifies whether the log is written to the log file in append or overwrite mode--Fork Fork Server process runs in a way that creates a child process--CPU periodically show CPU and iowait utilization periodic display of CPU and IO usage--Noauth run without security no authentication mode operation--Auth run with security authentication Mode--objcheck Inspect Client data forvalidity on receipt checking the validity check 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 forThe Babble App server--nocursors diagnostic/debugging option Debug Diagnostics Options--nohints Ignore query hints ignores the search hit ratio--nohttpinterface Disable HTTPInterfaceturn off HTTP interface, default is 28017--noscripting disable scripting engine close script engines--noprealloc Disable data file preallocation to close the size pre-allocation of database files--smallfiles use a smallerdefaultFile size uses smaller default file sizes--nssize arg (= -). ns File Size (inchMB) for Newdatabases default size for new database ns files--diaglog Arg0=off1=w2=r3=both7=w+some reads provides a way to be read-only, write-only, read-write, or write +part of the read mode--sysinfo Print Some diagnostic system Information printing systems diagnostic Information--upgrade Upgrade DBifneeded Update the database if needed--Repair Run Repair on all DBS repair all databases--notablescan Donot allow table scans does not run a tables scan--syncdelay arg (= -) seconds between Disk syncs (0 fornever) The time the system refreshes the disk synchronously, the default is 60s Replication options:--Master Master Mode primary copy mode--slave slave mode from replication--source Arg when slave:specify master as<server:port>Specifies the primary address and port when it is from--Only if arg when slave:specify a single database to replicate is specified from the primary copy--pairwith arg address of server to pair with--Arbiter arg address of Arbiter server arbiter, used in master and pair--autoresync automatically resyncifSlave data isstale automatic synchronization of data from--oplogsize arg size limit (inchMB) forOP log Specifies the size of the operation logs--opidmem arg size limit (inchbytes for inchMemory storage of OP IDs specifies the size of the storage operation log sharding options:--CONFIGSVR Declare This isa config db of a cluster specifies the configuration server in Shard--SHARDSVR Declare This isA shard db of a cluster specifies the 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/1.8. 2 connecting to:test> Use test;switched to DB test
If 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--repair
Linux under MongoDB installation and startup configuration