search

Home  >  Q&A  >  body text

ubuntu mongodb 出现 exception: connect failed

I was overwhelmed by this problem. I tried Baidu and Google but it still didn’t work, even reinstalling it didn’t work!!
I tried various methods but it didn’t work. Can an expert give me some advice?

The error is as follows:

2017-03-21T19:16:41.552+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-21T19:16:41.552+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

I really hope someone who knows can help me

Brother downstairs, please add~

When I start mongodb, this will appear

Failed to start mongod.service: Unit mongod.service not found.

The listening port is like this

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      953/mysqld
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      973/apache2
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      888/sshd
udp        0      0 139.196.187.137:123     0.0.0.0:*                           961/ntpd
udp        0      0 10.25.105.32:123        0.0.0.0:*                           961/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           961/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           961/ntpd
udp6       0      0 :::123                  :::*                                961/ntpd

I’m sure it’s not turned on!, but the problem is that it can’t be started~~~~

According to the prompt from the big brother downstairs:

systemctl start mongod.service

will appear:

Failed to start mongod.service: Unit mongod.service not found.

But my mongodb is indeed installed~

巴扎黑巴扎黑2790 days ago24952

reply all(3)I'll reply

  • 世界只因有你

    世界只因有你2017-05-02 09:27:28

    Is mongo enabled? Run the netstat -tunlp command to see if the port is listening

    reply
    0
  • 黄舟

    黄舟2017-05-02 09:27:28

    1. The mongod database service is not started.

    2. You can provide a detailed startup error log so that the problem can be easily located.

    reply
    0
  • 高洛峰

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

    Run mongod directly to start

    reply
    0
  • Cancelreply