返回顶部
首页 > 资讯 > 数据库 >MongoDB中怎么切换副本集故障
  • 536
分享到

MongoDB中怎么切换副本集故障

2024-04-02 19:04:59 536人浏览 安东尼
摘要

mongoDB中怎么切换副本集故障,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。默认情况下主节点和从节点的优先级都为1,仲裁者

mongoDB中怎么切换副本集故障,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

默认情况下主节点和从节点的优先级都为1,仲裁者为0,因为它不可参加选举。

查看集群配置

cjcmonset:PRIMARY> rs.conf()

{

"_id" : "cjcmonset",

"version" : 1,

"protocolVersion" : NumberLong(1),

"writeConcernMajorityJournalDefault" : true,

"members" : [

{

"_id" : 0,

"host" : "192.168.2.222:27017",

"arbiterOnly" : false,

"buildIndexes" : true,

"hidden" : false,

"priority" : 1,

"tags" : {

},

"slaveDelay" : NumberLong(0),

"votes" : 1

},

{

"_id" : 1,

"host" : "192.168.2.187:27017",

"arbiterOnly" : false,

"buildIndexes" : true,

"hidden" : false,

"priority" : 1,

"tags" : {

},

"slaveDelay" : NumberLong(0),

"votes" : 1

},

{

"_id" : 2,

"host" : "192.168.2.188:27017",

"arbiterOnly" : true,

"buildIndexes" : true,

"hidden" : false,

"priority" : 0,

"tags" : {

},

"slaveDelay" : NumberLong(0),

"votes" : 1

}

],

"settings" : {

"chainingAllowed" : true,

"heartbeatIntervalMillis" : 2000,

"heartbeatTimeoutSecs" : 10,

"electionTimeoutMillis" : 10000,

"catchUpTimeoutMillis" : -1,

"catchUpTakeoverDelayMillis" : 30000,

"getLastErrORModes" : {

},

"getLastErrorDefaults" : {

"w" : 1,

"wtimeout" : 0

},

"replicaSetId" : ObjectId("5e77148837ae69b4ab9b4870")

}

}

我将现有主节点2.222的优先级提高为5,目的是在主库故障恢复后可以自动将主库角色切换回来。

cjcmonset:PRIMARY> var rscfg=rs.conf()

cjcmonset:PRIMARY> rscfg.members[0].priority = 5

5

cjcmonset:PRIMARY> rs.reconfig(rscfg)

{

"ok" : 1,

"$clusterTime" : {

"clusterTime" : Timestamp(1584881617, 1),

"signature" : {

"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),

"keyId" : NumberLong(0)

}

},

"operationTime" : Timestamp(1584881617, 1)

}

查看一下状态,主库优先级别已经调到5

cjcmonset:PRIMARY> rs.conf()

{

"_id" : "cjcmonset",

"version" : 2,

"protocolVersion" : NumberLong(1),

"writeConcernMajorityJournalDefault" : true,

"members" : [

{

"_id" : 0,

"host" : "192.168.2.222:27017",

"arbiterOnly" : false,

"buildIndexes" : true,

"hidden" : false,

"priority" : 5,

"tags" : {

},

"slaveDelay" : NumberLong(0),

"votes" : 1

},

{

"_id" : 1,

"host" : "192.168.2.187:27017",

"arbiterOnly" : false,

"buildIndexes" : true,

"hidden" : false,

"priority" : 1,

"tags" : {

},

"slaveDelay" : NumberLong(0),

"votes" : 1

},

{

"_id" : 2,

"host" : "192.168.2.188:27017",

"arbiterOnly" : true,

"buildIndexes" : true,

"hidden" : false,

"priority" : 0,

"tags" : {

},

"slaveDelay" : NumberLong(0),

"votes" : 1

}

],

"settings" : {

"chainingAllowed" : true,

"heartbeatIntervalMillis" : 2000,

"heartbeatTimeoutSecs" : 10,

"electionTimeoutMillis" : 10000,

"catchUpTimeoutMillis" : -1,

"catchUpTakeoverDelayMillis" : 30000,

"getLastErrorModes" : {

},

"getLastErrorDefaults" : {

"w" : 1,

"wtimeout" : 0

},

"replicaSetId" : ObjectId("5e77148837ae69b4ab9b4870")

}

}

