Unable to connect to mongodb Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112

后端 未结 17 989
不知归路
不知归路 2021-02-02 14:45

When ever I try to connect to mongo db I always get this error as below.

MongoDB shell version: 2.4.3 connecting to: test Fri Apr 26 14:31:46.941 JavaScript execution f

17条回答
  •  无人共我
    2021-02-02 14:59

    mongod --configsvr --smallfiles --nojournal --dbpath cfg/1 --port 26052 --fork --logpath cfg/3.log >/dev/null
    

    Create a single mongos server on the default port

    sleep 2000
    mongos --configdb ${HOSTNAME}:26050,${HOSTNAME}:26051,${HOSTNAME}:26052 --fork --logpath mongos.log >/dev/null
    

    Sleep for some time before starting the mongos you will not face the problem

提交回复
热议问题