I'm completely stuck [Solved]

I’ve spent hours attempting to get through the launching mongod lab without success.
I sometimes get the listener up and can access the databases and even create the User m103-admin. Not always, but I’ve been successful on a few occasions.

I’ve never been successful with validating the lab.

I still don’t understand exactly what this command is doing: mongod --config /etc/mongod.conf
Is it telling mongod to look for the config file in that particular location?
If so, I don’t know how to access that on a Mac, or perhaps use another location.

OK. . . .
(I am coming at this linux ‘thing’ from Windows. . . so:)
you have to be IN the vagrant 'shell/connection TO the linux VM. so any ‘path’ is inside the vagrant VM NOT your mac.

starting the ‘path’ with / means start at the very root of the directory structure (inside the VM) if you type pwd (then enter) it will tell you 'where you are currently (i.e. /var/db) if you enter cd /etc it will take you to THAT location.(the etc directory)

I follow you there. Where will I find the .config file?

vagrant@m103:~ cd /home vagrant@m103:/home ls
ubuntu vagrant
vagrant@m103:/home$ cd /home/ubuntu
vagrant@m103:/home/ubuntu$ ls
vagrant@m103:/home/ubuntu$ cd
vagrant@m103:~ cd /home/vagrant vagrant@m103:~ ls
data
vagrant@m103:~ ls data vagrant@m103:~ cd data
vagrant@m103:~/data$ ls
WiredTiger index-1-4232304358281933275.wt
WiredTiger.lock index-3-385883909395993432.wt
WiredTiger.turtle index-3-4232304358281933275.wt
WiredTiger.wt index-4-385883909395993432.wt
WiredTigerLAS.wt index-5-4232304358281933275.wt
_mdb_catalog.wt index-7-4232304358281933275.wt
collection-0-385883909395993432.wt journal
collection-0-4232304358281933275.wt mongod.lock
collection-2-385883909395993432.wt mongod.log
collection-2-4232304358281933275.wt mongod.log.2019-03-19T02-19-15
collection-4-4232304358281933275.wt mongod.log.2019-03-19T02-21-06
collection-6-4232304358281933275.wt sizeStorer.wt
diagnostic.data storage.bson
index-1-385883909395993432.wt
vagrant@m103:~/data$

How did you start mongod?
If this is what you used
mongod --config /etc/mongod.conf

Your config file is under /etc
The command says start mongod using the config file located under /etc
Please follow your course instructions step by step.It will be clear

When I type mongod --config “etc/mongod.conf”, the following:

Welcome to Ubuntu 14.04.6 LTS (GNU/Linux 3.13.0-166-generic x86_64)

System information as of Tue Mar 19 04:58:12 UTC 2019

System load: 0.0 Processes: 85
Usage of /: 7.3% 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/

Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud

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

Last login: Tue Mar 19 04:58:13 2019 from 10.0.2.2
vagrant@m103:~$ mongod --config "/etc/mongod.conf

I get the following, If I type the commands in manually:

Last login: Tue Mar 19 04:58:13 2019 from 10.0.2.2
vagrant@m103:~$ mongod --config "/etc/mongod.conf