手动将将主节点(2.222)mongodo停掉,测试故障转移功能

cjcmonset:PRIMARY> use admin

switched to db admin

cjcmonset:PRIMARY> db.shutdownServer()

2020-03-22T20:59:39.419+0800 I  NETWORK  [js] DBClientConnection failed to receive message from 127.0.0.1:27017 - HostUnreachable: Connection closed by peer

server should be down...

2020-03-22T20:59:39.422+0800 I  NETWORK  [js] trying reconnect to 127.0.0.1:27017 failed

2020-03-22T20:59:39.423+0800 I  NETWORK  [js] reconnect 127.0.0.1:27017 failed failed 

在2.187节点查看集群状态,原主库187提示Connection refused,原从库2.187已经自动切换成主库。

查看集群状态

cjcmonset:PRIMARY> rs.status()

{

"set" : "cjcmonset",

"date" : ISODate("2020-03-22T13:00:33.838Z"),

"myState" : 1,

"term" : NumberLong(2),

"syncingTo" : "",

"syncSourceHost" : "",

"syncSourceId" : -1,

"heartbeatIntervalMillis" : NumberLong(2000),

"majorityVoteCount" : 2,

"writeMajorityCount" : 2,

"optimes" : {

"lastCommittedOpTime" : {

"ts" : Timestamp(1584881969, 1),

"t" : NumberLong(1)

},

"lastCommittedWallTime" : ISODate("2020-03-22T12:59:29.481Z"),

"readConcernMajorityOpTime" : {

"ts" : Timestamp(1584881969, 1),

"t" : NumberLong(1)

},

"readConcernMajorityWallTime" : ISODate("2020-03-22T12:59:29.481Z"),

"appliedOpTime" : {

"ts" : Timestamp(1584882028, 1),

"t" : NumberLong(2)

},

"durableOpTime" : {

"ts" : Timestamp(1584882028, 1),

"t" : NumberLong(2)

},

"lastAppliedWallTime" : ISODate("2020-03-22T13:00:28.344Z"),

"lastDurableWallTime" : ISODate("2020-03-22T13:00:28.344Z")

},

"lastStableRecoveryTimestamp" : Timestamp(1584881969, 1),

"lastStableCheckpointTimestamp" : Timestamp(1584881969, 1),

"electionCandidateMetrics" : {

"lastElectionReason" : "stepUpRequestSkipDryRun",

"lastElectionDate" : ISODate("2020-03-22T12:59:37.752Z"),

"electionTerm" : NumberLong(2),

"lastCommittedOpTimeAtElection" : {

"ts" : Timestamp(1584881969, 1),

"t" : NumberLong(1)

},

"lastSeenOpTimeAtElection" : {

"ts" : Timestamp(1584881969, 1),

"t" : NumberLong(1)

},

"numVotesNeeded" : 2,

"priorityAtElection" : 1,

"electionTimeoutMillis" : NumberLong(10000),

"priorPrimaryMemberId" : 0,

"numCatchUpOps" : NumberLong(0),

"newTermStartDate" : ISODate("2020-03-22T12:59:38.313Z")

},

"electionParticipantMetrics" : {

"votedForCandidate" : true,

"electionTerm" : NumberLong(1),

"lastVoteDate" : ISODate("2020-03-22T07:32:34.460Z"),

"electionCandidateMemberId" : 0,

"voteReason" : "",

"lastAppliedOpTimeAtElection" : {

"ts" : Timestamp(1584862345, 1),

"t" : NumberLong(-1)

},

"maxAppliedOpTimeInSet" : {

"ts" : Timestamp(1584862345, 1),

"t" : NumberLong(-1)

},

"priorityAtElection" : 1

},

"members" : [

{

"_id" : 0,

"name" : "192.168.2.222:27017",

"health" : 0,

"state" : 8,

"stateStr" : "(not reachable/healthy)",

"uptime" : 0,

"optime" : {

"ts" : Timestamp(0, 0),

"t" : NumberLong(-1)

},

"optimeDurable" : {

"ts" : Timestamp(0, 0),

"t" : NumberLong(-1)

},

"optimeDate" : ISODate("1970-01-01T00:00:00Z"),

"optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),

"lastHeartbeat" : ISODate("2020-03-22T13:00:31.874Z"),

"lastHeartbeatRecv" : ISODate("2020-03-22T12:59:36.547Z"),

"pingMs" : NumberLong(0),

"lastHeartbeatMessage" : "Error connecting to 192.168.2.222:27017 :: caused by :: Connection refused",

"syncingTo" : "",

"syncSourceHost" : "",

"syncSourceId" : -1,

"infoMessage" : "",

"configVersion" : -1

},

{

"_id" : 1,

"name" : "192.168.2.187:27017",

"health" : 1,

"state" : 1,

"stateStr" : "PRIMARY",

"uptime" : 19745,

"optime" : {

"ts" : Timestamp(1584882028, 1),

"t" : NumberLong(2)

},

"optimeDate" : ISODate("2020-03-22T13:00:28Z"),

"syncingTo" : "",

"syncSourceHost" : "",

"syncSourceId" : -1,

"infoMessage" : "",

"electionTime" : Timestamp(1584881977, 1),

"electionDate" : ISODate("2020-03-22T12:59:37Z"),

"configVersion" : 2,

"self" : true,

"lastHeartbeatMessage" : ""

},

{

"_id" : 2,

"name" : "192.168.2.188:27017",

"health" : 1,

"state" : 7,

"stateStr" : "ARBITER",

"uptime" : 19689,

"lastHeartbeat" : ISODate("2020-03-22T13:00:31.872Z"),

"lastHeartbeatRecv" : ISODate("2020-03-22T13:00:32.657Z"),

"pingMs" : NumberLong(0),

"lastHeartbeatMessage" : "",

"syncingTo" : "",

"syncSourceHost" : "",

"syncSourceId" : -1,

"infoMessage" : "",

"configVersion" : 2

}

],

"ok" : 1,

"$clusterTime" : {

"clusterTime" : Timestamp(1584882028, 1),

"signature" : {

"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),

"keyId" : NumberLong(0)

}

},

"operationTime" : Timestamp(1584882028, 1)

}

