Error :could not get updated shard list from config server due to Operation timed out

Getting the error when doing -
sh.addShard(“m103-repl/m103:27001”)

also tried below with same results -
sh.addShard(“m103-repl/192.168.103.100:27001”)

Here is output of ps
vagrant@m103:~$ ps -xa | grep mongo
3544 ? Sl 0:59 mongos -f mongos.conf
5227 ? Sl 0:33 mongod -f csrs_1.conf
5269 ? Sl 0:28 mongod -f csrs_2.conf
5306 ? Sl 0:29 mongod -f csrs_3.conf
5649 ? Sl 0:21 mongod -f mongod-repl-1.conf
5726 ? Sl 0:21 mongod -f mongod-repl-2.conf
5812 ? Sl 0:21 mongod -f mongod-repl-3.conf
6043 pts/0 S+ 0:00 grep --color=auto mongo

Hi @SwapanDas,

Did you initiate() the Config server replica set (m103-csrs) ?

Are you able to connect to the m103-csrs replica set ?

If yes, then please share the output of the following command :

rs.status()

In addition to this please share the output of the ping result:

ping m103

Thanks,
Shubham Ranjan
Curriculum Services Engineer

Here you go -

MongoDB Enterprise m103-csrs:PRIMARY> rs.status()
{
“set” : “m103-csrs”,
“date” : ISODate(“2020-01-08T12:02:44.828Z”),
“myState” : 1,
“term” : NumberLong(3),
“syncingTo” : “”,
“syncSourceHost” : “”,
“syncSourceId” : -1,
“configsvr” : true,
“heartbeatIntervalMillis” : NumberLong(2000),
“optimes” : {
“lastCommittedOpTime” : {
“ts” : Timestamp(1578484956, 1),
“t” : NumberLong(3)
},
“readConcernMajorityOpTime” : {
“ts” : Timestamp(1578484956, 1),
“t” : NumberLong(3)
},
“appliedOpTime” : {
“ts” : Timestamp(1578484956, 1),
“t” : NumberLong(3)
},
“durableOpTime” : {
“ts” : Timestamp(1578484956, 1),
“t” : NumberLong(3)
}
},
“members” : [
{
“_id” : 0,
“name” : “192.168.103.100:26001”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 171,
“optime” : {
“ts” : Timestamp(1578484956, 1),
“t” : NumberLong(3)
},
“optimeDate” : ISODate(“2020-01-08T12:02:36Z”),
“syncingTo” : “”,
“syncSourceHost” : “”,
“syncSourceId” : -1,
“infoMessage” : “”,
“electionTime” : Timestamp(1578484804, 1),
“electionDate” : ISODate(“2020-01-08T12:00:04Z”),
“configVersion” : 3,
“self” : true,
“lastHeartbeatMessage” : “”
},
{
“_id” : 1,
“name” : “m103:26002”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 163,
“optime” : {
“ts” : Timestamp(1578484956, 1),
“t” : NumberLong(3)
},
“optimeDurable” : {
“ts” : Timestamp(1578484956, 1),
“t” : NumberLong(3)
},
“optimeDate” : ISODate(“2020-01-08T12:02:36Z”),
“optimeDurableDate” : ISODate(“2020-01-08T12:02:36Z”),
“lastHeartbeat” : ISODate(“2020-01-08T12:02:42.975Z”),
“lastHeartbeatRecv” : ISODate(“2020-01-08T12:02:43.404Z”),
“pingMs” : NumberLong(0),
“lastHeartbeatMessage” : “”,
“syncingTo” : “192.168.103.100:26001”,
“syncSourceHost” : “192.168.103.100:26001”,
“syncSourceId” : 0,
“infoMessage” : “”,
“configVersion” : 3
},
{
“_id” : 2,
“name” : “m103:26003”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 156,
“optime” : {
“ts” : Timestamp(1578484956, 1),
“t” : NumberLong(3)
},
“optimeDurable” : {
“ts” : Timestamp(1578484956, 1),
“t” : NumberLong(3)
},
“optimeDate” : ISODate(“2020-01-08T12:02:36Z”),
“optimeDurableDate” : ISODate(“2020-01-08T12:02:36Z”),
“lastHeartbeat” : ISODate(“2020-01-08T12:02:42.974Z”),
“lastHeartbeatRecv” : ISODate(“2020-01-08T12:02:43.662Z”),
“pingMs” : NumberLong(0),
“lastHeartbeatMessage” : “”,
“syncingTo” : “m103:26002”,
“syncSourceHost” : “m103:26002”,
“syncSourceId” : 1,
“infoMessage” : “”,
“configVersion” : 3
}
],
“ok” : 1,
“operationTime” : Timestamp(1578484956, 1),
“$gleStats” : {
“lastOpTime” : Timestamp(0, 0),
“electionId” : ObjectId(“7fffffff0000000000000003”)
},
“$clusterTime” : {
“clusterTime” : Timestamp(1578484956, 1),
“signature” : {
“hash” : BinData(0,“FdwXWjVT7qGhkaKPTWFaa7RREP0=”),
“keyId” : NumberLong(“6779414561712766989”)
}
}
}
MongoDB Enterprise m103-csrs:PRIMARY> 2020-01-08T12:03:02.709+0000 W NETWORK [ReplicaSetMonitor-TaskExecutor-0] Failed to connect to 127.0.1.1:26003, in(checking socket for error after poll), reason: Connection refused
2020-01-08T12:03:02.710+0000 W NETWORK [ReplicaSetMonitor-TaskExecutor-0] Failed to connect to 127.0.1.1:26002, in(checking socket for error after poll), reason: Connection refused
2020-01-08T12:03:32.715+0000 W NETWORK [ReplicaSetMonitor-TaskExecutor-0] Failed to connect to 127.0.1.1:26003, in(checking socket for error after poll), reason: Connection refused
2020-01-08T12:03:32.717+0000 W NETWORK [ReplicaSetMonitor-TaskExecutor-0] Failed to connect to 127.0.1.1:26002, in(checking socket for error after poll), reason: Connection refused

vagrant@m103:~$ ping m103
PING m103.mongodb.university (127.0.1.1) 56(84) bytes of data.
64 bytes from m103.mongodb.university (127.0.1.1): icmp_seq=1 ttl=64 time=0.018 ms
64 bytes from m103.mongodb.university (127.0.1.1): icmp_seq=2 ttl=64 time=0.051 ms
64 bytes from m103.mongodb.university (127.0.1.1): icmp_seq=3 ttl=64 time=0.057 ms
64 bytes from m103.mongodb.university (127.0.1.1): icmp_seq=4 ttl=64 time=0.053 ms
64 bytes from m103.mongodb.university (127.0.1.1): icmp_seq=5 ttl=64 time=0.058 ms
64 bytes from m103.mongodb.university (127.0.1.1): icmp_seq=6 ttl=64 time=0.057 ms
64 bytes from m103.mongodb.university (127.0.1.1): icmp_seq=7 ttl=64 time=0.048 ms
64 bytes from m103.mongodb.university (127.0.1.1): icmp_seq=8 ttl=64 time=0.059 ms
64 bytes from m103.mongodb.university (127.0.1.1): icmp_seq=9 ttl=64 time=0.047 ms
^C
— m103.mongodb.university ping statistics —

Hi @SwapanDas,

The hostname m103 is not getting mapped to the correct IP address i.e. 192.168.103.100.

Please refer this post for making the necessary changes.

Thanks,
Shubham Ranjan
Curriculum Services Engineer

Changed according to your suggestion and it worked without any further issue.

Thank you very much.

Closing the thread as the issue has been resolved.