The solution for MongoDB not starting after installation

an introduction

         We introduced the introduction of MongoDB (installation and configuration) before. When we open MongDB today, we first run cmd.exe to enter the dos command interface, and then enter the cd D:\mongodb\bin directory to start the service or report the mongo command mistake.

two. solve  

1.net stop mongdb start service report: system error 5


solve:

   When running cmd.exe to enter the dos command interface, and then entering the cdD:\mongodb\bin directory, you need to run as an administrator before running cmd.exe, which has high permissions. Then tap to start the service net start mongdb


 

2. The mongo command appears: the target computer actively refuses to connect

 


analyze:

  When net start mongdb is running, it prompts that the service starts normally, but when the mongo command is typed, such a problem occurs. The reason is that MongoDB has not started Mongodb, so we connect to mongoDB, and the connection must fail.





solve:

    The data/mongod.lock file has been deleted. It needs to be deleted when it is not closed safely. The reason is that the mongod.lock file is a lock file created in the hard disk after the mongoDB server is started. If it is closed abnormally, it will affect the next startup of the mongod service. , find the disk where mongoDB was decompressed before and configure the directory for storing logs and data, such as my decompressed directory D:\mongodb, and the data directory is D:\mongodb\data Delete the mongod.lock file under this file




 Then start the service and type the mongo command, it can run normally



illustrate:

If you exit the mongod service normally, even if the file still exists, it will not affect the next time you start the mongod service. The size of mongod.lock is 0 bytes.


  


If the above method is used, it still cannot start normally. You can refer to this article for reference. After trying it, it will definitely be ok! 

                                                                                   http://blog.csdn.net/congcong68/article/details/44277469 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325747893&siteId=291194637