手动启动2.222节点MongoDB

[root@cjcos conf]# mongod --config /usr/local/mongodb/conf/mongodb.conf

cjcmonset:SECONDARY> rs.status()

{

"set" : "cjcmonset",

"date" : ISODate("2020-03-22T13:02:32.499Z"),

"myState" : 2,

"term" : NumberLong(2),

"syncingTo" : "192.168.2.187:27017",

"syncSourceHost" : "192.168.2.187:27017",

"syncSourceId" : 1,

"heartbeatIntervalMillis" : NumberLong(2000),

"majorityVoteCount" : 2,

"writeMajorityCount" : 2,

"optimes" : {

"lastCommittedOpTime" : {

"ts" : Timestamp(1584882148, 1),

"t" : NumberLong(2)

},

"lastCommittedWallTime" : ISODate("2020-03-22T13:02:28.367Z"),

"readConcernMajorityOpTime" : {

"ts" : Timestamp(1584882148, 1),

"t" : NumberLong(2)

},

"readConcernMajorityWallTime" : ISODate("2020-03-22T13:02:28.367Z"),

"appliedOpTime" : {

"ts" : Timestamp(1584882148, 1),

"t" : NumberLong(2)

},

"durableOpTime" : {

"ts" : Timestamp(1584882148, 1),

"t" : NumberLong(2)

},

"lastAppliedWallTime" : ISODate("2020-03-22T13:02:28.367Z"),

"lastDurableWallTime" : ISODate("2020-03-22T13:02:28.367Z")

},

"lastStableRecoveryTimestamp" : Timestamp(1584881969, 1),

"lastStableCheckpointTimestamp" : Timestamp(1584881969, 1),

"members" : [

{

"_id" : 0,

"name" : "192.168.2.222:27017",

"health" : 1,

"state" : 2,

"stateStr" : "SECONDARY",

"uptime" : 13,

"optime" : {

"ts" : Timestamp(1584882148, 1),

"t" : NumberLong(2)

},

"optimeDate" : ISODate("2020-03-22T13:02:28Z"),

"syncingTo" : "192.168.2.187:27017",

"syncSourceHost" : "192.168.2.187:27017",

"syncSourceId" : 1,

"infoMessage" : "",

"configVersion" : 2,

"self" : true,

"lastHeartbeatMessage" : ""

},

{

"_id" : 1,

"name" : "192.168.2.187:27017",

"health" : 1,

"state" : 1,

"stateStr" : "PRIMARY",

"uptime" : 10,

"optime" : {

"ts" : Timestamp(1584882148, 1),

"t" : NumberLong(2)

},

"optimeDurable" : {

"ts" : Timestamp(1584882148, 1),

"t" : NumberLong(2)

},

"optimeDate" : ISODate("2020-03-22T13:02:28Z"),

"optimeDurableDate" : ISODate("2020-03-22T13:02:28Z"),

"lastHeartbeat" : ISODate("2020-03-22T13:02:31.498Z"),

"lastHeartbeatRecv" : ISODate("2020-03-22T13:02:31.261Z"),

"pingMs" : NumberLong(0),

"lastHeartbeatMessage" : "",

"syncingTo" : "",

"syncSourceHost" : "",

"syncSourceId" : -1,

"infoMessage" : "",

"electionTime" : Timestamp(1584881977, 1),

"electionDate" : ISODate("2020-03-22T12:59:37Z"),

"configVersion" : 2

},

{

"_id" : 2,

"name" : "192.168.2.188:27017",

"health" : 1,

"state" : 7,

"stateStr" : "ARBITER",

"uptime" : 10,

"lastHeartbeat" : ISODate("2020-03-22T13:02:31.496Z"),

"lastHeartbeatRecv" : ISODate("2020-03-22T13:02:32.014Z"),

"pingMs" : NumberLong(0),

"lastHeartbeatMessage" : "",

"syncingTo" : "",

"syncSourceHost" : "",

"syncSourceId" : -1,

"infoMessage" : "",

"configVersion" : 2

}

],

"ok" : 1,

"$clusterTime" : {

"clusterTime" : Timestamp(1584882148, 1),

"signature" : {

"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),

"keyId" : NumberLong(0)

}

},

"operationTime" : Timestamp(1584882148, 1)

}

