search

Home  >  Q&A  >  body text

无法链接mongodb,附上错误log

MongoDB shell version v3.4.2
connecting to: mongodb://127.0.0.1:27017
2017-03-01T12:06:59.013+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2017-03-01T12:06:59.015+0800 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

仅有的幸福仅有的幸福2757 days ago762

reply all(5)I'll reply

  • 滿天的星座

    滿天的星座2017-05-02 09:27:24

    Has your mongodb started?

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-02 09:27:24

    The answer above is the correct answer. MongoDB is not started!

    Note: connect failed

    Love MongoDB! Have Fun!

    reply
    0
  • 高洛峰

    高洛峰2017-05-02 09:27:24

    Use the mongod command to start the local mongo service first

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-02 09:27:24

    Try restarting mongodb first:

    sudo service mongod restart

    If it doesn’t work, delete the mongod.lock files in the data directory (the default data directory is /var/lib/mongodb) and try the previous step again

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:27:24

    ps -ef | grep mongo
    Check if there is any process
    /etc/init.d/mongod start

    reply
    0
  • Cancelreply