Changes on the mongod.conf file does not work

I changed port and db path from /etc/mongod.conf file but when I ran mongod, I saw that port is 27017 and path is /data/db.
It looks like somewhere mongod read a default mongod.conf settings.
Where did I go wrong?

27017 is the default port
The file you used is the default config file owned by root
What command you used to edit it?
Most likely your changes did not get saved
Try to use your own config file

Yes I know, I changed default port to 27000 as wanted. I switched to root and I am sure file is changed (checked).

Ok

In that case you may be having two files
mongod -f /etc/mongod.conf
or mongod -f mongod.conf—>runs from current dir
It depends how you started the mongod
Did you notice from mongod.log or ps -ef|grep mongo that it is using port 27017

If you just issue mongo on Unix it will connect to default port 27017

The /etc/mongod.conf file is used when you start MongoDB as a service. Running just mongod will not use the /etc/mongod.conf file. You will learn how to use a config file in a future lecture.

For this lab, you need to use mongod options, and not a config file.

I search all mongod.conf files and find only one at /etc/mongod.conf
I configure to listen port 27000 but with mongod port is still 27017.
I also checked log file.
vagrant@m103:~$ mongod 2020-02-23T02:23:04.990+0000 I CONTROL [initandlisten] MongoDB starting : pid=14151 port=27017 dbpath=/data/db 64-bit host=m103 2020-02-23T02:23:04.991+0000 I CONTROL [initandlisten] db version v3.6.17
and
2020-02-23T02:23:05.755+0000 I NETWORK [initandlisten] listening via socket bound to 127.0.0.1 2020-02-23T02:23:05.755+0000 I NETWORK [initandlisten] listening via socket bound to /tmp/mongodb-27017.sock 2020-02-23T02:23:05.756+0000 I NETWORK [initandlisten] waiting for connections on port 27017
logs shows that default values comes from somewhere :frowning:

Is there any command which shows active mongod.conf file used on running mongo?

There are two mongod.confnamed file on the system.
root@m103:/# find / -name mongod.conf
/etc/mongod.conf
/etc/init/mongod.conf
but second file has totally different purpose.

Can you please show output of ps -ef|grep mongo
What command you used to start your mongod

vagrant 15485 14038 0 06:14 pts/0 00:00:00 mongo
root 15616 15540 0 06:34 pts/1 00:00:00 grep --color=auto mongo

I am using mongod I also tried mongod --config <PathHere>

If you just run mongod without any options it will start mongod on default port 27017 and default dirpath /data/db
Please kill the session

kill -9 15485

Bring up your mongod with appropriate parameters
As 007_jb mentioned you don’t need config file for this lab
If you are trying with that option you can see from ps -efgrep mongod output it uses config file you are using
Make sure to kill currently running instance if it is using same port,path etc

Thank you both of you.
I follow the log file. Connection succesfully made but my user is not found.
2020-02-23T07:01:02.609+0000 I NETWORK [listener] connection accepted from 127.0.0.1:43327 #2 (1 connection now open) 2020-02-23T07:01:02.609+0000 I NETWORK [conn2] received client metadata from 127.0.0.1:43327 conn2: { driver: { name: "mongo-go-driver", version: "local build" }, os: { architecture: "amd64", type: "linux" }, platform: "go1.9.2" } 2020-02-23T07:01:02.610+0000 I ACCESS [conn2] SCRAM-SHA-1 authentication failed for m103-admin on admin from client 127.0.0.1:43327 ; UserNotFound: Could not find user m103-admin@admin
Is this Ubuntu user? Or mongo user?
Edit:mongodb user. Created successfully.

I created that user. It is ok now. But I have new error message says core dumped :frowning:

You get the error when you do what?

With this
mongod -f /etc/mongod.conf
If I run mongod directly it is running on default port etc.

Here is my mongod.conf file

mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/mongodb/db/
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  bindIp: 127.0.0.1,192.168.103.100
  port: 27000


# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo

#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

security:
  authorization: enabled

and file permissions under /etc
-rw-r--r-- 1 vagrant vagrant 678 Feb 23 07:28 mongod.conf
also folder permissions under /var
drwxr-xr-x 3 vagrant vagrant 4096 Feb 21 20:19 mongodb

You will never need to need to use the /etc/mongod.conf file throughout this course so don’t bother editing it. Plus I’ve already explained where this file is used which is out of scope for this course.

Can you please confirm the title of the lab that you’re working on?

M103-> Chapter 1

On your host machine (Windows maybe?), there’s a sub folder called shared. It should be in the same location as the vagrantfile and provision file. It is inside this folder that you will create your config files throughout this course because it is synced to the /shared folder on the VM. So on your VM, type the following command: ls -l /shared. To run a file called mongod.conf that’s located in the /shared folder, you do:
mongod -f /shared/mongod.conf
image
Let us know if you need more clarity.