1. Download MongoDBHTTPS://FASTDL.MONGODB.ORG/LINUX/MONGODB-LINUX-X86_64-2.6.8.TGZ2. Unzip the tar zxf mongodb-linux-x86_64-2.6.8. Tgz3. Specify the installation directory MV MONGODB-LINUX-X86_64-2.6.8/APP/SINOVA/MONGODB4. Create a data file to store the directory mkdir/app/sinova/mongodb/ DB5. Create a log file to hold the directory MKDIR/APP/SINOVA/MONGODB/LOGS6. Create a profile directory Mkdir/app/sinova/mongodb/conf7. In/app/sinova/mongodb/ Conf the new configuration file in the directory, MongoDB supports writing the parameters into the configuration file and then starting with the configuration file configurationVI mongodb.confDBPath =/app/sinova/mongodb/db #数据文件存放目录LogPath =/app/sinova/mongodb/logs/mongodb.log #日志文件存放目录port = 27017 #mongodb监听的端口fork = True #以守护进程方式启动, which runs in the backgroundNohttpinterface = True #禁用http管理接口auth = True #启动mongodb客户端登录的认证机制. 8. Start MongoDB/app/sinova/mongodb/bin/mongod--config/app/sinova/mongodb/bin/mongodb.conf9. Stop MongoDBUnder Linux Many people stop a lot of services like Direct kill-9 PID, but for MongoDB if the kill-9 PID, the next boot may prompt error, resulting in the service cannot start, this time can be performed by: Rm-f/app/hadoop/db/ Mongod.lock also deletes the Mongod.lock file under the specified data directory.
Normal Stop method:
Kill-2 PID
Or
./mongo-host Ip:port First connect the services that need to be stopped, and then:
>use Admin
>db.shutdownserver ();
This can also stop the service as normal.
Installing the Configuration MongoDB