因为设置了优先级,所以在启动2.222节点mongo后,很快2.222节点又会被重新选举为主节点,而2.187节点又变成从节点。

cjcmonset:SECONDARY> 

cjcmonset:PRIMARY> 

cjcmonset:PRIMARY> 

cjcmonset:PRIMARY> 

---2.222日志如下:

2020-03-22T21:02:33.946+0800 I  CONNPOOL [Replication] Connecting to 192.168.2.187:27017

2020-03-22T21:02:33.949+0800 I  REPL     [replexec-0] Member 192.168.2.187:27017 is now in state SECONDARY

2020-03-22T21:02:33.949+0800 I  REPL     [replexec-0] Caught up to the latest optime known via heartbeats after becoming primary. Target optime: { ts: Timestamp(1584882148, 1), t: 2 }. My Last Applied: { ts: Timestamp(1584882148, 1), t: 2 }

2020-03-22T21:02:33.949+0800 I  REPL     [replexec-0] Exited primary catch-up mode.

2020-03-22T21:02:33.949+0800 I  REPL     [replexec-0] Stopping replication producer

2020-03-22T21:02:33.949+0800 I  REPL     [rsBackgroundSync] Replication producer stopped after oplog fetcher finished returning a batch from our sync source.  Abandoning this batch of oplog entries and re-evaluating our sync source.