^C
vagrant@m103:~$ mongod --port 27000 --dbpath /data/db/ --bind_ip “localhost, 192.168.103.100” --auth
2019-03-19T05:05:13.881+0000 I CONTROL [initandlisten] MongoDB starting : pid=2456 port=27000 dbpath=/data/db/ 64-bit host=m103
2019-03-19T05:05:13.881+0000 I CONTROL [initandlisten] db version v3.6.11
2019-03-19T05:05:13.882+0000 I CONTROL [initandlisten] git version: b4339db12bf57ffee5b84a95c6919dbd35fe31c9
2019-03-19T05:05:13.882+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2019-03-19T05:05:13.883+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-03-19T05:05:13.883+0000 I CONTROL [initandlisten] modules: enterprise
2019-03-19T05:05:13.883+0000 I CONTROL [initandlisten] build environment:
2019-03-19T05:05:13.884+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2019-03-19T05:05:13.884+0000 I CONTROL [initandlisten] distarch: x86_64
2019-03-19T05:05:13.884+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-03-19T05:05:13.884+0000 I CONTROL [initandlisten] options: { net: { bindIp: “localhost, 192.168.103.100”, port: 27000 }, security: { authorization: “enabled” }, storage: { dbPath: “/data/db/” } }
2019-03-19T05:05:13.885+0000 I - [initandlisten] Detected data files in /data/db/ created by the ‘wiredTiger’ storage engine, so setting the active storage engine to ‘wiredTiger’.
2019-03-19T05:05:13.886+0000 I STORAGE [initandlisten]
2019-03-19T05:05:13.886+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-03-19T05:05:13.887+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-03-19T05:05:13.887+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=488M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),compatibility=(release=“3.0”,require_max=“3.0”),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2019-03-19T05:05:14.434+0000 I STORAGE [initandlisten] WiredTiger message [1552971914:434381][2456:0x7f9793b00a80], txn-recover: Main recovery loop: starting at 11/6784
2019-03-19T05:05:14.498+0000 I STORAGE [initandlisten] WiredTiger message [1552971914:498443][2456:0x7f9793b00a80], txn-recover: Recovering log 11 through 12
2019-03-19T05:05:14.537+0000 I STORAGE [initandlisten] WiredTiger message [1552971914:537383][2456:0x7f9793b00a80], txn-recover: Recovering log 12 through 12
2019-03-19T05:05:14.572+0000 I STORAGE [initandlisten] WiredTiger message [1552971914:572691][2456:0x7f9793b00a80], txn-recover: Set global recovery timestamp: 0
2019-03-19T05:05:14.589+0000 I CONTROL [initandlisten]
2019-03-19T05:05:14.589+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2019-03-19T05:05:14.589+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-03-19T05:05:14.589+0000 I CONTROL [initandlisten]
2019-03-19T05:05:14.589+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2019-03-19T05:05:14.589+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-03-19T05:05:14.589+0000 I CONTROL [initandlisten]
2019-03-19T05:05:14.595+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory ‘/data/db/diagnostic.data’
2019-03-19T05:05:14.596+0000 I NETWORK [initandlisten] waiting for connections on port 27000
2019-03-19T05:06:39.435+0000 I NETWORK [listener] connection accepted from 127.0.0.1:51299 #1 (1 connection now open)
2019-03-19T05:06:39.436+0000 I NETWORK [conn1] received client metadata from 127.0.0.1:51299 conn1: { application: { name: “MongoDB Shell” }, driver: { name: “MongoDB Internal Client”, version: “3.6.11” }, os: { type: “Linux”, name: “Ubuntu”, architecture: “x86_64”, version: “14.04” } }

This is what I see at the mongo terminal:

Last login: Tue Mar 19 00:57:37 on ttys000
R5170043:~ rsp07$ cd university/m103
R5170043:m103 rsp07$ vagrant ssh
Welcome to Ubuntu 14.04.6 LTS (GNU/Linux 3.13.0-166-generic x86_64)

System information as of Tue Mar 19 05:03:42 UTC 2019

System load: 0.0 Processes: 85
Usage of /: 7.3% 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/

Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud

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

