Unable to start/launch local mongo db

岁酱吖の 提交于 2019-11-28 15:37:57
Mattias

There is nothing wrong, you have started the server, it is running and listening on port 27017. Now you can start to interact with the server, for example just open a new terminal tab and run mongo ,which will open mongo's interactive console and connects to the default server(localhost:27017)

If you want to run mongod as a background process (to get back the console) you can use --fork command option. This requires you to use some sort of logging.

Eg. mongod --dbpath /path/to/my/mongodata --fork --logpath /path/to/my/mongod.log

If you want to restore a bsonexport you will probably use the mongorestore command

Bobby fox

Add the below in the configuration file and call it using monogd, make sure your bind_ip is configured as per your requirement and use the below link to add few more replica sets:

https://docs.mongodb.org/manual/tutorial/deploy-replica-set/

Step 1:

vi /etc/mongod.conf

replication: replSetName: rs01

Step 2:

mongod --config /etc/mongod.conf

Output:

warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
about to fork child process, waiting until server is ready for connections.
forked process: 30012
child process started successfully, parent exiting
Rajat Sharda

You need to follow the below 2 steps:

Step 1: Open CMD and enter mongod. This will run the mongo server

Step 2: Open another Command Prompt, move to the location of file and type

mongorestore -d db_name -c collection_name file.bson 

Copied from official documentation

This starts the main MongoDB database process. The waiting for connections message in the console output indicates that the mongod.exe process is running successfully.

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/

pressing ctrl+c or ctrl+z will stop mongod service,and just run sudo servie mongod start

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!