Jump to content

Recommended Posts

Hi guys,

I'm hoping a network specialist chances upon my post.

I've had mongodb up and running on localhost for months and all of a sudden, it stops connecting. This is what I tried:

ludo@aegir:~$ mongod
2019-04-24T08:44:45.933+0100 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-04-24T08:44:46.082+0100 I CONTROL  [initandlisten] MongoDB starting : pid=2419 port=27017 dbpath=/data/db 64-bit host=aegir.local.com
2019-04-24T08:44:46.082+0100 I CONTROL  [initandlisten] db version v4.0.9
2019-04-24T08:44:46.082+0100 I CONTROL  [initandlisten] git version: fc525e2d9b0e4bceff5c2201457e564362909765
2019-04-24T08:44:46.082+0100 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.1b  26 Feb 2019
2019-04-24T08:44:46.082+0100 I CONTROL  [initandlisten] allocator: tcmalloc
2019-04-24T08:44:46.082+0100 I CONTROL  [initandlisten] modules: none
2019-04-24T08:44:46.083+0100 I CONTROL  [initandlisten] build environment:
2019-04-24T08:44:46.083+0100 I CONTROL  [initandlisten]     distmod: debian92
2019-04-24T08:44:46.083+0100 I CONTROL  [initandlisten]     distarch: x86_64
2019-04-24T08:44:46.083+0100 I CONTROL  [initandlisten]     target_arch: x86_64
2019-04-24T08:44:46.083+0100 I CONTROL  [initandlisten] options: {}
2019-04-24T08:44:46.099+0100 E STORAGE  [initandlisten] Failed to set up listener: SocketException: Address already in use
2019-04-24T08:44:46.122+0100 I CONTROL  [initandlisten] now exiting
2019-04-24T08:44:46.122+0100 I CONTROL  [initandlisten] shutting down with code:48
ludo@aegir:~$ 

So from there i tried:

root@aegir:/home/ludo# lsof -iTCP -sTCP:LISTEN -n -P
COMMAND    PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mysqld     676    mysql   17u  IPv4  20517      0t0  TCP 127.0.0.1:3306 (LISTEN)
postgres   677 postgres    3u  IPv6  17243      0t0  TCP [::1]:5432 (LISTEN)
postgres   677 postgres    6u  IPv4  17244      0t0  TCP 127.0.0.1:5432 (LISTEN)
nginx      683     root   10u  IPv4  17233      0t0  TCP *:80 (LISTEN)
nginx      683     root   11u  IPv4  17234      0t0  TCP *:27017 (LISTEN)
nginx      683     root   12u  IPv6  17235      0t0  TCP *:80 (LISTEN)
nginx      683     root   13u  IPv4  17236      0t0  TCP *:8000 (LISTEN)
nginx      684 www-data   10u  IPv4  17233      0t0  TCP *:80 (LISTEN)
nginx      684 www-data   11u  IPv4  17234      0t0  TCP *:27017 (LISTEN)
nginx      684 www-data   12u  IPv6  17235      0t0  TCP *:80 (LISTEN)
nginx      684 www-data   13u  IPv4  17236      0t0  TCP *:8000 (LISTEN)
master    1016     root   13u  IPv4  18422      0t0  TCP 127.0.0.1:25 (LISTEN)
master    1016     root   14u  IPv6  18423      0t0  TCP [::1]:25 (LISTEN)
miniserv. 1089     root    5u  IPv4  16225      0t0  TCP *:10000 (LISTEN)
miniserv. 1089     root    6u  IPv6  16226      0t0  TCP *:10000 (LISTEN)
root@aegir:/home/ludo# 

so then I :

kill 683

 then when I try sudo mongod the connection is made. 

here are the last few lines of my mongodb log

