1인 MongodB University 12/21 - 복제품 세트 디자인
현재 진행 중인 노선: M103[1].하루에 3개 정도 챕터2를 진행하고 싶어요.
목표는 25일까지 15 step.
Chapter 2: Lab: Deploya Replica Set(연습 문제)
Problem
Launch a replica set with three members:
세 개의 던전집을 시작합시다!
authenticate internally using the keyfile/var/mongodb/pki/m103-keyfile
belong to the replica set m103-repl
참조 정보를 설정하려면 다음과 같이 하십시오.
- 매개변수를 사용하여 복사본 세트 조정 가능
# 接続してみる!
bash-4.4# mongo --port 27001
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27001/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("5930a10f-7f68-4282-869e-dd14001f66da") }
MongoDB server version: 4.0.5
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
>
던전집의 초기화.> rs.initiate()
{
"info2" : "no configuration specified. Using a default configuration for the set",
"me" : "localhost:27001",
"ok" : 1
}
잡아라.프롬프트에 "PRIMARY"가 표시됩니다!db.createUser({
user: "m103-admin",
pwd: "m103-pass",
roles: [
{role: "root", db: "admin"}
]
})
실제 처리.# mongo shellのプロンプトが変わりました!
m103-repl:OTHER>
# まずはユーザ作成 (さらにmongo shellのプロンプトが変わりました!)
m103-repl:PRIMARY> use admin
switched to db admin
m103-repl:PRIMARY> db.createUser({
user: "m103-admin",
pwd: "m103-pass",
roles: [
{role: "root", db: "admin"}
]
})
Successfully added user: {
"user" : "m103-admin",
"roles" : [
{
"role" : "root",
"db" : "admin"
}
]
}
# 残り2つ起動
bash-4.4# mongod -f mongod_2.conf
bash-4.4# mongod -f mongod_3.conf
bash-4.4# netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:27001 0.0.0.0:* LISTEN
tcp 0 0 localhost:27002 0.0.0.0:* LISTEN
tcp 0 0 localhost:27003 0.0.0.0:* LISTEN
tcp 0 0 localhost:53672 localhost:27001 TIME_WAIT
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 3 [ ] DGRAM 1150502782 /dev/log
unix 2 [ ACC ] STREAM LISTENING 1150659984 /tmp/mongodb-27002.sock
unix 2 [ ACC ] STREAM LISTENING 1150573201 /tmp/mongodb-27001.sock
unix 2 [ ACC ] STREAM LISTENING 1150658340 /tmp/mongodb-27003.sock
unix 2 [ ] DGRAM 1150502814
bash-4.4#
rs.add(host, arbiterOnly)
bash-4.4# mongo --port 27001 -u m103-admin -p m103-pass
---
# primaryに接続
m103-repl:PRIMARY>
m103-repl:PRIMARY> rs.add( { host: "localhost:27002" } )
{
"ok" : 1,
"operationTime" : Timestamp(1608562007, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1608562007, 1),
"signature" : {
"hash" : BinData(0,"CjAYCI3CxKlruG818lnvta3FkdU="),
"keyId" : NumberLong("6908718490643857410")
}
}
}
m103-repl:PRIMARY>
m103-repl:PRIMARY> rs.add( { host: "localhost:27003" } )
{
"ok" : 1,
"operationTime" : Timestamp(1608562027, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1608562027, 1),
"signature" : {
"hash" : BinData(0,"ih1GVxuhUrGc4nL6Zz0K5uCtGs8="),
"keyId" : NumberLong("6908718490643857410")
}
}
}
포획은 이런 느낌이에요."stateStar"확인: "SECONDARY"2개 "stateStar": "PRIMARY"1개!
m103-repl:PRIMARY> rs.status()
{
"set" : "m103-repl",
"date" : ISODate("2020-12-21T14:48:05.453Z"),
"myState" : 1,
"term" : NumberLong(1),
"syncingTo" : "",
"syncSourceHost" : "",
"syncSourceId" : -1,
"heartbeatIntervalMillis" : NumberLong(2000),
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(1608562083, 1),
"t" : NumberLong(1)
},
"readConcernMajorityOpTime" : {
"ts" : Timestamp(1608562083, 1),
"t" : NumberLong(1)
},
"appliedOpTime" : {
"ts" : Timestamp(1608562083, 1),
"t" : NumberLong(1)
},
"durableOpTime" : {
"ts" : Timestamp(1608562083, 1),
"t" : NumberLong(1)
}
},
"lastStableCheckpointTimestamp" : Timestamp(1608562027, 1),
"members" : [
{
"_id" : 0,
"name" : "localhost:27001",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 986,
"optime" : {
"ts" : Timestamp(1608562083, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2020-12-21T14:48:03Z"),
"syncingTo" : "",
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "",
"electionTime" : Timestamp(1608561372, 2),
"electionDate" : ISODate("2020-12-21T14:36:12Z"),
"configVersion" : 3,
"self" : true,
"lastHeartbeatMessage" : ""
},
{
"_id" : 1,
"name" : "localhost:27002",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 77,
"optime" : {
"ts" : Timestamp(1608562083, 1),
"t" : NumberLong(1)
},
"optimeDurable" : {
"ts" : Timestamp(1608562083, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2020-12-21T14:48:03Z"),
"optimeDurableDate" : ISODate("2020-12-21T14:48:03Z"),
"lastHeartbeat" : ISODate("2020-12-21T14:48:05.065Z"),
"lastHeartbeatRecv" : ISODate("2020-12-21T14:48:04.089Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "",
"syncingTo" : "localhost:27001",
"syncSourceHost" : "localhost:27001",
"syncSourceId" : 0,
"infoMessage" : "",
"configVersion" : 3
},
{
"_id" : 2,
"name" : "localhost:27003",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 58,
"optime" : {
"ts" : Timestamp(1608562083, 1),
"t" : NumberLong(1)
},
"optimeDurable" : {
"ts" : Timestamp(1608562083, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2020-12-21T14:48:03Z"),
"optimeDurableDate" : ISODate("2020-12-21T14:48:03Z"),
"lastHeartbeat" : ISODate("2020-12-21T14:48:05.066Z"),
"lastHeartbeatRecv" : ISODate("2020-12-21T14:48:04.338Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "",
"syncingTo" : "localhost:27001",
"syncSourceHost" : "localhost:27001",
"syncSourceId" : 0,
"infoMessage" : "",
"configVersion" : 3
}
],
"ok" : 1,
"operationTime" : Timestamp(1608562083, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1608562083, 1),
"signature" : {
"hash" : BinData(0,"rXS8Wjw1L/KN/HVCUX4TCVdDm9Y="),
"keyId" : NumberLong("6908718490643857410")
}
}
}
다행이다!!!!통과했어!!!!!
복습할 필요가 있었지만 드디어 통과했어!
오늘의 진전
단 하나, 훈련 문제 완성.
처음으로 복제품 세트 시작!
오늘의 젠.
계속 같은 방법으로 진행되고 있다.
업데이트된 통지가 왔다.감사합니다!!
각주
M103: Basic Cluster Administration세트.수업을 시작하면 이수까지의 기한은 두 달 이내이다.↩︎
Reference
이 문제에 관하여(1인 MongodB University 12/21 - 복제품 세트 디자인), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/akiko_pusu/articles/20201221-mongodb-univ텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)