To create a data catalog:
# Mkdir/data/mongo
Creating a configuration file
# VI/DATA/MONGO/MONGODB.CNF
dbpath=/data/mongo/
Logpath=/data/mongo/mongo.log
Logappend=true
Fork=true
port=27017
Or: Do not create a configuration file by starting with the Mongod parameter or you can
1, configuration file mode start MONGO
# bin/mongod-f/DATA/MONGO/MONGODB.CNF
or # Bin/mongod-f/DATA/MONGO/MONGODB.CNF & (performed in the background)
2. Parameter start MONGO
bin/mongod-dbpath/data/mongo/-logpath/data/mongo/mongo.log-logappend-fork-port 27017
The terminal input:
All output going to:/data/mongo/mongo.log
After success, you can log in MONGO
# Bin/mongo
The terminal input:
MongoDB Shell version:2.2.3
Connecting To:test
>
Now MONGO can be used normally.
If you let MONGO start automatically with Linux, add the following in/etc/rc.local:
Rm/data/mongo/mongod,.lock #停止可能在运行的mongo
/.../bin/mongod-f/data/mongo/mongodb.cnf
Or
/.../bin/mongod-dbpath/data/mongo/-logpath/data/mongo/mongo.log-logappend-fork-port 27017
Accompanying reminders:
1. Background start node command: Nohup node/.../app.js &
2. Stop node and MONGO all with kill
3, if there is a start error error:child process failed, exited with error number 100, generally because the last MongoDB did not shut down normally, only need RM/.../mongod.lock good
Start MongoDB under Linux (background mode)