search

Home  >  Q&A  >  body text

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

Mongodb has been installed and started via mongo

Run the command supervisor --harmony index and report an error

天蓬老师天蓬老师2790 days ago1985

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