Not master and slaveOk=false

i alway run into this error i try to start the lab form scratch but ran in same error
i use the createUser form the the lab juste before

any one can help?

vagrant@m103:~$ mongo --port 27000 --username m103-admin --password m103-pass
MongoDB shell version v3.6.17
connecting to: mongodb://
Implicit session: session { “id” : UUID(“503a06f3-654f-4569-ab96-e16e8a01f972”) }
MongoDB server version: 3.6.17
Server has startup warnings:
2020-02-06T19:28:19.055+0000 I STORAGE [initandlisten]
2020-02-06T19:28:19.055+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2020-02-06T19:28:19.055+0000 I STORAGE [initandlisten] ** See
MongoDB Enterprise > show dbs
2020-02-06T19:30:22.265+0000 E QUERY [thread1] Error: listDatabases failed:{
“ok” : 0,
“errmsg” : “not master and slaveOk=false”,
“code” : 13435,
“codeName” : “NotMasterNoSlaveOk”
} :
MongoDB Enterprise >

It looks like you are connected to a replica set that is not initialized.

Try rs.status().

Please provide the output of ps -aef | grep [m]mongod. And if you started mongod with a configuration file, the content of the file would be usefull.

rs.status() show me the problem THX
so i can now look for binding IP

but here is the information:

MongoDB Enterprise > rs.status()
“info” : “run rs.initiate(…) if not yet done for the set”,
“ok” : 0,
“errmsg” : “no replset config has been received”,
“code” : 94,
“codeName” : “NotYetInitialized”

vagrant@m103:~$ ps -aef | grep mongod
vagrant 10913 10456 0 21:18 pts/0 00:00:00 nano /data/log/mongod.log
vagrant 11062 10456 0 21:25 pts/0 00:00:00 nano /data/log/mongod.log
vagrant 11063 10456 0 21:25 pts/0 00:00:00 nano /data/log/mongod.log
vagrant 11193 1 1 21:43 ? 00:00:24 mongod --config /etc/mongod_m103.conf
vagrant 11414 10456 0 22:05 pts/0 00:00:00 grep --color=auto mongod


for documentation of all options, see:

Where and how to store data.

dbPath: /data/db
enabled: true

where to write logging data.

destination: file
logAppend: true
path: /data/log/mongod.log

network interfaces

port: 27000

how the process runs

timeZoneInfo: /usr/share/zoneinfo
fork: true

authorization: enabled

replSetName: M103

The space after the comma might cause you problem.

And as the info field indicates:

Finally, be aware that you have 3 editors open with the same file. You might overwrite the changes made in one when you save from another.

1 Like

Thank you very much four you help

I’m not familiar with Linux.

Thanks @steevej-1495,

Hi @Sylvain_35135,

I’m glad your issue got resolved. Very soon we are going to add an optional chapter on Linux in this course so that the users from non-linux background do not struggle with it.

Shubham Ranjan
Curriculum Services Engineer