2020-03-22T21:02:34.592+0800 I  REPL     [ReplBatcher] Oplog buffer has been drained in term 3

2020-03-22T21:02:34.592+0800 I  REPL     [RstlKillOpThread] Starting to kill user operations

2020-03-22T21:02:34.592+0800 I  REPL     [RstlKillOpThread] Stopped killing user operations

2020-03-22T21:02:34.592+0800 I  REPL     [RstlKillOpThread] State transition ops metrics: { lastStateTransition: "stepUp", userOpsKilled: 0, userOpsRunning: 0 }

2020-03-22T21:02:34.593+0800 I  REPL     [rsSync-0] transition to primary complete; database writes are now permitted

2020-03-22T21:02:34.712+0800 I  REPL     [SyncSourceFeedback] SyncSourceFeedback error sending update to 192.168.2.187:27017: InvalidSyncSource: Sync source was cleared. Was 192.168.2.187:27017

2020-03-22T21:02:35.459+0800 I  NETWORK  [listener] connection accepted from 192.168.2.187:41810 #13 (6 connections now open)

2020-03-22T21:02:35.460+0800 I  NETWORK  [conn13] received client metadata from 192.168.2.187:41810 conn13: { driver: { name: "NetworkInterfaceTL", version: "4.2.3" }, os: { type: "linux", name: "Centos Linux release 7.5.1804 (Core) ", architecture: "x86_64", version: "Kernel 3.10.0-862.el7.x86_64" } }

2020-03-22T21:02:39.711+0800 I  CONNPOOL [RS] Ending connection to host 192.168.2.187:27017 due to bad connection status: CallbackCanceled: Callback was canceled; 1 connections to that host remain open

2020-03-22T21:02:43.944+0800 I  CONNPOOL [Replication] Ending connection to host 192.168.2.187:27017 due to bad connection status: CallbackCanceled: Callback was canceled; 1 connections to that host remain open

查看集群状态,2.187又重新变成主节点

cjcmonset:PRIMARY> rs.status()

