AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

rs.reconfigForPSASet() (mongosh 메서드)

rs.reconfigForPSASet( memberIndex, config, { options } )

버전 5.0의 신규 항목입니다.

프라이머리-세컨더리-중재자(PSA) 복제본 세트 또는 PSA 아키텍처로 변경되는 복제본 세트에서 일부 재구성 변경을 안전하게 수행합니다. 이 방법은 다음 중 한 가지 경우에만 사용해야 합니다.

  • 기존 3개 멤버로 구성된 PSA 아키텍처의 복제본 세트의 세컨더리 노드를 0이 아닌 priority가 있는 투표 데이터 보유 노드로 재구성하려고 합니다.

  • 하나의 투표 데이터 보유 노드 및 하나의 중재자를 포함하는 기존 2개의 멤버 복제본 세트에 우선 순위가 0이 아닌 새로운 투표 데이터 보유 노드를 추가하려고 합니다.

경고

추가하는 세컨더리 노드가 지연되고 결과 복제본 세트가 PSA 구성인 경우, 첫 번째 구성 변경은 "majority"에 따라 변경 사항을 커밋해야 하는 노드 수를 변경합니다. 이 경우 커밋 지점은 세컨더리가 따라잡을 때까지 지연됩니다.

이 메서드의 동작에 대한 자세한 내용은 동작을 참조하세요.

이 메서드는 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.

The rs.reconfigForPSASet() method has the following syntax:

rs.reconfigForPSASet(
memberIndex: <num>,
config: <configuration>,
{
"force" : <boolean>,
"maxTimeMS" : <int>
}
)
Parameter
유형
설명

memberIndex

integer

추가되거나 수정되는 세컨더리의 인덱스입니다.

config

문서

복제본 세트의 새로운 구성을 지정하는 문서입니다.

force

부울

옵션

WARNING: Running the rs.reconfigForPSASet() method with force: true is not recommended and can lead to committed writes being rolled back.

사용 가능한 복제본 세트 구성원이 새 구성을 수락하도록 하려면 true 지정합니다. 기본값은 false입니다.

강제 재구성으로 인해 개의 "majority" 커밋된 쓰기 롤백을 포함하여 예기치 않거나 원치 않는 동작이 발생할 수 있습니다.

maxTimeMS

integer

옵션

Specifies a cumulative time limit in milliseconds for processing each reconfiguration during the rs.reconfigForPSASet() operation. By default, rs.reconfigForPSASet() waits indefinitely for the replica configurations to propagate to a majority of replica set members.

The rs.reconfigForPSASet() method reconfigures your replica set in two steps:

  1. 이 메서드는 { votes: 1, priority: 0 } 으로 보조 세트를 추가하거나 수정하도록 복제본 세트를 재구성합니다.

  2. Once the added or modified secondary has caught up with all committed writes, the method reconfigures the secondary to have the priority specified in the rs.reconfigForPSASet() command ({ votes: 1, priority: <num> }).

2단계 접근 방식은 페일오버의 경우 새 세컨더리가 이전 구성의 모든 쓰기를 커밋하기 전에 커밋된 쓰기를 새 세컨더리로 롤백하는 가능성을 방지합니다.

0}이라는 이름의 복제본 rs0 집합은 다음과 같은 구성을 가집니다:

{
"_id" : "rs0",
"version" : 1,
"term": 1,
"members" : [
{
"_id" : 0,
"host" : "mongodb0.example.net:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {},
"secondaryDelaySecs" : Long("0"),
"votes" : 1
},
{
"_id" : 2,
"host" : "mongodb1.example.net:27017",
"arbiterOnly" : true,
"buildIndexes" : true,
"hidden" : false,
"priority" : 0,
"tags" : {},
"secondaryDelaySecs" : Long("0"),
"votes" : 1
}
],
"protocolVersion" : Long("1"),
"writeConcernMajorityJournalDefault": true,
"settings" : {
"chainingAllowed" : true,
"heartbeatIntervalMillis" : 2000,
"heartbeatTimeoutSecs" : 10,
"electionTimeoutMillis" : 10000,
"catchUpTimeoutMillis" : 2000,
"getLastErrorModes" : {},
"getLastErrorDefaults" : {
"w" : 1,
"wtimeout" : 0
},
"replicaSetId" : ObjectId("60e6f83923193faa336889d2")
}
}

The following sequence of operations add a new secondary to the replica set. The operations are issued in the mongosh shell while connected to the primary.

cfg = rs.conf();
cfg["members"] = [
{
"_id" : 0,
"host" : "mongodb0.example.net:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {},
"secondaryDelaySecs" : Long("0"),
"votes" : 1
},
{
"_id" : 1,
"host" : "mongodb1.example.net:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 2,
"tags" : {},
"secondaryDelaySecs" : Long("0"),
"votes" : 1
},
{
"_id" : 2,
"host" : "mongodb2.example.net:27017",
"arbiterOnly" : true,
"buildIndexes" : true,
"hidden" : false,
"priority" : 0,
"tags" : {},
"secondaryDelaySecs" : Long("0"),
"votes" : 1
}
]
rs.reconfigForPSASet(1, cfg);
  1. 첫 번째 성명서는 rs.conf() 메서드를 사용해 복제본 세트의 현재 구성을 포함하고 있는 문서를 조회하고 문서를 로컬 변수 cfg로 저장합니다.

  2. 두 번째 문은 members 배열에 새 세컨더리를 추가합니다. 이 구성에서는 새 세컨더리가 memberIndex 1에 추가됩니다. memberIndex는 배열 인덱스와 동일합니다. 추가 설정은 복제본 세트 구성 설정을 참조하세요.

  3. The last statement calls the rs.reconfigForPSASet() method with the memberIndex 1 and the modified cfg. The memberIndex is the array position of the new member in the members array. Upon successful reconfiguration, the replica set configuration resembles the following:

    {
    "_id" : "rs0",
    "version" : 1,
    "term": 1,
    "members" : [
    {
    "_id" : 0,
    "host" : "mongodb0.example.net:27017",
    "arbiterOnly" : false,
    "buildIndexes" : true,
    "hidden" : false,
    "priority" : 1,
    "tags" : {},
    "secondaryDelaySecs" : Long("0"),
    "votes" : 1
    },
    {
    "_id" : 1,
    "host" : "mongodb1.example.net:27017",
    "arbiterOnly" : false,
    "buildIndexes" : true,
    "hidden" : false,
    "priority" : 2,
    "tags" : {},
    "secondaryDelaySecs" : Long("0"),
    "votes" : 1
    },
    {
    "_id" : 2,
    "host" : "mongodb2.example.net:27017",
    "arbiterOnly" : true,
    "buildIndexes" : true,
    "hidden" : false,
    "priority" : 0,
    "tags" : {},
    "secondaryDelaySecs" : Long("0"),
    "votes" : 1
    }
    ],
    "protocolVersion" : Long("1"),
    "writeConcernMajorityJournalDefault": true,
    "settings" : {
    "chainingAllowed" : true,
    "heartbeatIntervalMillis" : 2000,
    "heartbeatTimeoutSecs" : 10,
    "electionTimeoutMillis" : 10000,
    "catchUpTimeoutMillis" : 2000,
    "getLastErrorModes" : {},
    "getLastErrorDefaults" : {
    "w" : 1,
    "wtimeout" : 0
    },
    "replicaSetId" : ObjectId("60e6f83923193faa336889d2")
    }
    }
이 페이지 평가하기

이 페이지의 내용