mongo - couldn't connect to server 127.0.0.1:27017

后端 未结 30 2324
故里飘歌
故里飘歌 2020-11-27 09:43

I am coming from riak and redis where I never had an issue with this services starting, or to interact.

This is a pervasive problem with mongo and am rather clueless

30条回答
  •  清酒与你
    2020-11-27 10:30

    Make sure that your mongo is running. I fixed this problem by trying to repair the mongodb, there I found that the directory required for the db to run was not created. It shows this error

    Type: mongod, it will show the error

    exception in initAndListen: 29 Data directory /data/db not found., terminating

    Error happen because dbpath /data/db/ (default config) does not exist. You need to create data folder and set permission for it.

    Then I create a folder on my system by the command

    sudo mkdir -p /data/db/ and sudo chown id -u /data/db

    then I run the mongo again and it worked.

提交回复
热议问题