Validation - Mongos not configured correctly

vagrant@m103:~$ validate_lab_first_sharded_cluster
Mongos not configured correctly - make sure you have only added one shard to
your cluster.

I am facing this issue can anyone guide me through.

What have you tried to resolve the issue?

1 Like

shards:
{ “_id” : “m103-example”, “host” : “m103-example/192.168.103.100:27011,192.168.103.100:27012,192.168.103.100:27013”, “state” : 1 }
{ “_id” : “m103-repl”, “host” : “m103-repl/192.168.103.100:27001,192.168.103.100:27002,m103:27003”, “state” : 1, “draining” : true }

here are my shards

But what have you tried to resolve the issue? For example, did you rebuild the whole thing from scratch, change the shard key etc?

1 Like

I just made a copy of the previous lecturer conf files to the new directory and changed the instructions according to the lab’s spec

Ok. Suggest having a look through all parts of your config files again and start from the beginning. According to the message, the configuration is not correct.

1 Like

vagrant@m103:~/lab$ tree
.

|-- mongos.conf
|-- repl-set
| |-- repl1.conf
| |-- repl2.conf
| |-- repl3.conf
| – shard
| |-- csrs1.conf
| |-- csrs2.conf
| |-- csrs3.conf

this is the structure of lab file i created

mongos conf

vagrant@m103:~/lab$ cat mongos.conf
sharding:
configDB: m103-csrs/192.168.103.100:26001,m103:26002,m103:26003
security:
keyFile: /var/mongodb/pki/m103-keyfile
net:
bindIp: localhost,192.168.103.100
port: 26000
systemLog:
destination: file
path: /var/mongodb/db/mongos.log
logAppend: true
processManagement:
fork: true

replica set repl1.conf

vagrant@m103:~/lab/repl-set$ cat repl1.conf
sharding:
clusterRole: shardsvr
storage:
dbPath: /var/mongodb/db/nodeone
wiredTiger:
engineConfig:
cacheSizeGB: .1
net:
bindIp: 192.168.103.100,localhost
port: 27001
security:
keyFile: /var/mongodb/pki/m103-keyfile
systemLog:
destination: file
path: /var/mongodb/db/nodeone/mongod.log
logAppend: true
processManagement:
fork: true
replication:
replSetName: m103-repl

csrv file csrv1.conf

vagrant@m103:~/lab/shard$ cat csrs1.conf
sharding:
clusterRole: configsvr
replication:
replSetName: m103-csrs
security:
keyFile: /var/mongodb/pki/m103-keyfile
net:
bindIp: localhost,192.168.103.100
port: 26001
systemLog:
destination: file
path: /var/mongodb/db/csrs1/mongod.log
logAppend: true
processManagement:
fork: true
storage:
dbPath: /var/mongodb/db/csrs1

@Rakshith_79674 I didn’t ask to see your config files. :wink:
As this is a lab for students, I just said that you should go through them yourself and work out what’s missing/wrong.

As a hint, I’ll suggest again that you go through the instructions in the lab and see if you’ve followed all the instructions.

1 Like

Hi @Rakshith_79674,

As suggested by @007_jb, please go through the instruction in lab noted very carefully.

As per the lab (as below), you required only one shard - m103-repl. The lab makes no mention of m103-example which is added in your configuration.

  1. Enable sharding on m103-repl
  2. Add m103-repl as the primary shard in the cluster

I would suggest you to please start everything from scratch, following the instruction in lab line by line - which will be to set up three config servers, three nodes for m103-repl shard, mongos.
Then enable sharding on m103-repl only and add only this one as a shard in your cluster.

Let me know if you have any more questions.

Thanks,
Muskan

1 Like

I removed the db and log files and retried it from scratch, I solved it

Thank you @007_jb @Muskan_47318

I knew you could do it :+1:

1 Like