Data Base/NOSQL
[NOSQL] : Replica Sets 환경 설정
오주현
2021. 11. 9. 12:09
반응형
파일을 먼저 생성해 줍니다.
mongod --dbpath c:\mongodb\disk1 --port 10001 --bind_ip localhost --replSet rptmongo --oplogSize 10
Primary Server 활성화 시켜줍니다.
mongod --dbpath c:\mongodb\disk2 --port 10002 --bind_ip localhost --replSet rptmongo --oplogSize 10
Secondary Server를 활성화 시켜줍니다.
mongod --dbpath c:\mongodb\arbit --port 10003 --bind_ip localhost --replSet rptmongo --oplogSize 10
Arbiter Server 서버도 활성화 시켜줍니다.
mongo localhost:10001/admin
db.runCommand({"replSetInitiate" : {"_id" : "rptmongo", "members":
[ {"_id" : 1, "host" : "localhost:10001"},
{"_id" : 2, "host" : "localhost:10002"},
{"_id" : 3, "host" : "localhost:10003",
arbiterOnly:true}
]
}})
MongoDB에서 replSetInitiate로 다음과 같이 리프리카셋을 초기화해야 합니다.
... [ {"_id" : 1, "host" : "localhost:10001"}, <- Primary 서버 등록
... {"_id" : 2, "host" : "localhost:10002"}, <- Secondary 서버 등록
... {"_id" : 3, "host" : "localhost:10003", <- 아비터 서버 등록
반응형