I am working on the IDE session.
Lab note states:
- the Configuration Server Replica Set csrs is running on csrs/localhost:27004,localhost:27005,localhost:27006
- a replica set shard1 is running on shard1/localhost:27001,localhost:27002,localhost:27003
- the m103-admin user has been created on both replica sets with password m103-pass
I can see the csrs rs and shared1 rs processes running.
csrs:PRIMARY> rs.status()
{
"set" : "csrs",
"date" : ISODate("2022-05-03T13:23:09.756Z"),
"myState" : 1,
"term" : NumberLong(1),
"syncingTo" : "",
"syncSourceHost" : "",
"syncSourceId" : -1,
"configsvr" : true,
"heartbeatIntervalMillis" : NumberLong(2000),
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(1651584188, 1),
"t" : NumberLong(1)
},
"readConcernMajorityOpTime" : {
"ts" : Timestamp(1651584188, 1),
"t" : NumberLong(1)
},
"appliedOpTime" : {
"ts" : Timestamp(1651584188, 1),
"t" : NumberLong(1)
},
"durableOpTime" : {
"ts" : Timestamp(1651584188, 1),
"t" : NumberLong(1)
}
},
"lastStableCheckpointTimestamp" : Timestamp(1651584145, 1),
"members" : [
{
"_id" : 0,
"name" : "localhost:27004",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 165,
"optime" : {
"ts" : Timestamp(1651584188, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2022-05-03T13:23:08Z"),
"syncingTo" : "",
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "",
"electionTime" : Timestamp(1651584025, 2),
"electionDate" : ISODate("2022-05-03T13:20:25Z"),
"configVersion" : 3,
"self" : true,
"lastHeartbeatMessage" : ""
},
{
"_id" : 1,
"name" : "localhost:27005",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 161,
"optime" : {
"ts" : Timestamp(1651584188, 1),
"t" : NumberLong(1)
},
"optimeDurable" : {
"ts" : Timestamp(1651584188, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2022-05-03T13:23:08Z"),
"optimeDurableDate" : ISODate("2022-05-03T13:23:08Z"),
"lastHeartbeat" : ISODate("2022-05-03T13:23:08.396Z"),
"lastHeartbeatRecv" : ISODate("2022-05-03T13:23:09.200Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "",
"syncingTo" : "localhost:27004",
"syncSourceHost" : "localhost:27004",
"syncSourceId" : 0,
"infoMessage" : "",
"configVersion" : 3
},
{
"_id" : 2,
"name" : "localhost:27006",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 161,
"optime" : {
"ts" : Timestamp(1651584188, 1),
"t" : NumberLong(1)
},
"optimeDurable" : {
"ts" : Timestamp(1651584188, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2022-05-03T13:23:08Z"),
"optimeDurableDate" : ISODate("2022-05-03T13:23:08Z"),
"lastHeartbeat" : ISODate("2022-05-03T13:23:08.396Z"),
"lastHeartbeatRecv" : ISODate("2022-05-03T13:23:07.787Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "",
"syncingTo" : "localhost:27005",
"syncSourceHost" : "localhost:27005",
"syncSourceId" : 1,
"infoMessage" : "",
"configVersion" : 3
}
],
"ok" : 1,
"operationTime" : Timestamp(1651584188, 1),
"$gleStats" : {
"lastOpTime" : Timestamp(0, 0),
"electionId" : ObjectId("7fffffff0000000000000001")
},
"lastCommittedOpTime" : Timestamp(1651584188, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1651584188, 1),
"signature" : {
"hash" : BinData(0,"/OQmLyRvJ8X2cQdX8vpjdu75Dfs="),
"keyId" : NumberLong("7093499386855948294")
}
}
}
mongos.conf file
sharding:
configDB: m103-csrs/localhost:27004,localhost:27005,localhost:27006
security:
keyFile: /var/mongodb/pki/m103-keyfile
net:
bindIp: localhost
port: 27000
systemLog:
destination: file
path: /var/mongodb/logs/mongos.log
logAppend: true
processManagement:
fork: true
mongos -f mongos.conf
user@M103# mongo --port 27000 -u "m103-admin" -p "m103-pass" --authenticationDatabase "admin"
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27000/?authSource=admin&gssapiServiceName=mongodb
2022-05-03T13:42:42.433+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27000, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27000 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed
What am i missing here? Plz help.