Last login: Tue Mar 19 05:03:42 2019 from 10.0.2.2
vagrant@m103:~$ mongo --port 27000
MongoDB shell version v3.6.11
connecting to: mongodb://127.0.0.1:27000/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“534be06e-6dcd-45a1-bf44-234a3472b4e1”) }
MongoDB server version: 3.6.11
MongoDB Enterprise > show dbs
2019-03-19T05:07:13.387+0000 E QUERY [thread1] Error: listDatabases failed:{
“ok” : 0,
“errmsg” : “there are no users authenticated”,
“code” : 13,
“codeName” : “Unauthorized”
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:67:1
shellHelper.show@src/mongo/shell/utils.js:860:19
shellHelper@src/mongo/shell/utils.js:750:15
@(shellhelp2):1:1
MongoDB Enterprise >

I’ve verified M103-admin already exists:

vagrant@m103:~$ mongo --port 27000
MongoDB shell version v3.6.11
connecting to: mongodb://127.0.0.1:27000/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“6d6b1890-4f17-4921-ad32-da0678926eb9”) }
MongoDB server version: 3.6.11
Server has startup warnings:
2019-03-19T05:10:13.652+0000 I STORAGE [initandlisten]
2019-03-19T05:10:13.652+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-03-19T05:10:13.653+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-03-19T05:10:14.249+0000 I CONTROL [initandlisten]
2019-03-19T05:10:14.249+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-03-19T05:10:14.249+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2019-03-19T05:10:14.249+0000 I CONTROL [initandlisten]
2019-03-19T05:10:14.249+0000 I CONTROL [initandlisten]
2019-03-19T05:10:14.250+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2019-03-19T05:10:14.250+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-03-19T05:10:14.250+0000 I CONTROL [initandlisten]
2019-03-19T05:10:14.250+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2019-03-19T05:10:14.250+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-03-19T05:10:14.250+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.createUser({
… user: “m103-admin”,
… pwd: “m103-pass”,
… roles: [
… {role: “root”, db: “admin”}
… ]
… })
2019-03-19T05:10:52.163+0000 E QUERY [thread1] Error: couldn’t add user: User “m103-admin@admin” already exists :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1437:15
@(shell):1:1
MongoDB Enterprise >

So what is the issue you are facing?
I see your mongod is up and also you are able to connect and user also exists
Since you have started mongod with --auth
connect using a valid userid/pwd as below

mongo -u m103-admin -p m103-pass --authenticationDatabase admin --port 27000
Which validate lab is failing and what error you are getting

Thank you for your help with this. The problem I’m having is using a config file. I understand it’s purpose and that the command mongod --config “/etc/mongod.conf” directs mongod to the mongod.conf file located in /etc. I just can’t find the etc directory and create the file.

Also, when I run “validate_lab_launch_mongod” in the mongo shell, I receive a message that I need to “bind the IP address to 192.168.103.100”.

This is what I have in mongod:vagrant@m103:~$ mongod --port 27000 --dbpath /data/db/ --bind_ip “localhost, 192.168.103.100”
2019-03-19T12:14:30.417+0000 I CONTROL [initandlisten] MongoDB starting : pid=2092 port=27000 dbpath=/data/db/ 64-bit host=m103
2019-03-19T12:14:30.418+0000 I CONTROL [initandlisten] db version v3.6.11
2019-03-19T12:14:30.418+0000 I CONTROL [initandlisten] git version: b4339db12bf57ffee5b84a95c6919dbd35fe31c9
2019-03-19T12:14:30.419+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2019-03-19T12:14:30.419+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-03-19T12:14:30.419+0000 I CONTROL [initandlisten] modules: enterprise
2019-03-19T12:14:30.419+0000 I CONTROL [initandlisten] build environment:
2019-03-19T12:14:30.420+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2019-03-19T12:14:30.420+0000 I CONTROL [initandlisten] distarch: x86_64
2019-03-19T12:14:30.420+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-03-19T12:14:30.421+0000 I CONTROL [initandlisten] options: { net: { bindIp: “localhost, 192.168.103.100”, port: 27000 }, storage: { dbPath: “/data/db/” } }
2019-03-19T12:14:30.422+0000 I - [initandlisten] Detected data files in /data/db/ created by the ‘wiredTiger’ storage engine, so setting the active storage engine to ‘wiredTiger’.
2019-03-19T12:14:30.423+0000 I STORAGE [initandlisten]
2019-03-19T12:14:30.423+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-03-19T12:14:30.423+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-03-19T12:14:30.423+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=488M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),compatibility=(release=“3.0”,require_max=“3.0”),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2019-03-19T12:14:30.870+0000 I STORAGE [initandlisten] WiredTiger message [1552997670:870672][2092:0x7f284656ca80], txn-recover: Main recovery loop: starting at 14/9088
2019-03-19T12:14:30.934+0000 I STORAGE [initandlisten] WiredTiger message [1552997670:934821][2092:0x7f284656ca80], txn-recover: Recovering log 14 through 15
2019-03-19T12:14:30.974+0000 I STORAGE [initandlisten] WiredTiger message [1552997670:974390][2092:0x7f284656ca80], txn-recover: Recovering log 15 through 15
2019-03-19T12:14:31.008+0000 I STORAGE [initandlisten] WiredTiger message [1552997671:8260][2092:0x7f284656ca80], txn-recover: Set global recovery timestamp: 0
2019-03-19T12:14:31.020+0000 I CONTROL [initandlisten]
2019-03-19T12:14:31.020+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-03-19T12:14:31.020+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2019-03-19T12:14:31.020+0000 I CONTROL [initandlisten]
2019-03-19T12:14:31.020+0000 I CONTROL [initandlisten]
2019-03-19T12:14:31.020+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2019-03-19T12:14:31.020+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-03-19T12:14:31.020+0000 I CONTROL [initandlisten]
2019-03-19T12:14:31.021+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2019-03-19T12:14:31.021+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-03-19T12:14:31.021+0000 I CONTROL [initandlisten]
2019-03-19T12:14:31.023+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory ‘/data/db/diagnostic.data’
2019-03-19T12:14:31.023+0000 I NETWORK [initandlisten] waiting for connections on port 27000
2019-03-19T12:14:55.548+0000 I NETWORK [listener] connection accepted from 127.0.0.1:47843 #1 (1 connection now open)
2019-03-19T12:14:55.549+0000 I NETWORK [conn1] received client metadata from 127.0.0.1:47843 conn1: { driver: { name: “mongo-go-driver”, version: “local build” }, os: { type: “linux”, architecture: “amd64” }, platform: “go1.9.2” }
2019-03-19T12:14:55.560+0000 I ACCESS [conn1] Successfully authenticated as principal m103-admin on admin
2019-03-19T12:14:55.562+0000 I NETWORK [listener] connection accepted from 127.0.0.1:47845 #2 (2 connections now open)
2019-03-19T12:14:55.562+0000 I NETWORK [conn2] received client metadata from 127.0.0.1:47845 conn2: { platform: “go1.9.2”, driver: { name: “mongo-go-driver”, version: “local build” }, os: { architecture: “amd64”, type: “linux” } }
2019-03-19T12:14:55.572+0000 I ACCESS [conn2] Successfully authenticated as principal m103-admin on admin
2019-03-19T12:14:55.580+0000 I ACCESS [conn2] Successfully authenticated as principal m103-admin on admin
2019-03-19T12:14:55.588+0000 I ACCESS [conn2] Successfully authenticated as principal m103-admin on admin
2019-03-19T12:14:55.590+0000 I NETWORK [conn1] end connection 127.0.0.1:47843 (1 connection now open)
2019-03-19T12:14:55.590+0000 I NETWORK [conn2] end connection 127.0.0.1:47845 (0 connections now open)

I should clarify that I ran validate_lab_launch_mongod on vagrant, not inside mongo.

vagrant@m103:~$ validate_lab_launch_mongod

You need to bind the IP address to 192.168.103.100.

As the error indicates:

However from your logs, I can see that your are doing that:

But you stumbled on one of the few problematic issues. The space after localhost, is the culprit.

Thank You for your help!

I am also facing the same issue. I want to edit the mongod.conf file but to do this, first I need to locate the /etc directive but I can’t locate it I am using the vagrant on windows…
Please help me.

Hi @tanish_g,

If you have already created file under /etc folder then follow these steps from within vagrant:

cd /etc/

To check if mongod.conf exists, list the files and folders using the following command:

ls

If you do not find mongod.conf file, then you can create mongod.conf file and save it in the /shared folder in m103-vagrant-env directory.

Then you can start your mongod process as follows:

mongod -f /shared/mongod.conf

Please let me know, if you have any questions.

Thanks,
Sonali