분류 전체보기
-
[wine] 캔달잭슨 빈트너스 리저브 카베르네쇼비뇽 20192023.01.13
-
[wine] 페렐라다 파비올라 20172023.01.13
-
[MongoDB] Docker:mongodb admin 계정 생성 하기2023.01.11
[wine] 캔달잭슨 빈트너스 리저브 카베르네쇼비뇽 2019
캔달잭슨 빈트너스 리저브 카베르네쇼비뇽 2019
2022.12.31
Rating: ⭐️⭐️⭐️⭐️
Producer: Kendall-Jackson Vineyards
Region: California, USA
Reginal Style: Table Red
Grapes: Cabernet Sauvignon, Merlot, Cabernet Franc
Price: 29,000
Purchase: 올리브영
ALC: 14.5%
Color: Deep Purple
Aroma: Oak
Taste: 코르크향이 좋았고, 중간 바디감이 느껴졌던 거 같은데.. 기억이..
'일상들 > Wine story' 카테고리의 다른 글
[wine] 몬테스 알파 까르미네르 2019 (0) | 2023.01.13 |
---|---|
[wine] 꽁떼 디 깜삐아노 프리미티보 디 만두리아 (2) | 2023.01.13 |
[wine] 몬테스 알파 카베르네 쇼비뇽 2020 (0) | 2023.01.13 |
[wine] 투핸즈 홉스 앤 드림스 2021 (0) | 2023.01.13 |
[wine] 페렐라다 파비올라 2017 (0) | 2023.01.13 |
[wine] 페렐라다 파비올라 2017
페렐라다 파비올라 2017
2023.01.12
Rating: ⭐️⭐️⭐️⭐️
Region: Emporda, 🇪🇸
Reginal Style: Spanish Red
Grapes: Shiraz/Syrah, Cabernet Sauvignon, Grenache, Merlot
Alcohol: 14~15
Price: 25,000 (할인 가격이라 정확하지 않음)
Purchase: 올리브영
Color: 내눈에 검붉은색
Aroma: 진한 오크향
Taste: 개인적으로 처음 마셨을 때 입안에 스파이시함이 강하게 느껴지는 풀바디 느낌이었음, 오픈한지 40분 정도 지난 후에는 부드러움이 지배하여 오히려 처음에 거친 타닌감과 풀바디함이 약해졌지만, 최근 즐겼던 와인 중 전체적인 만족도가 가장 높은 편이었다.
'일상들 > Wine story' 카테고리의 다른 글
[wine] 몬테스 알파 까르미네르 2019 (0) | 2023.01.13 |
---|---|
[wine] 꽁떼 디 깜삐아노 프리미티보 디 만두리아 (2) | 2023.01.13 |
[wine] 몬테스 알파 카베르네 쇼비뇽 2020 (0) | 2023.01.13 |
[wine] 투핸즈 홉스 앤 드림스 2021 (0) | 2023.01.13 |
[wine] 캔달잭슨 빈트너스 리저브 카베르네쇼비뇽 2019 (0) | 2023.01.13 |
[MongoDB] Docker:mongodb 몽고 DB 설치(with. docker-compose)
MongoDB 로컬 환경 구성 (with. docker-compose)
docker-compose를 이용하여 MongoDB를 설치해 보려고 합니다.
먼저 docker-compose를 활용하여 MongoDB 컨테이너를 구성하기 위해서는 사전 작업으로 docker-desktop 설치를 우선적으로 해야 합니다.
설치가 안되신 분은 (Mac에서 Docker 설치하기)를 참고하셔서 docker-desktop 환경을 구성하시면 됩니다.
docker-compose.yml container image 추가 하기
ersion은 각 실습 환경에 맞는 docker 버전을 고려하여 작성하시면 됩니다. yml작성은 idl 등을 이용하시면 작성하시는데 도움이 됩니다.
version: '3'
services:
mongo1:
image: mongo:4.4.5
container_name: mongo1
expose:
- 27017
ports:
- 27017:27017
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "r0" ]
docker-compose 명령어
- docker-compose up //실행
- docker-compose down //종료
- docker ps //container 프로세스 확인
docker-compose up 명령어를 사용하여 컨테이너를 실행합니다.
> docker-compose up
Docker Compose is now in the Docker CLI, try `docker compose up`
Creating network "docker_default" with the default driver
Creating mongo1 ... done
mongo1 | {"t":{"$date":"2022-06-30T03:40:07.225+00:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
mongo1 | {"t":{"$date":"2022-06-30T03:40:07.228+00:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
mongo1 | {"t":{"$date":"2022-06-30T03:40:07.228+00:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
error log 없이 컨테이너가 올라왔다면 docker ps 명령어를 사용하여 생성된 컨테이너의 상태를 확인해 봅니다.
> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dc0c851d73a7 mongo:4.4.5 "/usr/bin/mongod --b…" 1 hours ago Up 1 hours 0.0.0.0:27017->27017/tcp mongo1
mongodb container 접속 하기
먼저 docker container terminal로 접속 후, 아래와 같이 정상적으로 mongo shell로 이동해 보겠습니다.
> docker exec -it mongo1 bash
root@dc0c851d73a7:/# mongo
MongoDB shell version v4.4.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("74aea9a1-e1b8-4367-ab9e-02b0d96cce37") }
MongoDB server version: 4.4.5
---
The server generated these startup warnings when booting:
2022-06-30T03:40:07.230+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
2022-06-30T03:40:07.727+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
2022-06-30T03:40:07.727+00:00: You are running this process as the root user, which is not recommended
---
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
MongoDB compass tool로 접속 하기
다양한 GUI Tool 중 compass를 이용하여 MongoDB에 접속해 보겠습니다. compass tool은 해당 링크에서 다운로드 가능합니다.
아래와 같이 정상적으로 접속이 되면 개발을 위한 MongoDB 환경 구성은 성공적으로 마무리 되었습니다.
오늘은 docker-compose를 활용한 로컬 환경 구성에 대하여 실습해 봤습니다.
'Database & NoSQL > NoSQL' 카테고리의 다른 글
[MongoDB] Docker:mongodb admin 계정 생성 하기
MongoDB admin user 생성 하기
실습 전에 docker, docker-compose, 그리고 MongoDB 컨테이너가 구성된 yml 파일이 필요한데, 이전 블로그를 참고해도 좋습니다.
[MongoDB docker-compose로 구성 하기]
MongoDB 컨테이너가 설치되었다는 가정하에 먼저 docker ps 명령어로 컨테이너 정보를 조회 합니다.
$docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dc0c851d73a7 mongo:4.4.5 "/usr/bin/mongod --b…" 2 hours ago Up 2 hours 0.0.0.0:27017->27017/tcp mongo1
MongoDB admin user 생성을 위해 docker 컨테이너 터미널로 접속해 보겠습니다.
$docker exec -it mongo1 bash //container terminal 접속
root@dc0c851d73a7:/# mongo
MongoDB shell version v4.4.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("7de3fbdb-078a-476c-8003-fcd12c1dd105") }
MongoDB server version: 4.4.5
---
The server generated these startup warnings when booting:
2022-06-30T03:40:07.230+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
2022-06-30T03:40:07.727+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
2022-06-30T03:40:07.727+00:00: You are running this process as the root user, which is not recommended
---
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
이제 admin db로 이동하여 순서대로 진행해 봅니다. 그 전에 replica 설정이 안되어 있을 경우 user 계정 생성이 불가할 수 있습니다.
admin db 이동 후 rs.status() 명령어로 replica set 상태를 확인해 봅니다.
> use admin //admin db 이동
switched to db amdin
> rs.status()
{
"ok" : 0,
"errmsg" : "no replset config has been received",
"code" : 94,
"codeName" : "NotYetInitialized"
}
> db.createUser(
... {
... user: "admin",
... pwd: passwordPrompt(), // or cleartext password
... roles: [ { role: "root", db: "admin" } ]
... }
... ) //replica 설정이 없어서 아래 오류 발생함.
Enter password:
uncaught exception: Error: couldn't add user: not master :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1386:11
@(shell):1:1
이제 다시 rs.initiate() 명령어로 default replica 정보를 설정합니다. 아래와 같이 변경된 커맨드로 전환되면 됩니다.
그리고 rs.status() 명령어로 설정을 재확인 합니다.
> rs.initiate() //replica default 설정
r0:SECONDARY>
r0:PRIMARY> rs.status()
{
"set" : "r0",
"date" : ISODate("2022-06-30T04:12:32.988Z"),
"myState" : 1,
"term" : NumberLong(1),
"syncSourceHost" : "",
"syncSourceId" : -1,
"heartbeatIntervalMillis" : NumberLong(2000),
"majorityVoteCount" : 1,
"writeMajorityCount" : 1,
"votingMembersCount" : 1,
"writableVotingMembersCount" : 1,
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(1656562345, 1),
"t" : NumberLong(1)
},
"lastCommittedWallTime" : ISODate("2022-06-30T04:12:25.854Z"),
"readConcernMajorityOpTime" : {
"ts" : Timestamp(1656562345, 1),
"t" : NumberLong(1)
},
"readConcernMajorityWallTime" : ISODate("2022-06-30T04:12:25.854Z"),
"appliedOpTime" : {
"ts" : Timestamp(1656562345, 1),
"t" : NumberLong(1)
},
"durableOpTime" : {
"ts" : Timestamp(1656562345, 1),
"t" : NumberLong(1)
},
"lastAppliedWallTime" : ISODate("2022-06-30T04:12:25.854Z"),
"lastDurableWallTime" : ISODate("2022-06-30T04:12:25.854Z")
},
"lastStableRecoveryTimestamp" : Timestamp(1656562335, 1),
"electionCandidateMetrics" : {
"lastElectionReason" : "electionTimeout",
"lastElectionDate" : ISODate("2022-06-30T04:03:15.746Z"),
"electionTerm" : NumberLong(1),
"lastCommittedOpTimeAtElection" : {
"ts" : Timestamp(0, 0),
"t" : NumberLong(-1)
},
"lastSeenOpTimeAtElection" : {
"ts" : Timestamp(1656561795, 1),
"t" : NumberLong(-1)
},
"numVotesNeeded" : 1,
"priorityAtElection" : 1,
"electionTimeoutMillis" : NumberLong(10000),
"newTermStartDate" : ISODate("2022-06-30T04:03:15.778Z"),
"wMajorityWriteAvailabilityDate" : ISODate("2022-06-30T04:03:15.853Z")
},
"members" : [
{
"_id" : 0,
"name" : "dc0c851d73a7:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 1945,
"optime" : {
"ts" : Timestamp(1656562345, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2022-06-30T04:12:25Z"),
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "",
"electionTime" : Timestamp(1656561795, 2),
"electionDate" : ISODate("2022-06-30T04:03:15Z"),
"configVersion" : 1,
"configTerm" : 1,
"self" : true,
"lastHeartbeatMessage" : ""
}
],
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1656562345, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
},
"operationTime" : Timestamp(1656562345, 1)
}
다시 db.createUser() 명령어를 실행하여 admin user 생성을 시도하면 아래 처럼 successfully 메세지와 생성된 계정 정보를 확인할 수 있습니다.
이때 password는 Prompt or cleartext 형태로 진행할 수 있습니다.
//role type: root, readWrite, dbOwner
r0:PRIMARY> db.createUser(
... {
... user: "admin",
... pwd: passwordPrompt(), // or cleartext password
... roles: [{ role: "root", db: "admin" }]
... }
... )
Enter password:
Successfully added user: {
"user" : "admin",
"roles" : [
{
"role" : "root",
"db" : "admin"
}
]
}
r0:PRIMARY>
이제 생성된 계정으로 MongoDB 명령어를 사용해 봅니다.
r0:PRIMARY> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
오늘은 MongoDB에서 admin user 생성하는 방법에 대하여 정리해 봤습니다.
'Database & NoSQL > NoSQL' 카테고리의 다른 글
[MongoDB] Docker:mongodb Replica Set 구성 하기
MongoDB Replica Config 설정
docker container names 확인
$docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
346c91282c62 mongo:4.4.5 "/usr/bin/mongod --b…" 2 hours ago Up 2 hours 27019/tcp, 0.0.0.0:27019->27017/tcp mongo3
dc0c851d73a7 mongo:4.4.5 "/usr/bin/mongod --b…" 2 hours ago Up 2 hours 0.0.0.0:27017->27017/tcp mongo1
97c22ce1192c mongo:4.4.5 "/usr/bin/mongod --b…" 2 hours ago Up 2 hours 27018/tcp, 0.0.0.0:27018->27017/tcp mongo2
docker container 터미널 및 mongo shell 접속
$docker exec -it mongo1 bash //container terminal 접속
root@dc0c851d73a7:/# mongo //mongo shell 접속
MongoDB shell version v4.4.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("07312a4b-c4d4-4aef-96c7-f733eccdc611") }
MongoDB server version: 4.4.5
> use admin //admin db 이동
switched to db admin
replica set config 설정
rs.status() 명령어로 설정 정보를 확인하면 아래와 같이 no repliset 정보가 노출된다.
> rs.status()
{
"ok" : 0,
"errmsg" : "no replset config has been received",
"code" : 94,
"codeName" : "NotYetInitialized"
}
초기화만 진행할 경우는 rs.initate() 명령어로 rsconf 설정 정보 없이 진행해도 되고, 명령어 수행 후 아래와 같이 커맨드가 변경된다.
> rs.initiate()
rs0:PRIMARY>
P-S-S 환경으로 구축했다면 아래와 같이 replica rsconf 정보를 기동한 Container host 및 ip에 맞춰 등록해준다.
> rsconf = { "_id" : "rs0", "members" : [ { "_id" : 0, "host" : "mongo1:27017", "priority" : 1 }, {"_id" : 1, "host" : "mongo2:27017", "priority": 2 }, {"_id": 2, "host": "mongo3:27017", "priority": 3 } ]}
{
"_id" : "rs0",
"members" : [
{
"_id" : 0,
"host" : "mongo1:27017",
"priority" : 1
},
{
"_id" : 1,
"host" : "mongo2:27017",
"priority" : 2
},
{
"_id" : 2,
"host" : "mongo3:27017",
"priority" : 3
}
]
}
> rs.initiate(rsconf)
{ "ok" : 1 }
rs0:SECONDARY>
아래와 같이 변경된 커맨드를 확인할 수 있고, rs.status()로 rs 상태를 점검해 본다.
r0:PRIMARY>
rs0:PRIMARY> rs.status()
{
"set" : "rs0",
"date" : ISODate("2024-04-12T01:39:28.051Z"),
"myState" : 1,
"term" : NumberLong(9),
"syncSourceHost" : "",
"syncSourceId" : -1,
"heartbeatIntervalMillis" : NumberLong(2000),
"majorityVoteCount" : 2,
"writeMajorityCount" : 2,
"votingMembersCount" : 3,
"writableVotingMembersCount" : 3,
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(1712885964, 1),
"t" : NumberLong(9)
},
"lastCommittedWallTime" : ISODate("2024-04-12T01:39:24.677Z"),
"readConcernMajorityOpTime" : {
"ts" : Timestamp(1712885964, 1),
"t" : NumberLong(9)
},
"appliedOpTime" : {
"ts" : Timestamp(1712885964, 1),
"t" : NumberLong(9)
},
"durableOpTime" : {
"ts" : Timestamp(1712885964, 1),
"t" : NumberLong(9)
},
"lastAppliedWallTime" : ISODate("2024-04-12T01:39:24.677Z"),
"lastDurableWallTime" : ISODate("2024-04-12T01:39:24.677Z")
},
"lastStableRecoveryTimestamp" : Timestamp(1712885924, 1),
"electionCandidateMetrics" : {
"lastElectionReason" : "priorityTakeover",
"lastElectionDate" : ISODate("2024-04-12T00:19:54.539Z"),
"electionTerm" : NumberLong(9),
"lastCommittedOpTimeAtElection" : {
"ts" : Timestamp(1712881186, 1),
"t" : NumberLong(8)
},
"lastSeenOpTimeAtElection" : {
"ts" : Timestamp(1712881186, 1),
"t" : NumberLong(8)
},
"numVotesNeeded" : 2,
"priorityAtElection" : 2,
"electionTimeoutMillis" : NumberLong(10000),
"priorPrimaryMemberId" : 0,
"numCatchUpOps" : NumberLong(0),
"newTermStartDate" : ISODate("2024-04-12T00:19:54.547Z"),
"wMajorityWriteAvailabilityDate" : ISODate("2024-04-12T00:19:55.547Z")
},
"members" : [
{
"_id" : 0,
"name" : "mongo1:27017",
"health" : 1,
"state" : 2,
"stateStr" : "PRIMARY",
"uptime" : 4783,
"optime" : {
"ts" : Timestamp(1712885964, 1),
"t" : NumberLong(9)
},
"optimeDurable" : {
"ts" : Timestamp(1712885964, 1),
"t" : NumberLong(9)
},
"optimeDate" : ISODate("2024-04-12T01:39:24Z"),
"optimeDurableDate" : ISODate("2024-04-12T01:39:24Z"),
"lastHeartbeat" : ISODate("2024-04-12T01:39:26.957Z"),
"lastHeartbeatRecv" : ISODate("2024-04-12T01:39:26.961Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "",
"syncSourceHost" : "mongo2:27017",
"syncSourceId" : 3,
"infoMessage" : "",
"configVersion" : 13,
"configTerm" : 9
},
{
"_id" : 1,
"name" : "mongo2:27017",
"health" : 1,
"state" : 1,
"stateStr" : "SECONDARY",
"uptime" : 4787,
"optime" : {
"ts" : Timestamp(1712885964, 1),
"t" : NumberLong(9)
},
"optimeDate" : ISODate("2024-04-12T01:39:24Z"),
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "",
"electionTime" : Timestamp(1712881194, 1),
"electionDate" : ISODate("2024-04-12T00:19:54Z"),
"configVersion" : 13,
"configTerm" : 9,
"self" : true,
"lastHeartbeatMessage" : ""
},
{
"_id" : 2,
"name" : "mongo3:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 4783,
"optime" : {
"ts" : Timestamp(1712885964, 1),
"t" : NumberLong(9)
},
"optimeDurable" : {
"ts" : Timestamp(1712885964, 1),
"t" : NumberLong(9)
},
"optimeDate" : ISODate("2024-04-12T01:39:24Z"),
"optimeDurableDate" : ISODate("2024-04-12T01:39:24Z"),
"lastHeartbeat" : ISODate("2024-04-12T01:39:26.958Z"),
"lastHeartbeatRecv" : ISODate("2024-04-12T01:39:26.962Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "",
"syncSourceHost" : "mongo1:27017",
"syncSourceId" : 0,
"infoMessage" : "",
"configVersion" : 13,
"configTerm" : 9
}
],
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1712885964, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
},
"operationTime" : Timestamp(1712885964, 1)
}
설정된 replica conf 정보 확인해보자
members 속성 중 priority 높은 순서에 따라 primary가 shutdown될 경우 높은 secondary가 primary로 전환된다.
rs0:PRIMARY> rs.conf()
{
"_id" : "rs0",
"version" : 12,
"term" : 9,
"members" : [
{
"_id" : 0,
"host" : "mongo1:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"secondaryDelaySecs" : NumberLong(0),
"votes" : 1
},
{
"_id" : 1,
"host" : "mongo2:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 3,
"tags" : {
},
"secondaryDelaySecs" : NumberLong(0),
"votes" : 1
},
{
"_id" : 2,
"host" : "mongo3:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"secondaryDelaySecs" : NumberLong(0),
"votes" : 1
}
],
"protocolVersion" : NumberLong(1),
"writeConcernMajorityJournalDefault" : true,
"settings" : {
"chainingAllowed" : true,
"heartbeatIntervalMillis" : 2000,
"heartbeatTimeoutSecs" : 10,
"electionTimeoutMillis" : 10000,
"catchUpTimeoutMillis" : -1,
"catchUpTakeoverDelayMillis" : 30000,
"getLastErrorModes" : {
},
"getLastErrorDefaults" : {
"w" : 1,
"wtimeout" : 0
},
"replicaSetId" : ObjectId("6617491a03de995df431b70d")
}
}
replica members add/remove 하자
remove 전 삭제하고자하는 인스턴스를 먼저 종료 하자.
rs0:SECONDARY> db.shutdownServer()
primary node로 접속 하자.
rs0:PRIMARY> cfg = rs.conf()
rs0:PRIMARY> cfg.memebrs.splice(2,1) // 2번째 로우부터 1개 삭제
rs0:PRIMARY> rs.reconfig(cfg)
rs0:PRIMARY> cfg = rs.conf() //cfg에 현재 conf 정보를 저장하고
{
"_id" : "rs0",
"version" : 13,
"term" : 11,
"members" : [
{
"_id" : 0,
"host" : "mongo1:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 2,
"tags" : {
},
"secondaryDelaySecs" : NumberLong(0),
"votes" : 1
},
{
"_id" : 3,
"host" : "mongo2:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 3,
"tags" : {
},
"secondaryDelaySecs" : NumberLong(0),
"votes" : 1
},
{
"_id" : 4,
"host" : "mongo3:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"secondaryDelaySecs" : NumberLong(0),
"votes" : 1
}
],
"protocolVersion" : NumberLong(1),
"writeConcernMajorityJournalDefault" : true,
"settings" : {
"chainingAllowed" : true,
"heartbeatIntervalMillis" : 2000,
"heartbeatTimeoutSecs" : 10,
"electionTimeoutMillis" : 10000,
"catchUpTimeoutMillis" : -1,
"catchUpTakeoverDelayMillis" : 30000,
"getLastErrorModes" : {
},
"getLastErrorDefaults" : {
"w" : 1,
"wtimeout" : 0
},
"replicaSetId" : ObjectId("6617491a03de995df431b70d")
}
}
rs0:PRIMARY> cfg.members[1].priority = 1 // members 2번째 node의 priority 순서를 변경한 후
1
rs0:PRIMARY> rs.reconfig(cfg) // 설정을 다시해준다.
{
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1712886887, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
},
"operationTime" : Timestamp(1712886887, 1)
}
rs0:PRIMARY> rs.conf() // 변경 내역 확인
{
"_id" : "rs0",
"version" : 14,
"term" : 11,
"members" : [
{
"_id" : 0,
"host" : "mongo1:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 2,
"tags" : {
},
"secondaryDelaySecs" : NumberLong(0),
"votes" : 1
},
{
"_id" : 3,
"host" : "mongo2:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"secondaryDelaySecs" : NumberLong(0),
"votes" : 1
},
{
"_id" : 4,
"host" : "mongo3:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"secondaryDelaySecs" : NumberLong(0),
"votes" : 1
}
],
"protocolVersion" : NumberLong(1),
"writeConcernMajorityJournalDefault" : true,
"settings" : {
"chainingAllowed" : true,
"heartbeatIntervalMillis" : 2000,
"heartbeatTimeoutSecs" : 10,
"electionTimeoutMillis" : 10000,
"catchUpTimeoutMillis" : -1,
"catchUpTakeoverDelayMillis" : 30000,
"getLastErrorModes" : {
},
"getLastErrorDefaults" : {
"w" : 1,
"wtimeout" : 0
},
"replicaSetId" : ObjectId("6617491a03de995df431b70d")
}
}
다음에는 실제 구성된 레플리카 환경에서 Spring Boot MongoDB 어플리케이션을 연동하여 테스트 하고자 한다.