Unable to excute validate_lab_different_logpath command on vagrant

Hello,
I have performed all steps as mentioned in the task, unable to execute validate_lab_different_logpath command getting an error “validate_lab_different_logpath: command not found”

Could please help.

Task:
Your task for this lab is to change the config file such that:

  • mongod sends logs to /var/mongodb/db/mongod.log
  • mongod is forked and run as a daemon (this will not work without a logpath)
  • any query that takes 50ms or longer is logged (remember to specify this in the configuration file!)

My configuration file:
step 1: root@m103:~# mongo admin --port 27000 -u m103-admin -p m103-pass --eval ‘db.shutdownServer()’
MongoDB shell version v3.6.14
connecting to: mongodb://127.0.0.1:27000/admin?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“ca8efbfb-86a6-4349-ab2e-1edf13020a22”) }
MongoDB server version: 3.6.14
server should be down…
2019-09-22T19:09:24.011+0000 I NETWORK [thread1] trying reconnect to 127.0.0.1:27000 (127.0.0.1) failed
2019-09-22T19:09:24.013+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27000, in(checking socket for error after poll), reason: Connection refused
2019-09-22T19:09:24.013+0000 I NETWORK [thread1] reconnect 127.0.0.1:27000 (127.0.0.1) failed failed
2019-09-22T19:09:24.013+0000 I QUERY [thread1] Failed to end session { id: UUID(“ca8efbfb-86a6-4349-ab2e-1edf13020a22”) } due to SocketException: socket exception [CONNECT_ERROR] for couldn’t connect to server 127.0.0.1:27000, connection attempt failed

Step 2: my mongod.conf file
root@m103:~# cat /root/mongod.conf
storage:
dbPath: “/var/mongodb/db/”
systemLog:
path: “/var/mongodb/db/mongod.log”
destination: “file”
logAppend: true
net:
bindIp : “127.0.0.1,192.168.103.100”
port: 27000
security:
authorization: enabled
processManagement:
fork : true
operationProfiling:
slowOpThresholdMs: 50
root@m103:~#

step3 root@m103:~# mongod --config /root/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 3425
child process started successfully, parent exiting
root@m103:~#

step4
root@m103:~# validate_lab_different_logpath
validate_lab_different_logpath: command not found
root@m103:~#

Seems all your work is done as root user
You should not use root

You should run as vagrant
vagrant@m103:~$ id
uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant)
When you vagrant ssh you are automatically set to vagrant
Did you sudo again?

1 Like

I am having a similar problem. What does this error mean? I can confirm that mongod is running on port 27000 and that the m103-admin user exists.

image

Hi @Michael_Williams_92594,

Can you please share the command that you are using to launch your mongod process and the details of how the user was created?

There probably might be some issue in those and looking at it will help us debug in a better way.

Thanks,
Muskan
Curriculum Support Engineer

vagrant@m103:~$ mongod --config mongod.conf

Here is my config file:

storage:
dbPath: /var/mongodb/db
net:
bindIp: 192.168.103.100,localhost
port: 27000
security:
authorization: enabled

Hi @Michael_Williams_92594,

Is this your complete configuration file?

Also, in your other post I can see that you have already checked if the user exists and the localhost mapping to IP address 127.0.0.1 is correct.

Can you please share the exact set of commands you are using to create the user and please confirm if the user is created with “root” role on admin database.

Thanks,
Muskan
Curriculum Support Engineer