search

Home  >  Q&A  >  body text

mongodb - failed to connect to server [localhost:27017] on first connect

已安装mongodb,并通过mongo启动

运行命令 supervisor --harmony index 报错

天蓬老师天蓬老师2757 days ago1954

reply all(3)I'll reply

  • 为情所困

    为情所困2017-05-02 09:25:22

    Try to ping localhost

    ping: cannot resolve localhost: Unknown host

    Modify the host file and add 127.0.0.1 localhost

    Just restart the service...

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-02 09:25:22

    Is there a problem with the configuration? Can you post the code for connecting to the database?

    reply
    0
  • 某草草

    某草草2017-05-02 09:25:22

    It seems that the Socket cannot be connected. You should first check whether the server address given is correct and whether you can connect using Shell.

    mongo [ip]:[port]

    If it can be connected, it means there is a configuration problem. Otherwise, mongodb may not be started at all, or the listening address may be incorrect. Problems need to be eliminated one by one.

    reply
    0
  • Cancelreply