M103 chapter labs

so I should change the path in my .conf to “~/var/mongodb/db/”?

  1. I would recommend to use full path name.
  2. Some validation scripts for the labs expect thing to be at the exact location requested. So if they want you to put stuff in /var/… use /var/…, nothing else.

does this seem alright to you?27%20AM

Hi Akbar_91991,

The configuration file seems right. You are doing great! Just one step, create a directory /var/mongodb/db and not var/mongodb/.

   vagrant@m103:~$ sudo mkdir -p /var/mongodb/db
   vagrant@m103:~$ sudo chown vagrant:vagrant /var/mongodb/db

And you can always use pwd command to see the working directory like:

  vagrant@m103:~$ cd /var/mongodb/db
  vagrant@m103:/var/mongodb/db$ pwd
  /var/mongodb/db

Let me know if it helps.

Kanika

any one have this error vagrant@vagrant-ubuntu-trusty-64:/data$ mongod --port 27000 --dbpath /home/data/lab1 --logpath /home/data/lab1.log --bind_ip “127.0.0.1, 192.168.103.100” --auth --fork
about to fork child process, waiting until server is ready for connections.
forked process: 2361
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the “–fork” option.
vagrant@vagrant-ubuntu-trusty-64:/data$

The first thing to do would be to start without the –fork option like the error message suggest. Alternatively you could look at the log file to have additional information.

here is the log

2019-01-15T19:32:42.446+0000 I CONTROL [initandlisten] MongoDB starting : pid=2875 port=27000 dbpath=/home/data/lab1 64-bit host=vagrant-ubuntu-trusty-64.localdomain
2019-01-15T19:32:42.447+0000 I CONTROL [initandlisten] db version v3.6.9
2019-01-15T19:32:42.447+0000 I CONTROL [initandlisten] git version: 167861a164723168adfaaa866f310cb94010428f
2019-01-15T19:32:42.447+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2019-01-15T19:32:42.447+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-01-15T19:32:42.447+0000 I CONTROL [initandlisten] modules: enterprise
2019-01-15T19:32:42.447+0000 I CONTROL [initandlisten] build environment:
2019-01-15T19:32:42.447+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2019-01-15T19:32:42.447+0000 I CONTROL [initandlisten] distarch: x86_64
2019-01-15T19:32:42.447+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-01-15T19:32:42.447+0000 I CONTROL [initandlisten] options: { net: { bindIp: “127.0.0.1, 192.168.103.100”, port: 27000 }, storage: { dbPath: “/home/data/lab1” }, systemLog: { destination: “file”, path: “/home/data/lab1.log” } }
2019-01-15T19:32:42.449+0000 E STORAGE [initandlisten] Failed to set up listener: SocketException: Cannot assign requested address
2019-01-15T19:32:42.449+0000 I CONTROL [initandlisten] now exiting
2019-01-15T19:32:42.449+0000 I CONTROL [initandlisten] shutting down with code:48
~

so when i use the localhost only it work fine

Try removing the space between the 2 IP addresses and the comma.

mongod --dbpath /home/data/lab1 --logpath /home/data/lab1.log --port 27000 --bind_ip “localhost,192.168.103.100” --auth --fork

still the same output

You may have another process listening to this port.

Run netstat -tlnp, to see listening sockets.