{

"set" : "cjcmonset",

"date" : ISODate("2020-03-22T13:04:24.678Z"),

"myState" : 1,

"term" : NumberLong(3),

"syncingTo" : "",

"syncSourceHost" : "",

"syncSourceId" : -1,

"heartbeatIntervalMillis" : NumberLong(2000),

"majorityVoteCount" : 2,

"writeMajorityCount" : 2,

"optimes" : {

"lastCommittedOpTime" : {

"ts" : Timestamp(1584882264, 1),

"t" : NumberLong(3)

},

"lastCommittedWallTime" : ISODate("2020-03-22T13:04:24.632Z"),

"readConcernMajorityOpTime" : {

"ts" : Timestamp(1584882264, 1),

"t" : NumberLong(3)

},

"readConcernMajorityWallTime" : ISODate("2020-03-22T13:04:24.632Z"),

"appliedOpTime" : {

"ts" : Timestamp(1584882264, 1),

"t" : NumberLong(3)

},

"durableOpTime" : {

"ts" : Timestamp(1584882264, 1),

"t" : NumberLong(3)

},

"lastAppliedWallTime" : ISODate("2020-03-22T13:04:24.632Z"),

"lastDurableWallTime" : ISODate("2020-03-22T13:04:24.632Z")

},

"lastStableRecoveryTimestamp" : Timestamp(1584882254, 1),

"lastStableCheckpointTimestamp" : Timestamp(1584882254, 1),

"electionCandidateMetrics" : {

"lastElectionReason" : "priorityTakeover",

"lastElectionDate" : ISODate("2020-03-22T13:02:33.880Z"),

"electionTerm" : NumberLong(3),

"lastCommittedOpTimeAtElection" : {

"ts" : Timestamp(1584882148, 1),

"t" : NumberLong(2)

},

"lastSeenOpTimeAtElection" : {

"ts" : Timestamp(1584882148, 1),

"t" : NumberLong(2)

},

"numVotesNeeded" : 2,

"priorityAtElection" : 5,

"electionTimeoutMillis" : NumberLong(10000),

"priorPrimaryMemberId" : 1,

"numCatchUpOps" : NumberLong(0),

"newTermStartDate" : ISODate("2020-03-22T13:02:34.593Z"),

"wMajorityWriteAvailabilityDate" : ISODate("2020-03-22T13:02:35.462Z")

},

"members" : [

{

"_id" : 0,

"name" : "192.168.2.222:27017",

"health" : 1,

"state" : 1,

"stateStr" : "PRIMARY",

"uptime" : 125,

"optime" : {

"ts" : Timestamp(1584882264, 1),

"t" : NumberLong(3)

},

"optimeDate" : ISODate("2020-03-22T13:04:24Z"),

"syncingTo" : "",

"syncSourceHost" : "",

"syncSourceId" : -1,

"infoMessage" : "",

"electionTime" : Timestamp(1584882153, 1),

"electionDate" : ISODate("2020-03-22T13:02:33Z"),

"configVersion" : 2,

"self" : true,

"lastHeartbeatMessage" : ""

},

{

"_id" : 1,

"name" : "192.168.2.187:27017",

"health" : 1,

"state" : 2,

"stateStr" : "SECONDARY",

"uptime" : 122,

"optime" : {

"ts" : Timestamp(1584882254, 1),

"t" : NumberLong(3)

},

"optimeDurable" : {

"ts" : Timestamp(1584882254, 1),

"t" : NumberLong(3)

},

"optimeDate" : ISODate("2020-03-22T13:04:14Z"),

"optimeDurableDate" : ISODate("2020-03-22T13:04:14Z"),

"lastHeartbeat" : ISODate("2020-03-22T13:04:24.023Z"),

"lastHeartbeatRecv" : ISODate("2020-03-22T13:04:23.967Z"),

"pingMs" : NumberLong(0),

"lastHeartbeatMessage" : "",

"syncingTo" : "192.168.2.222:27017",

"syncSourceHost" : "192.168.2.222:27017",

"syncSourceId" : 0,

"infoMessage" : "",

"configVersion" : 2

},

{

"_id" : 2,

"name" : "192.168.2.188:27017",

"health" : 1,

"state" : 7,

"stateStr" : "ARBITER",

"uptime" : 122,

"lastHeartbeat" : ISODate("2020-03-22T13:04:24.019Z"),

"lastHeartbeatRecv" : ISODate("2020-03-22T13:04:24.112Z"),

"pingMs" : NumberLong(0),

"lastHeartbeatMessage" : "",

"syncingTo" : "",

"syncSourceHost" : "",

"syncSourceId" : -1,

"infoMessage" : "",

"configVersion" : 2

}

],

"ok" : 1,

"$clusterTime" : {

"clusterTime" : Timestamp(1584882264, 1),

"signature" : {

"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),

"keyId" : NumberLong(0)

}

},

"operationTime" : Timestamp(1584882264, 1)

}

187节点自动变成从节点

cjcmonset:PRIMARY> 

cjcmonset:PRIMARY> 

cjcmonset:SECONDARY> 

cjcmonset:SECONDARY> 

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注编程网数据库频道,感谢您对编程网的支持。

您可能感兴趣的文档:

--结束END--

本文标题: MongoDB中怎么切换副本集故障

