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/datatouch/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
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//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 Specifies the IP address of the master machine--slave specified as the primary machine--source from the machine--pologsize 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 rights are required to log on (user name and password)-H [-- Help] Show this usage information--version show version information-f [--config] Arg Configuration file specifying additional options--port arg specify port number--bind_ip Arg loc Al IP address to bind listener-all local ips bound by Default-v [--verbose] is more Verbose (include multiple times for more verbosity e.g.-vvvvv)--dbpath Arg (=/data/db/) Direct Ory for datafiles specifying data storage directory--quiet quieter output silent mode--logpath arg file to send all out Put to instead of stdout specify log storage directory--logappend APPND to LogPath instead of over-writing specified logWhether to write to the log file in append or overwrite--fork fork server process to create a child process run--CPU periodically show C Pu and iowait Utilization periodic display of CPU and IO usage--noauth run without security no authentication mode runs--auth Run with security authentication mode runs--objcheck inspect client data for validity on receipt check 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 for the Babble app server--nocursors diagnostic /debugging option Debug Diagnostics option--nohints Ignore query hints ignore the search hit rate--nohttpinterface disable HTTP Interfa Ce off HTTP interface, default is 28017--noscripting disable scripting engine close script engine--noprealloc disable data file P Reallocation Close the database file size pre-allocated--smallfiles use a smaller the default file size uses the smaller defaults for--nssize Arg (=16). N s file size (in megabytes) forThe default size of the new databases database ns file--diaglog arg 0=off 1=w 2=r 3=both 7=w+some reads is provided in a way that is read-only, write-only, read-write or read-only, or the main write + part of the Reading mode- -sysinfo Print Some diagnostic system Information printing systems Diagnostic Information--upgrade upgrade DB if needed as You need to update the database--repair run repair on all DBS repair all databases--notablescan 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 60s Replication Options:--master Master mode--slave slave mode from copy mode--source arg when slave:specify master as <serve R:port> when specifying the primary address and port for the slave,--only Arg when slave:specify a single database to replicate is specified from the primary copy of the Singleton library--PAIRW ITH ARG address of server to pair with--arbiter arg address of arbiter server arbiter, used in primary master and pair--autoresyn C automatically resync if slave data is stale auto-sync from--oplogsize arg size limit (in MB) for OP log specifies the operation log Size--opidmem argSize limit (in bytes) for in memory storage of OP ids specifies the memory size of the storage operation log Sharding OPTIONS:--CONFIGSVR declare this is A config db of a cluster specifies the configuration server in Shard--shardsvr declare this is a 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/mongomongodb Shell version:1.8.2connecting 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
Reprinted article url:http://www.cnblogs.com/xiaoqian1993/p/5936648.html
Linux under MongoDB installation and startup configuration