MongoDB's learning [two]: MongoDB installation (Linux platform)

1, download the installation package MongoDB 
official website get: HTTP: //www.mongodb.org
WGE get: wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.0.tgz 2, pressurized and compressed package 
tar -zxvf MongoDB-Linux-i686-2.0.2.tgz 3, the file after being pressed into service catalog 
cd MongoDB-Linux-i686-2.0.2
Rsync -a bin / Mine / serve / MongoDB 4, create log files and directory data 
CD / Mine / serve / MongoDB
mkdir data
Touch dblogs . 5, the start is set to ON MongoDB 
echo "/ usr / local / mongodb> /etc/rc.local
Note: this operation is to start the MongoDB project, added to the rc.local ensure mongodb start when the server is turned on. 6, start the MongoDB 
/ Mine / serve / MongoDB / bin / --dbpath the mongod = / Mine / serve / MongoDB / --logpath the Data --fork = / Mine / serve / MongoDB / dblogs
--fork: Daemon process is the way run











 
--dbpath: performing a database storage of data path

Note: If you specify --fork parameter, you must specify the log file path --logpath 

warning: kill -9 2596 (process ID) to close mongoDB, you never get up, so remember to operate! ! ! -9 operation mongoDB cause damage to data. So how do you deal with it is to get to cd / mine / serve / mongodb / data, then delete mongod.lock asking about the price, you can handle! ! ! 

MongoDB way to kill: killall mongod or pkill mongod 

launch frequently used option parameters mongoDb the 

directory specified data stored --dbpath 
--port port specified database, the default is 27017 
--bind_ip bind ip 
--directoryperdb for each db create a separate subdirectory 
--logpath storage directory specified log 
--logappend generation method specified log (append or overwrite) 
--pidfilepath specified process file path, if not specified, the process will not produce documents 
--keyFile cluster mode identify key 
--journal enable logging 
--nssize .ns refers to the size of the file, the unit MB, default is 16M, the biggest is 2GB 
--maxConns maximum number of concurrent connections 
--notablescan does not allow scanning table 
--noprealloc close the data file the pre-assigned function 
after --fork form daemon running daemon service station

7, enter the client's operating
/ Mine / serve / MongoDB / bin / mongo 

[root @ iZm5eizpokikoertia0x31Z bin] # ./mongo 
MongoDB shell Version v4.0.11 
Connecting to: MongoDB: //127.0.0.1: 27017 / gssapiServiceName = MongoDB? 
the Implicit the session: the session { "the above mentioned id ": UUID (" 399e9faf-1e88-468c-97c5-6ce5b62c0223 ")} 
MongoDB Server Version: 4.0.11 
> 

Notes:! ps command to view the process 8, exit the shell console 
Ctrl + c Enter or exit 9, stop MongoDB server 
use ADMIN 
db.shutdownServer () 
the kill process number -2 
pkill mongod or killall mongod





Published 59 original articles · won praise 2 · Views 5586

Guess you like

Origin blog.csdn.net/LDR1109/article/details/100943580