Mongodb Mongo副本集上的倾斜读取负载

Mongodb Mongo副本集上的倾斜读取负载,mongodb,mongodb-query,replicaset,Mongodb,Mongodb Query,Replicaset,我已经设置了一个mongo副本集,其中包含一个主副本和两个辅助副本。我所面临的问题是,从使用副本集连接URL连接的应用程序服务器读取的数据总是只发送到一个辅助服务器,从而导致两个辅助服务器之间的读取负载出现巨大的偏差 由于这种倾斜,我在一台服务器上的资源受到限制,而另一台服务器上的资源却在浪费 rs.地位() 请帮帮我。这是mongo副本集集群通常期望的结果吗 非常感谢:)副本集中辅助服务器的服务器选择算法是 您可以使用本地阈值和最大陈旧性参数,例如,如果您充分增加这两个参数,您应该可以看到假

我已经设置了一个mongo副本集,其中包含一个主副本和两个辅助副本。我所面临的问题是,从使用副本集连接URL连接的应用程序服务器读取的数据总是只发送到一个辅助服务器,从而导致两个辅助服务器之间的读取负载出现巨大的偏差

由于这种倾斜,我在一台服务器上的资源受到限制,而另一台服务器上的资源却在浪费

rs.地位()

请帮帮我。这是mongo副本集集群通常期望的结果吗


非常感谢:)

副本集中辅助服务器的服务器选择算法是

您可以使用本地阈值和最大陈旧性参数,例如,如果您充分增加这两个参数,您应该可以看到假设有兼容的驱动程序,辅助设备之间的负载分布大致均匀

    {
    "set" : "rs0",
    "date" : ISODate("2020-09-08T19:39:20.394Z"),
    "myState" : 1,
    "term" : NumberLong(16),
    "syncingTo" : "",
    "syncSourceHost" : "",
    "syncSourceId" : -1,
    "heartbeatIntervalMillis" : NumberLong(2000),
    "majorityVoteCount" : 2,
    "writeMajorityCount" : 2,
    "optimes" : {
        "lastCommittedOpTime" : {
            "ts" : Timestamp(1599593958, 2042),
            "t" : NumberLong(16)
        },
        "lastCommittedWallTime" : ISODate("2020-09-08T19:39:18.908Z"),
        "readConcernMajorityOpTime" : {
            "ts" : Timestamp(1599593958, 2042),
            "t" : NumberLong(16)
        },
        "readConcernMajorityWallTime" : ISODate("2020-09-08T19:39:18.908Z"),
        "appliedOpTime" : {
            "ts" : Timestamp(1599593959, 1176),
            "t" : NumberLong(16)
        },
        "durableOpTime" : {
            "ts" : Timestamp(1599593958, 2042),
            "t" : NumberLong(16)
        },
        "lastAppliedWallTime" : ISODate("2020-09-08T19:39:19.138Z"),
        "lastDurableWallTime" : ISODate("2020-09-08T19:39:18.908Z")
    },
    "lastStableRecoveryTimestamp" : Timestamp(1599593936, 300),
    "lastStableCheckpointTimestamp" : Timestamp(1599593936, 300),
    "electionCandidateMetrics" : {
        "lastElectionReason" : "priorityTakeover",
        "lastElectionDate" : ISODate("2020-08-11T17:18:08.040Z"),
        "electionTerm" : NumberLong(16),
        "lastCommittedOpTimeAtElection" : {
            "ts" : Timestamp(1597166288, 246),
            "t" : NumberLong(15)
        },
        "lastSeenOpTimeAtElection" : {
            "ts" : Timestamp(1597166288, 246),
            "t" : NumberLong(15)
        },
        "numVotesNeeded" : 2,
        "priorityAtElection" : 2,
        "electionTimeoutMillis" : NumberLong(10000),
        "priorPrimaryMemberId" : 5,
        "targetCatchupOpTime" : {
            "ts" : Timestamp(1597166288, 394),
            "t" : NumberLong(15)
        },
        "numCatchUpOps" : NumberLong(148),
        "newTermStartDate" : ISODate("2020-08-11T17:18:08.074Z"),
        "wMajorityWriteAvailabilityDate" : ISODate("2020-08-11T17:18:10.782Z")
    },
    "members" : [
        {
            "_id" : 3,
            "name" : "1.1.1.1:27017",
            "health" : 1,
            "state" : 1,
            "stateStr" : "PRIMARY",
            "uptime" : 2427845,
            "optime" : {
                "ts" : Timestamp(1599593959, 1176),
                "t" : NumberLong(16)
            },
            "optimeDate" : ISODate("2020-09-08T19:39:19Z"),
            "syncingTo" : "",
            "syncSourceHost" : "",
            "syncSourceId" : -1,
            "infoMessage" : "",
            "electionTime" : Timestamp(1597166288, 383),
            "electionDate" : ISODate("2020-08-11T17:18:08Z"),
            "configVersion" : 32,
            "self" : true,
            "lastHeartbeatMessage" : ""
        },
        {
            "_id" : 5,
            "name" : "3.3.3.3:27017",
            "health" : 1,
            "state" : 2,
            "stateStr" : "SECONDARY",
            "uptime" : 3672,
            "optime" : {
                "ts" : Timestamp(1599593954, 3378),
                "t" : NumberLong(16)
            },
            "optimeDurable" : {
                "ts" : Timestamp(1599593954, 3378),
                "t" : NumberLong(16)
            },
            "optimeDate" : ISODate("2020-09-08T19:39:14Z"),
            "optimeDurableDate" : ISODate("2020-09-08T19:39:14Z"),
            "lastHeartbeat" : ISODate("2020-09-08T19:39:19.238Z"),
            "lastHeartbeatRecv" : ISODate("2020-09-08T19:39:20.261Z"),
            "pingMs" : NumberLong(0),
            "lastHeartbeatMessage" : "",
            "syncingTo" : "1.1.1.1:27017",
            "syncSourceHost" : "1.1.1.1:27017",
            "syncSourceId" : 3,
            "infoMessage" : "",
            "configVersion" : 32
        },
        {
            "_id" : 6,
            "name" : "2.2.2.2:27017",
            "health" : 1,
            "state" : 2,
            "stateStr" : "SECONDARY",
            "uptime" : 3341,
            "optime" : {
                "ts" : Timestamp(1599593957, 2190),
                "t" : NumberLong(16)
            },
            "optimeDurable" : {
                "ts" : Timestamp(1599593957, 2190),
                "t" : NumberLong(16)
            },
            "optimeDate" : ISODate("2020-09-08T19:39:17Z"),
            "optimeDurableDate" : ISODate("2020-09-08T19:39:17Z"),
            "lastHeartbeat" : ISODate("2020-09-08T19:39:18.751Z"),
            "lastHeartbeatRecv" : ISODate("2020-09-08T19:39:20.078Z"),
            "pingMs" : NumberLong(0),
            "lastHeartbeatMessage" : "",
            "syncingTo" : "1.1.1.1:27017",
            "syncSourceHost" : "1.1.1.1:27017",
            "syncSourceId" : 3,
            "infoMessage" : "",
            "configVersion" : 32
        }
    ],
    "ok" : 1,
    "$clusterTime" : {
        "clusterTime" : Timestamp(1599593959, 1329),
        "signature" : {
            "hash" : BinData(0,"dfdfdggjhkljoj+mvY8="),
            "keyId" : NumberLong("897987897897987")
        }
    },
    "operationTime" : Timestamp(1599593959, 1176)
}