Startup:
1. Start through command parameters: mongod -fork --dbpath=/app/hadoop/db --logpath=/app/hadoop/db/m_log.log --logappend --port=27018
2. Start through configuration file
Configuration file:
dbpath=/data/mongodb/data
logpath=/data/mongodb/log/mongo30.log
port=30000
logappend=true
fork=true
journal=true
Command: mongod -f /data/mongodb/mongo.conf
stop:
Under Linux, everyone likes to kill -9 PID directly to stop many services, but if you execute kill -9 PID for MongoDB, an error may be displayed at the next startup, causing the service to fail to start. At this time, you can execute:
rm -f /app /hadoop/db/mongod.lock
is to delete the mongod.lock file in the specified data directory.
Normal stop method:
kill -2 PID
or
mongo -host ip:port
first connect to the service that needs to be stopped, then:
use admin
db.shutdownServer();
This can also stop the service normally.
mongodb start and stop commands
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=327092128&siteId=291194637
Recommended
Ranking