No Network connection

I got no connection when I issued the mongo command from my vagrant machine. I was able to run the show dbs command, and use the admin db, but I could not shut down mongo by db.shutdownServer(). When I tried that it tried but failed to connect.

Here’s my terminal interactions:
Microsoft Windows [Version 10.0.17134.765]
© 2018 Microsoft Corporation. All rights reserved.

C:\Users\bholm>vagrant ssh
A Vagrant environment or target machine is required to run this
command. Run vagrant init to create a new Vagrant environment. Or,
get an ID of a target machine from vagrant global-status to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.

C:\Users\bholm>cd

C:\Users\bholm>cd

C:\Users\bholm>cd Desktop\Projects\Mongo\M103\Vagrant\m103-vagrant-env

C:\Users\bholm\Desktop\Projects\Mongo\M103\Vagrant\m103-vagrant-env>vagrant ssh
Welcome to Ubuntu 14.04.6 LTS (GNU/Linux 3.13.0-170-generic x86_64)

System information as of Thu May 16 07:58:49 UTC 2019

System load: 0.45 Processes: 92
Usage of /: 5.0% of 39.34GB Users logged in: 0
Memory usage: 6% IP address for eth0: 10.0.2.15
Swap usage: 0% IP address for eth1: 192.168.103.100

Graph this data and manage this system at:
https://landscape.canonical.com/

0 updates can be installed immediately.
0 of these updates are security updates.

New release ‘16.04.6 LTS’ available.
Run ‘do-release-upgrade’ to upgrade to it.

Last login: Thu May 16 07:58:50 2019 from 10.0.2.2
vagrant@m103:~$ mongo
MongoDB shell version v3.6.12
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“16f0d1b1-6949-43ff-a50f-8934112e4e04”) }
MongoDB server version: 3.6.12
Welcome to the MongoDB shell.
For interactive help, type “help”.
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Server has startup warnings:
2019-05-16T07:59:07.717+0000 I STORAGE [initandlisten]
2019-05-16T07:59:07.717+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-05-16T07:59:07.717+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten]
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten]
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten] ** Start the server with --bind_ip to specify which IP
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten]
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten]
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-05-16T07:59:08.311+0000 I CONTROL [initandlisten]
2019-05-16T07:59:08.312+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2019-05-16T07:59:08.312+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-05-16T07:59:08.312+0000 I CONTROL [initandlisten]
MongoDB Enterprise > show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
MongoDB Enterprise > use admin
switched to db admin
MongoDB Enterprise > db.shutdownServer()
server should be down…
2019-05-16T08:36:58.305+0000 I NETWORK [thread1] trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2019-05-16T08:36:58.305+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2019-05-16T08:36:58.305+0000 I NETWORK [thread1] reconnect 127.0.0.1:27017 (127.0.0.1) failed failed
MongoDB Enterprise > db.shutdownServer()
2019-05-16T08:37:47.797+0000 I NETWORK [thread1] trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2019-05-16T08:37:47.797+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2019-05-16T08:37:47.797+0000 I NETWORK [thread1] reconnect 127.0.0.1:27017 (127.0.0.1) failed failed
server should be down…
MongoDB Enterprise > mongo --shutdown
2019-05-16T08:39:42.489+0000 E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:8
MongoDB Enterprise >

It means the server has been shutdown. You can also check mongod.log file or mongod command line logs.

To exit out of mongo shell, type quit().

MongoDB Enterprise > quit()

Kanika

1 Like