本文链接: https://lsjlt.com/news/56561.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
  • MongoDB中怎么切换副本集故障
    MongoDB中怎么切换副本集故障,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。默认情况下主节点和从节点的优先级都为1,仲裁者...
    99+
    2024-04-02
  • MongoDB中怎么切换副本集
    MongoDB中怎么切换副本集,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。MongoDB 副本集切换方法1、rs.stepD...
    99+
    2024-04-02
  • mongodb中怎么切换集群节点故障
    mongodb中怎么切换集群节点故障,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。处理方法方法1、一般会自动切换,如果shard是由3个节...
    99+
    2024-04-02
  • mongodb如何更换副本集
    要更换MongoDB副本集,需要遵循以下步骤:1. 添加新副本集成员:首先,在新服务器上安装MongoDB,并确保它可以连接到现有的...
    99+
    2023-08-23
    mongodb
  • MongoDB中怎么管理副本集
    这期内容当中小编将会给大家带来有关MongoDB中怎么管理副本集,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。 1)诊断副本集中的机器,可以...
    99+
    2024-04-02
  • MongoDB中怎么实现副本集
    MongoDB中怎么实现副本集,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。 1、环境节点IP操作系统Mong...
    99+
    2024-04-02
  • MongoDB中怎么配置副本集
    MongoDB中怎么配置副本集,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。环境准备三台服务器,地址分别是:192.168.248.128192.168.248.13519...
    99+
    2023-06-19
  • MongoDB的副本集与自动故障转移怎么配置
    在MongoDB中配置副本集和自动故障转移需要以下步骤: 配置副本集的成员:打开MongoDB配置文件(通常是mongod.con...
    99+
    2024-05-07
    MongoDB
  • springboot怎么连接mongodb副本集
    要连接MongoDB副本集,需要在Spring Boot应用程序中配置MongoDB的副本集连接。以下是连接MongoDB副本集的步...
    99+
    2024-04-17
    springboot mongodb
  • mongodb中副本集集群技术怎么使用
    在MongoDB中,副本集集群技术用于提供高可用性和故障容错的解决方案。副本集是由多个MongoDB实例组成的集群,其中包括一个主节...
    99+
    2023-08-23
    mongodb
  • Mongodb中怎么实现副本集和分片
    这篇文章将为大家详细讲解有关Mongodb中怎么实现副本集和分片,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。Python只用mongo事务在python中...
    99+
    2024-04-02
  • 怎么在MongoDB中添加分片副本集
    这篇文章将为大家详细讲解有关怎么在MongoDB中添加分片副本集,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。流程:新建分片副本集使用addShard命令将分片副本集添加到集群中使用addS...
    99+
    2023-06-14
  • mongodb之副本集的实现及故障自动转移
    Mongodb之副本集的实现----repliSet准备三个节点:RS1:192.168.1.155:27017RS2:192.168.1.11:27017node1:192.168.1.112:27017...
    99+
    2024-04-02
  • 怎么搭建一个MongoDB 副本集
    怎么搭建一个MongoDB 副本集?针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。1、创建节点目录mkdir -p /data/mongo_28018/{...
    99+
    2023-06-14
  • MongoDB中副本集的示例分析
    这篇文章主要介绍了MongoDB中副本集的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。具体如下:replication set复制...
    99+
    2024-04-02
  • mongodb副本集同步问题怎么解决
    解决MongoDB副本集同步问题可以通过以下几种方式:1. 检查网络连接:确保主节点和副本节点之间的网络连接良好,避免网络问题导致同...
    99+
    2023-08-24
    mongodb
  • MongoDB副本集成员宕机会怎么样
    当MongoDB副本集的某个成员宕机时,集群会自动进行故障转移,将宕机节点的数据复制到其他健康的节点上,确保集群的数据一致性和可用性...
    99+
    2024-04-19
    MongoDB
  • 【Mongodb】 Replica set的自动故障切换
    Replica set 为我们提供了自动故障切换功能,这个机制是由mongodb自己来操作的,它根据从库的优先级或者数据新鲜度(也就是最新的从主库同步数据的那个节点)来选择primary,而当以前的prim...
    99+
    2024-04-02
  • mongodb副本集搭建的步骤是什么
    搭建MongoDB副本集的步骤如下: 安装MongoDB:在每台服务器上安装MongoDB,并确保MongoDB服务正常运行。 ...
    99+
    2024-04-17
    mongodb
  • MongoDB的副本集同步机制是什么
    MongoDB的副本集同步机制是通过Oplog(操作日志)来实现的。在MongoDB的副本集中,每个节点都保存着一个Oplog,用来...
    99+
    2024-05-07
    MongoDB
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作