ludo@aegir:/etc/nginx/sites-available$ sudo tail -n 25 /var/log/mongodb/mongod.log 
Apr 24 09:00:59 aegir NetworkManager[485]: <info>  [1556092859.1543] dhcp4 (ens33):   gateway 192.168.52.2
Apr 24 09:00:59 aegir NetworkManager[485]: <info>  [1556092859.1544] dhcp4 (ens33):   server identifier 192.168.52.254
Apr 24 09:00:59 aegir NetworkManager[485]: <info>  [1556092859.1545] dhcp4 (ens33):   lease time 1800
Apr 24 09:00:59 aegir NetworkManager[485]: <info>  [1556092859.1547] dhcp4 (ens33):   nameserver '192.168.52.2'
Apr 24 09:00:59 aegir dbus[463]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Apr 24 09:00:59 aegir NetworkManager[485]: <info>  [1556092859.1548] dhcp4 (ens33):   domain name 'localdomain'
Apr 24 09:00:59 aegir NetworkManager[485]: <info>  [1556092859.1549] dhcp4 (ens33):   wins '192.168.52.2'
Apr 24 09:00:59 aegir NetworkManager[485]: <info>  [1556092859.1550] dhcp4 (ens33): state changed bound -> bound
Apr 24 09:00:59 aegir systemd[1]: Starting Network Manager Script Dispatcher Service...
Apr 24 09:00:59 aegir dhclient[679]: bound to 192.168.52.186 -- renewal in 730 seconds.
Apr 24 09:00:59 aegir dbus[463]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Apr 24 09:00:59 aegir systemd[1]: Started Network Manager Script Dispatcher Service.
Apr 24 09:00:59 aegir nm-dispatcher: req:1 'dhcp4-change' [ens33]: new request (1 scripts)
Apr 24 09:00:59 aegir nm-dispatcher: req:1 'dhcp4-change' [ens33]: start running ordered scripts...
Apr 24 09:01:01 aegir CRON[3570]: pam_unix(cron:session): session opened for user aegir by (uid=0)
Apr 24 09:01:01 aegir CRON[3571]: (aegir) CMD (/usr/bin/env php /usr/local/bin/drush '@hostmaster' hosting-dispatch )
Apr 24 09:01:04 aegir php: DIGEST-MD5 common mech free
Apr 24 09:01:04 aegir CRON[3570]: pam_unix(cron:session): session closed for user aegir
Apr 24 09:01:38 aegir sudo: pam_unix(sudo:session): session closed for user root
Apr 24 09:02:01 aegir CRON[3597]: pam_unix(cron:session): session opened for user aegir by (uid=0)
Apr 24 09:02:01 aegir CRON[3598]: (aegir) CMD (/usr/bin/env php /usr/local/bin/drush '@hostmaster' hosting-dispatch )
Apr 24 09:02:05 aegir php: DIGEST-MD5 common mech free
Apr 24 09:02:05 aegir CRON[3597]: pam_unix(cron:session): session closed for user aegir
Apr 24 09:02:24 aegir sudo:     ludo : TTY=pts/1 ; PWD=/etc/nginx/sites-available ; USER=root ; COMMAND=/usr/bin/tail -n 25 /var/log/mongodb/mongod.log
Apr 24 09:02:24 aegir sudo: pam_unix(sudo:session): session opened for user root by (uid=0)

can anybody suggest what's going wrong here? 

PS after a reboot I'm right back to square one.

Link to comment
https://forums.phpfreaks.com/topic/308627-mongodb-connection-issue/
Share on other sites

Don't be shy guys, have a go:

sudo apt install --reinstall mongodb

and now when I try mongo:

ludo@aegir:~$ mongo
MongoDB shell version: 3.2.11
connecting to: test
2019-04-24T16:57:13.004+0100 I NETWORK  [thread1] recv(): message len 1347703880 is invalid. Min 16 Max: 48000000
2019-04-24T16:57:13.004+0100 E QUERY    [thread1] Error: network error while attempting to run command 'isMaster' on host '127.0.0.1:27017'  :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed

How can I get rid of that pesky NETWORK [thread] recv(): message len1347703880 ?

Well I did see this from your lsof:

nginx      684 www-data   11u  IPv4  17234      0t0  TCP *:27017 (LISTEN)

27017 is the MongoDB listener port, so it makes sense that when you killed nginx, you could connect.

The question is, why is nginx configured to be listening to 27017?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.