Operator でどう変わる? これからのデータベース運用 / cndt2019_k8s_operator
by
yukirii
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
0QFSBUPSͰͲ͏มΘΔʁ ͜Ε͔Βͷσʔλϕʔεӡ༻ $MPVE/BUJWF%BZT5PLZP :VLJ,JSJJ ,VCFSOFUFT
Slide 2
Slide 2 text
"CPVU.F :VLJ,JSJJ *OGSBTUSVDUVSF&OHJOFFS ZVLJSJJ@ ZVLJSJJ $FSUJpFE,VCFSOFUFT"ENJOJTUSBUPS $," גࣜձࣾαΠόʔΤʔδΣϯτ ٕज़ຊ෦4FSWJDF3FMJBCJMJUZ(SPVQ 43( "NFCBͷը૾৴γεςϜج൫γεςϜͷΠϯϑϥΛ୲
Slide 3
Slide 3 text
ࠓ͓͢͠Δ͜ͱ ˒ ,VCFSOFUFT0QFSBUPSΛ͏ͱͲΜͳࣄ͕Ͱ͖Δͷ͔ ˒ ͲΜͳ͕͏Ε͍͠ͷ͔ ࣮ྫͱͯ͠σʔλϕʔεΛಈ͔͢ྫΛަ͑ͳ͕Βղઆ͍͖ͯ͠·͢ ·ͣͬͯݟΔͱ͜Ζ͔Β͡ΊͯΈ·͠ΐ͏ʂ ͠ͳ͍͜ͱ ˒ ,VCFSOFUFT0QFSBUPSͷ࡞Γํ ຊͷࢿྉެ։͠·͢ͷͰ ࣸਅऔΒͳͯ͘େৎͰ͢Ϥʂ
Slide 4
Slide 4 text
"NFCBͷΦϯϓϨ,VCFSOFUFTΫϥελ "NFCBϢʔβͷϓϩϑΟʔϧγεςϜ ৽ϓϩδΣΫτ ‣ ‣ ྺ࢙తܦҢͰஅ͞Ε͍ͯͨͭͷγεςϜΛ ౷߹͠ϦχϡʔΞϧʂ ʮϦχϡʔΞϧΛظʹ%PDLFSԽʂʯ ʮίϯςφΦʔέετϨʔγϣϯʹ ɹ,VCFSOFUFTΛ͏ͧʂʂʯ ϓϥΠϕʔτΫϥυ্ʹ ,VCFSOFUFTΫϥελ͕ര
Slide 5
Slide 5 text
"NFCBͷΦϯϓϨ,VCFSOFUFTΫϥελ 0QFO4UBDL্ʹߏங ‣ σϓϩΠ,VCFTQSBZͰ .Z42-σʔλϕʔε ‣ LTΫϥελͷ֎ʹ7.Ͱߏங ‣ .BTUFS4MBWF .)"GPS.Z42- 7. 7. 7. 7. .BTUFS 7. 4MBWF ˞Πϯλʔωοτࠂࣄۀ෦ͷ,VCFSOFUFT ",& ͱผͷڥͰ͢ ࠓͳΒ%#Λ,VCFSOFUFTʹ ͷͤΔ͜ͱͰ͖Δʁ ͲΜͳํ๏͕͋ΔͩΖ͏ʁʁ
Slide 6
Slide 6 text
5PEBZ`T"HFOEB ίϯςφͰεςʔτϑϧͳΞϓϦέʔγϣϯΛಈ͔͢ ,VCFSOFUFT0QFSBUPSͱ ࣮ྫ.Z42-0QFSBUPSΛಈ͔ͯ͠ΈΑ͏ ,VCFSOFUFT0QFSBUPSͷ͜Ε͔Β ߟྀ͖͢ϙΠϯτͱ,VCFSOFUFT্Ͱͷղܾํ๏ʹ͍ͭͯΔ $VTUPN3FTPVSDFΛ׆༻ͨ͠ӡ༻ࣗಈԽͷύλʔϯʹ͍ͭͯΔ 0QFSBUPSͷ༻ײʁ࣮ࡍʹLT্Ͱ.Z42-Λಈ͔ͯ͠ΈΔ ؔ࿈ϓϩδΣΫτͷհͱ0QFSBUPSͷࠓޙʹ͍ͭͯ
Slide 7
Slide 7 text
ίϯςφͰεςʔτϑϧͳΞϓϦΛಈ্͔͢ͰͷͭͷϙΠϯτ ΞϓϦέʔγϣϯݻ༗ͷ ӡ༻φϨοδ Ӭଓతͳσʔλͷѻ͍
Slide 8
Slide 8 text
εςʔτϨεͳΞϓϦέʔγϣϯͷ߹ 8FCαʔό"1*αʔόʜΞϓϦέʔγϣϯঢ়ଶΛ࣋ͨͳ͍ OPEF OPEF OPEF ͲͷϗετͰىಈͰ͖Δ 㾎 ϙʔλϏϦςΟ͕ߴ͍ ૿͍͢͠ݮΒ͍͢͠ 㾎 εέʔϥϏϦςΟ͕ߴ͍ ͷ͋ΔίϯςφࣺͯΔ͜ͱ͕Ͱ͖Δ 㾎 ճ෮ྗ͕ߴ͍
Slide 9
Slide 9 text
εςʔτϑϧͳΞϓϦέʔγϣϯͷ߹ σʔλϕʔεࢄγεςϜʜΞϓϦέʔγϣϯঢ়ଶΛ࣋ͭ ΞϓϦέʔγϣϯͷϥΠϑαΠΫϧͱͷΪϟοϓ 4UBSUFE 4UPQQFE $SFBUFE ,JMMFE ίϯςφͷσʔλͷอ࣋ظؒ ίϯςφͷϥΠϑαΠΫϧ σϓϩΠͷ୯Ґ ΞϓϦέʔγϣϯͷ ϥΠϑαΠΫϧ ίϯςφΠϯελϯεͷ֎ σʔλͷӬଓԽ͕ඞཁ ΞϓϦέʔγϣϯ͕ σʔλΛඞཁͱ͢Δظؒ
Slide 10
Slide 10 text
εςʔτϑϧͳΞϓϦέʔγϣϯͷ߹ σʔλϕʔεࢄγεςϜʜΞϓϦέʔγϣϯঢ়ଶΛ࣋ͭ ࠶ىಈผϗετͰىಈ͢Δέʔεͷߟྀඞཁ ‣ ಉ͡σʔλ͕࠶ͼར༻ՄೳͰͳ͚ΕͳΒͳ͍ ྫ%#ͷ߸ػ༻1PEͰɺҎલͱಉ͡ ɹ1PE༻ͷϘϦϡʔϜΛϚϯτͯ͠΄͍͠ OPEF OPEF OPEF ʁ SFSFTDIFEVMJOH
Slide 11
Slide 11 text
εςʔτϑϧͳΞϓϦέʔγϣϯͷ߹ σʔλϕʔεࢄγεςϜˠΞϓϦέʔγϣϯঢ়ଶΛ࣋ͭ ݻఆͷ໊લΛ͍͍ͨ ‣ ଟͷϊʔυͰߏ͞ΕΔγεςϜͷ߹ ϗετ໊*1͕มΘΔͱϝϯόͷಛఆ͕͘͠ͳΔ OPEF OPEF OPEF %#$MVTUFS $POpH'JMF .FNCFST OPEFT[DQʜ/PU'PVOE OPEFUIW[ʜ/PU'PVOE ʁ OPEFIUIC OPEFQMTT
Slide 12
Slide 12 text
4UBUFGVM4FU εςʔτϑϧͳΞϓϦέʔγϣϯΛಈ͔ͨ͢Ίͷ,VCFSOFUFTΈࠐΈͷϦιʔε ‣ 1PEͰ༻͢ΔӬଓσʔλͷऔΓѻ͍ͱωʔϛϯάͷ՝Λղܾ NZTRM NZTRM NZTRM NZTRM ॱ൪ʹ σϓϩΠ ॱ൪ʹ ऴྃআ ֤1PEʹઐ༻ͷετϨʔδϘϦϡʔϜΛ ׂΓͯΔ ରԠؔҡ࣋͞ΕΔ 1PEʹݻఆͷࣝผࢠΛׂΓͯΔ
Slide 13
Slide 13 text
ίϯςφͰεςʔτϑϧͳΞϓϦΛಈ্͔͢ͰͷͭͷϙΠϯτ ΞϓϦέʔγϣϯݻ༗ͷ ӡ༻φϨοδ Ӭଓతͳσʔλͷѻ͍ ʁʁʁ 4UBUFGVM4FU ,VCFSOFUFTͷඪ४ػೳ ඪ४ػೳ͕αϙʔτ͠ͳ͍ྖҬ
Slide 14
Slide 14 text
εςʔτϑϧͳΞϓϦέʔγϣϯͷ߹ σʔλϕʔεࢄγεςϜˠΞϓϦέʔγϣϯঢ়ଶΛ࣋ͭ ΞϓϦέʔγϣϯݻ༗ͷૢ࡞͕ඞཁ ‣ ,VCFSOFUFT্Ͱࣗಈ࡞͕લఏ ‣ ىಈޙʹԿΒ͔ͷΦϖϨʔγϣϯ͕ඞཁͳ߹ ࣗಈԽͰߦ͏Έ͕΄͍͠ ‣ ྫ৽ن%#ϊʔυͷΫϥελͷKPJOૢ࡞ ‣ ྫো͔Βͷ෮چʹΦϖϨʔγϣϯ͕ඞཁ OPEF OPEF OPEF ʁ %#$MVTUFS +PJOJOHBOPEF Ͳ͏ରॲ͢Δʜʁ
Slide 15
Slide 15 text
5PEBZ`T"HFOEB ίϯςφͰεςʔτϑϧͳΞϓϦέʔγϣϯΛಈ͔͢ ,VCFSOFUFT0QFSBUPSͱ ࣮ྫ.Z42-0QFSBUPSΛಈ͔ͯ͠ΈΑ͏ ,VCFSOFUFT0QFSBUPSͷ͜Ε͔Β ߟྀ͖͢ϙΠϯτͱ,VCFSOFUFT্Ͱͷղܾํ๏ʹ͍ͭͯΔ $VTUPN3FTPVSDFΛ׆༻ͨ͠ӡ༻ࣗಈԽͷύλʔϯʹ͍ͭͯΔ 0QFSBUPSͷ༻ײʁ࣮ࡍʹLT্Ͱ.Z42-Λಈ͔ͯ͠ΈΔ ؔ࿈ϓϩδΣΫτͷհͱ0QFSBUPSͷࠓޙʹ͍ͭͯ
Slide 16
Slide 16 text
,VCFSOFUFT0QFSBUPS ಛఆͷΞϓϦέʔγϣϯΛ,VCFSOFUFT্Ͱ࣮ߦɾཧ͢ΔͨΊͷιϑτΣΞ $POUSPMMFS ‣ $PSF04͕ఏএͨ͠ख๏ ‣ ӡ༻্ͷφϨοδ͕ιϑτΣΞͱ࣮ͯ͠͞Ε͍ͯΔ ‣ 0QFSBUPSࣗମ,VCFSOFUFTͰཧ͞ΕΔίϯςφͱͯ͠ಈ࡞ IUUQTDPSFPTDPNCMPHJOUSPEVDJOHPQFSBUPSTIUNM 㾎 ΞϓϦέʔγϣϯͷόʔδϣϯΞοϓ 㾎 ෳࡶͳোճ෮ͷखॱͷ࣮ߦ 㾎 ఆظతͳσʔλͷόοΫΞοϓ 㾎 εςʔτϑϧͳΞϓϦέʔγϣϯͷ εέʔϧΞοϓμϯ 0QFSBUPS $SFBUF/FX1PE #BDLVQ ΞϓϦέʔγϣϯݻ༗ͷӡ༻खॱΛ ιϑτΣΞԽ
Slide 17
Slide 17 text
͓͞Β͍ ,VCFSOFUFTͷಛͱಈ࡞ ಛ%FDMBSBUJWF એݴతͳ "1* ‣ ϢʔβͳʹΛୡ͍ͨ͠ͷ͔ EFTJSFETUBUF ΛγεςϜʹ͑Δ apiVersion: extensions/v1beta1 kind: ReplicaSet metadata: name: nginx spec: replicas: 3 template: spec: containers: - name: nginx image: nginx:latest Ϣʔβ"1*Λ௨ͯ͠ 3FTPVSDFΛొ͢Δ $POUSPMMFS"1*Λ௨ͯ͠ 3FTPVSDFͷΦϒδΣΫτΛཧ͢Δ 8BUDI "QQMZ 3FQMJDB4FU3FTPVSDF OBNFOHJOY 3FQMJDB4FU $POUSPMMFS
Slide 18
Slide 18 text
͓͞Β͍ ,VCFSOFUFTͷಛͱಈ࡞ ಛ$POUSPMMFSʹΑΔ3FDPODJMJBUJPOMPPQ ௐϧʔϓ ‣ ,VCFSOFUFTෳͷಠཱͨ͠$POUSPMMFSͷू߹ମ ‣ ֤$POUSPMMFS͕୲͢Δ3FTPVSDFͷΦϒδΣΫτΛl·͍͠ঢ়ଶ EFTJSFETUBUF zʹҡ࣋͢Δ 3FQMJDB4FU$POUSPMMFS 0CTFSWF "OBMZ[F l3FQMJDB4FU9z͕ߋ৽͞Εͨ %FTJSFETUBUFSFQMJDBT $VSSFOUTUBUFSFQMJDBT kubectl apply -f replicaset.yaml "DU $SFBUFOFX1PE $VSSFOUTUBUFSFQMJDBT 3FQMJDB4FU9 VQEBUFE 6QEBUF DVSSFOUTUBUF $SFBUF ྫ 3FQMJDB4FU
Slide 19
Slide 19 text
,VCFSOFUFT0QFSBUPSͷߏ Ϣʔβ,VCFSOFUFTΛಠࣗͷ3FTPVSDFͱ$POUSPMMFSͰ֦ுͰ͖Δ ‣ 0QFSBUPS͜ͷΈΛ׆༻ $VTUPN3FTPVSDF ‣ ϢʔβʹΑͬͯಠࣗʹఆٛ͞Εͨ3FTPVSDF ‣ ྫԿͷσʔλϕʔεγεςϜΛɺԿͰߏ͢Δ͔Λఆٛ ‣ $VTUPN3FTPVSDF%FpOJUJPOT $3% ʹΑͬͯLT"1*Λ֦ு͢Δͱѻ͑ΔΑ͏ʹͳΔ $VTUPN$POUSPMMFS ‣ ϢʔβʹΑͬͯಠࣗʹఆٛ͞Εͨ$POUSPMMFS ‣ $VTUPN3FTPVSDFͷΦϒδΣΫτΛlEFTJSFETUBUFlʹҡ࣋͢Δ ‣ ྫ৽͍͠1PEΛΫϥελʹΈࠐΉॲཧΛߦ͏ ‣ ྫ1PEͷεςʔλεΛऔಘ͠ɺඞཁʹԠͯ͡෮چखॱΛ࣮ࢪ͢Δ
Slide 20
Slide 20 text
,VCFSOFUFT0QFSBUPSͷಈ࡞ $VTUPN$POUSPMMFS 0CTFSWF "OBMZ[F l%BUBCBTF9z͕ߋ৽͞Εͨ %FTJSFETUBUFWFSTJPOW $VSSFOUTUBUFWFSTJPOW kubectl apply -f database.yaml "DU 3PMMJOH6QEBUF $VSSFOUTUBUFWFSTJPOW %BUBCBTF9 VQEBUFE 6QEBUF DVSSFOUTUBUF 6QEBUF $VTUPN3FTPVSDFʹج͖ͮ$VTUPN$POUSPMMFS͕ඞཁͳଞͷ3FTPVSDFΛૢ࡞͢Δ ྫ σʔλϕʔεΛ ɹཧ͢Δ0QFSBUPSͷྫ
Slide 21
Slide 21 text
5PEBZ`T"HFOEB ίϯςφͰεςʔτϑϧͳΞϓϦέʔγϣϯΛಈ͔͢ ߟྀ͖͢ϙΠϯτͱ,VCFSOFUFT্Ͱͷղܾํ๏ʹ͍ͭͯΔ ,VCFSOFUFT0QFSBUPSͱ $VTUPN3FTPVSDFΛ׆༻ͨ͠ӡ༻ࣗಈԽͷύλʔϯʹ͍ͭͯΔ ࣮ྫ.Z42-0QFSBUPSΛಈ͔ͯ͠ΈΑ͏ 0QFSBUPSͷ༻ײʁ࣮ࡍʹLT্Ͱ.Z42-Λಈ͔ͯ͠ΈΔ ,VCFSOFUFT0QFSBUPSͷ͜Ε͔Β ؔ࿈ϓϩδΣΫτͷհͱ0QFSBUPSͷࠓޙʹ͍ͭͯ
Slide 22
Slide 22 text
PSBDMFNZTRMPQFSBUPS .Z42-*OOP%#$MVTUFSΛ,VCFSOFUFT্Ͱಈ࡞ͤ͞ΔͨΊͷ0QFSBUPS ‣ 0SBDMFͷ044ϓϩδΣΫτ ‣ ݱࡏW ‣ .Z42-WdΛαϙʔτ ‣ ίϚϯυͭͰՄ༻ੑͷߴ͍.Z42-ΫϥελΛ,VCFSOFUFT্ʹσϓϩΠ ‣ ߏஙӡ༻ʹඞཁͳφϨοδ͕ιϑτΣΞͱ࣮ͯ͠͞Ε͍ͯΔ ‣ Ϋϥελͷ࡞ɾআ ‣ ΫϥελͷϦαΠζ ‣ োͷݕͱ෮چ ‣ όοΫΞοϓͱϦετΞ IUUQTHJUIVCDPNPSBDMFNZTRMPQFSBUPS
Slide 23
Slide 23 text
ࢀߟ .Z42-*OOP%#$MVTUFS .Z42-͚ͷߴՄ༻ੑιϦϡʔγϣϯ .Z42-(SPVQ3FQMJDBUJPO ෳͷ.BTUFSؒͰϨϓϦέʔγϣϯΛߏ ϝϯόγοϓཧɾϑΣΠϧΦʔόʔɾ߹ੑҡ࣋Λࣗಈతʹߦ͏ ‣ 4JOHMF1SJNBSZ EFGBVMU ࣗಈͰબΕͨͷαʔό͕ߋ৽Λड͚͚Δ 1SJNBSZͷো࣌4FDPOEBSZ͕ࣗಈతͰ1SJNBSZʹঢ֨ ‣ .VMUJ1SJNBSZ શαʔόͰߋ৽Λड͚͚Δ .Z42-3PVUFS ΞϓϦέʔγϣϯ͔Βͷ3FBE8SJUFτϥϑΟοΫΛ దͳόοΫΤϯυͷ.Z42-αʔόϧʔςΟϯά IUUQTEFWNZTRMDPNEPDSFGNBOFONZTRMJOOPECDMVTUFSJOUSPEVDUJPOIUNM
Slide 24
Slide 24 text
.Z42-*OOP%#$MVTUFSPO,VCFSOFUFT .Z42-0QFSBUPS $VTUPN$POUSPMMFS
Slide 25
Slide 25 text
.Z42-*OOP%#$MVTUFSPO,VCFSOFUFT .Z42-$MVTUFS $VTUPN3FTPVSDF .Z42-0QFSBUPS $VTUPN$POUSPMMFS 8BUDI
Slide 26
Slide 26 text
.Z42-*OOP%#$MVTUFSPO,VCFSOFUFT NZTRMBHFOU NZTRM NZTRMBHFOU NZTRM NZTRMBHFOU NZTRM NZTRM4UBUFGVM4FU (SPVQ3FQMJDBUJPO .Z42-$MVTUFS $VTUPN3FTPVSDF .Z42-0QFSBUPS $VTUPN$POUSPMMFS 8BUDI $SFBUF ΫϥελϝϯόΛ੍ޚ͢Δ.Z42-"HFOUͱ ҰॹʹσϓϩΠ͞ΕΔ (SPVQ3FQMJDBUJPOʹΑΔ ߴՄ༻ੑάϧʔϓ ࣗతͳϝϯόཧ োݕɾ෮چ͕ߦΘΕΔ
Slide 27
Slide 27 text
.Z42-*OOP%#$MVTUFSPO,VCFSOFUFT NZTRMBHFOU NZTRM NZTRMBHFOU NZTRM NZTRMBHFOU NZTRM NZTRM4UBUFGVM4FU (SPVQ3FQMJDBUJPO .Z42-$MVTUFS $VTUPN3FTPVSDF .Z42-0QFSBUPS $VTUPN$POUSPMMFS NZTRMSPVUFS XFCBQQ NZTRMSPVUFS XFCBQQ 8BUDI $SFBUF XFCBQQ 4FSWJDF ΞϓϦέʔγϣϯTJEFDBSͷ.Z42-3PVUFSʹଓ (SPVQ3FQMJDBUJPOʹΑΔ ߴՄ༻ੑάϧʔϓ ࣗతͳϝϯόཧ োݕɾ෮چ͕ߦΘΕΔ 8SJUF 3FBE ΫϥελϝϯόΛ੍ޚ͢Δ.Z42-"HFOUͱ ҰॹʹσϓϩΠ͞ΕΔ
Slide 28
Slide 28 text
NZTRMPQFSBUPSͷΠϯετʔϧ # ωʔϜεϖʔεΛ࡞ $ kubectl create ns mysql-operator # mysql-operator ϦϙδτϦΛऔಘ (helm chart ؚ͕·ΕΔ) $ git clone https://github.com/oracle/mysql-operator.git $ cd mysql-operator # mysql-operator Λ helm ͰΠϯετʔϧ $ helm install --namespace mysql-operator \ --name mysql-operator \ mysql-operator $ kubectl get crd --selector=release=mysql-operator NAME AGE mysqlbackups.mysql.oracle.com 18d mysqlbackupschedules.mysql.oracle.com 18d mysqlclusters.mysql.oracle.com 18d mysqlrestores.mysql.oracle.com 18d $ kubectl get pods --selector=app=mysql-operator NAME READY STATUS RESTARTS AGE mysql-operator-65475db5-tdchf 1/1 Running 0 9d $3%ͱ$VTUPN$POUSPMMFS͕ Πϯετʔϧ͞Εɺ $VTUPN3FTPVSDF͕ར༻ ՄೳʹͳΔ
Slide 29
Slide 29 text
.Z42-Ϋϥελͷ࡞ $ kubectl get mysqlcluster,sts,pods NAME AGE cluster.mysql.oracle.com/mysql 4m NAME DESIRED CURRENT AGE statefulset.apps/mysql 3 3 4m NAME READY STATUS RESTARTS AGE pod/mysql-0 2/2 Running 0 4m pod/mysql-1 2/2 Running 0 3m pod/mysql-2 2/2 Running 0 2m apiVersion: mysql.oracle.com/v1alpha1 kind: Cluster metadata: name: mysql spec: members: 3 DMVTUFSZBNM $MVTUFS lNZTRMz 4UBUFGVM4FU lNZTRMz LVCFDUMBQQMZ .Z42- 0QFSBUPS
Slide 30
Slide 30 text
.Z42-Ϋϥελͷεέʔϧ $ kubectl get sts,pods NAME DESIRED CURRENT AGE statefulset.apps/mysql 5 5 8m NAME READY STATUS RESTARTS AGE pod/mysql-0 2/2 Running 0 8m pod/mysql-1 2/2 Running 0 8m pod/mysql-2 2/2 Running 0 7m pod/mysql-3 2/2 Running 0 1m pod/mysql-4 2/2 Running 0 50s apiVersion: mysql.oracle.com/v1alpha1 kind: Cluster metadata: name: mysql spec: members: 5ϝϯόΛมߋ ˠ DMVTUFSZBNM $MVTUFS lNZTRMz 4UBUFGVM4FU lNZTRMz LVCFDUMBQQMZ .Z42- 0QFSBUPS
Slide 31
Slide 31 text
όοΫΞοϓͱϦετΞ apiVersion: mysql.oracle.com/v1alpha1 kind: Backup metadata: name: mysql-cluster-backup spec: executor: mysqldump: databases: - name: employees storageProvider: s3: endpoint: s3.ap-northeast-1.amazonaws.com region: ap-northeast-1 bucket: mysql-operator-test forcePathStyle: true credentialsSecret: name: s3-credentials cluster: name: mysql CBDLVQZBNM #BDLVQϦιʔεఆٛ͠BQQMZ͢Δ ‣ 4ޓ"1*͕༻Մೳ "844 0$*0CKFDU4UPSBHF ($1($4 ‣ NZTRMEVNQΛαϙʔτ ‣ #BDLVQ4DIFEVMFϦιʔεͰఆظ࣮ߦՄೳ $ kubectl get mysqlbackup NAME AGE mysql-cluster-backup 13m
Slide 32
Slide 32 text
όοΫΞοϓͱϦετΞ 3FTUPSFϦιʔεఆٛ͠BQQMZ͢Δ ‣ ༻͢Δ#BDLVQͱ ϦετΞઌͷ$MVTUFSΛࢦఆ apiVersion: mysql.oracle.com/v1alpha1 kind: Restore metadata: name: mysql-cluster-restore spec: cluster: name: mysql-restore backup: name: mysql-cluster-backup SFTUPSFZBNM mysql> show databases; +-------------------------------+ | Database | +-------------------------------+ | information_schema | | mysql | | mysql_innodb_cluster_metadata | | performance_schema | | sys | +-------------------------------+ 5 rows in set (0.01 sec) mysql> show databases; +-------------------------------+ | Database | +-------------------------------+ | employees | | information_schema | | mysql | | mysql_innodb_cluster_metadata | | performance_schema | | sys | +-------------------------------+ 6 rows in set (0.00 sec) 3FTUPSFલ 3FTUPSFޙ
Slide 33
Slide 33 text
4JOHMF.BTUFSߏͰ1SJNBSZͷ1PE͕མͪͨ߹ .Z42-*OOP%#$MVTUFSͷಈ࡞ োൃੜ࣌Ͳ͏ͳΔʁ 4UBUFGVM4FU %FTJSFETUBUFSFQMJDBT $VSSFOUTUBUFSFQMJDBT NZTRM SPMFQSJNBSZ NZTRM SPMFTFDPOEBSZ NZTRM SPMFTFDPOEBSZ
Slide 34
Slide 34 text
4JOHMF.BTUFSߏͰ1SJNBSZͷ1PE͕མͪͨ߹ .Z42-*OOP%#$MVTUFSͷಈ࡞ োൃੜ࣌Ͳ͏ͳΔʁ 4UBUFGVM4FU %FTJSFETUBUFSFQMJDBT $VSSFOUTUBUFSFQMJDBT NZTRM SPMFTFDPOEBSZ NZTRM SPMFQSJNBSZ (SPVQ3FQMJDBUJPOͷϝϯό͔Β আ֎͞ΕΔ NZTRM SPMFTFDPOEBSZ
Slide 35
Slide 35 text
োൃੜ࣌Ͳ͏ͳΔʁ 4JOHMF.BTUFSߏͰ1SJNBSZͷ1PE͕མͪͨ߹ .Z42-*OOP%#$MVTUFSͷಈ࡞ 4UBUFGVM4FU %FTJSFETUBUFSFQMJDBT $VSSFOUTUBUFSFQMJDBT NZTRM SPMFTFDPOEBSZ QSJNBSZ NZTRM SPMFQSJNBSZ (SPVQ3FQMJDBUJPOͷϝϯό͔Β আ֎͞ΕΔ NZTRM SPMFTFDPOEBSZ 4FDPOEBSZ͕1SJNBSZʹঢ֨
Slide 36
Slide 36 text
4JOHMF.BTUFSߏͰ1SJNBSZͷ1PE͕མͪͨ߹ ͦͷޙʜ োൃੜ࣌Ͳ͏ͳΔʁ 4UBUFGVM4FU %FTJSFETUBUFSFQMJDBT $VSSFOUTUBUFSFQMJDBT NZTRM SPMFTFDPOEBSZ NZTRM ϦΧόϦॲཧ͕Γఀࢭதͷ σʔλͷࠩΛಉظ ,VCFSOFUFTʹΑΓ1PE͕ ্ཱͪ͛ΒΕΔ NZTRM SPMFQSJNBSZ Binary Log
Slide 37
Slide 37 text
4JOHMF.BTUFSߏͰ1SJNBSZͷ1PE͕མͪͨ߹ ͦͷޙʜ োൃੜ࣌Ͳ͏ͳΔʁ 4UBUFGVM4FU %FTJSFETUBUFSFQMJDBT $VSSFOUTUBUFSFQMJDBT NZTRM SPMFTFDPOEBSZ NZTRM SPMFTFDPOEBSZ 4FDPOEBSZͱͯ͠Ϋϥελʹ ࠶ࢀՃ NZTRM SPMFQSJNBSZ
Slide 38
Slide 38 text
োൃੜ࣌Ͳ͏ͳΔʁ LTOPEF͕མͪͨ߹1PEͷεςʔλε6OLOPXOʹͳΔ 4UBUFGVM4FUͷ1PEࣗಈͰ࠶εέδϡʔϦϯά͞Εͳ͍ ‣ ಛఆͷ໊લͷ1PE͕Ϋϥελʹ࠷େͰͭଘࡏ͢Δ͜ͱΛอূ͢Δ ‣ TQSJUCSBJOʹΑΔোΛ͙ͨΊ࠶࡞ߦΘΕͳ͍ % kubernetes get node k8s-node02 NAME STATUS ROLES AGE VERSION k8s-node02 NotReady 8d v1.12.7 % kubectl get pods -l v1alpha1.mysql.oracle.com/cluster=mysql -o wide NAME READY STATUS RESTARTS AGE NODE mysql-0 2/2 Running 0 3d k8s-node01 mysql-1 2/2 Unknown 0 3d k8s-node02 1PE4UBUVT͕6OLOPXOͷ߹ɺ ίϯςφࣗମ·ͩಈ͍͍ͯΔՄೳੑ͕͋Δ mysql> SELECT MEMBER_HOST, MEMBER_STATE, MEMBER_ROLE FROM performance_schema.replication_group_members ORDER BY MEMBER_HOST; +---------------+--------------+-------------+ | MEMBER_HOST | MEMBER_STATE | MEMBER_ROLE | +---------------+--------------+-------------+ | mysql-0.mysql | ONLINE | SECONDARY | | mysql-1.mysql | ONLINE | SECONDARY | | mysql-2.mysql | ONLINE | SECONDARY | (SPVQ3FQMJDBUJPOͷϝϯόҰཡʹ ରͷ1PE͕·ؚͩ·Ε͍ͯΔʂ
Slide 39
Slide 39 text
োൃੜ࣌Ͳ͏ͳΔʁ LTOPEF͕མͪͨ߹1PEͷεςʔλε6OLOPXOʹͳΔ ࠶εέδϡʔϦϯά͢Δʹ ‣ ݱঢ়ͩͱ1PEΛڧ੍আ͢Δ͔͠ͳͦ͞͏ʜʁ $ kubectl delete pod —force —grace-period=0 ঢ়ଶ֬ೝˠΓ͠ˠ෮چͷखॱ0QFSBUPSʹ͍ͤͨʜʂ ‣ ݱࡏ ࣮͞Ε͍ͯͳ͍ 1PEͷ࠶εέδϡʔϦϯά GPSDFEFMFUF (SPVQ3FQMJDBUJPO͔Β Γ͞ΕͯΔ͜ͱΛ֬ೝ 1PEͷεςʔλεΛ֬ೝ 4UBUFGVM4FU1PEXBTOFWFSFWJDUFEGSPNUIFGBJMVSFOPEF
Slide 40
Slide 40 text
ϞχλϦϯά .Z42-0QFSBUPSͷίϯϙʔωϯτ1SPNFUIFVTΤϯυϙΠϯτΛ͍࣋ͬͯΔ ‣ Ϋϥελͷߏมߋʹؔ͢ΔϝτϦΫε͕ऩूՄೳ *OOP%#$MVTUFS .Z42-0QFSBUPS $POUSPMMFS &YQPSUFS NZTRMBHFOU NZTRM .POJUPSJOH "HFOU
Slide 41
Slide 41 text
ίϯςφͰεςʔτϑϧͳΞϓϦΛಈ্͔͢ͰͷͭͷϙΠϯτ ΞϓϦέʔγϣϯݻ༗ͷ ӡ༻φϨοδ Ӭଓతͳσʔλͷѻ͍ ,VCFSOFUFT 0QFSBUPS 4UBUFGVM4FU ,VCFSOFUFTͷඪ४ػೳ ඪ४ػೳ͕αϙʔτ͠ͳ͍ྖҬ εςʔτϑϧͳϫʔΫϩʔυ,VCFSOFUFTͷίϯηϓτΛར༻ͯ͠ ࣗಈ࡞ͤ͞Δ͜ͱ͕ՄೳʹͳΔ
Slide 42
Slide 42 text
5PEBZ`T"HFOEB ίϯςφͰεςʔτϑϧͳΞϓϦέʔγϣϯΛಈ͔͢ ,VCFSOFUFT0QFSBUPSͱ ࣮ྫ.Z42-0QFSBUPSΛಈ͔ͯ͠ΈΑ͏ ,VCFSOFUFT0QFSBUPSͷ͜Ε͔Β ߟྀ͖͢ϙΠϯτͱ,VCFSOFUFT্Ͱͷղܾํ๏ʹ͍ͭͯΔ $VTUPN3FTPVSDFΛ׆༻ͨ͠ӡ༻ࣗಈԽͷύλʔϯʹ͍ͭͯΔ 0QFSBUPSͷ༻ײʁ࣮ࡍʹLT্Ͱ.Z42-Λಈ͔ͯ͠ΈΔ ؔ࿈ϓϩδΣΫτͷհͱ0QFSBUPSͷࠓޙʹ͍ͭͯ
Slide 43
Slide 43 text
%#PO,VCFSOFUFTؔ࿈ϓϩδΣΫτ IUUQTHJUIVCDPNQSFTTMBCTNZTRMPQFSBUPS QSFTTMBCTNZTRMPQFSBUPS ‣ .BTUFS4MBWFߏͷ.Z42-Λαϙʔτ ‣ োݕͱϑΣΠϧΦʔόʔ PSDIFTUSBUPSΛ༻ IUUQTWJUFTTJP 7JUFTT ‣ େنͳ.Z42-ΫϥελΛσϓϩΠ͠ ཧ͢ΔͨΊͷιϦϡʔγϣϯ ‣ γϟʔσΟϯάػߏΛଂ ‣ ϑΣΠϧΦʔόʔόοΫΞοϓͷࣗಈԽ .Z42-ʹؔ࿈ͨ͠ϓϩδΣΫτ 0QFSBUPS͕ଘࡏ͢Δσʔλϕʔε "FSPTQJLF $BTTBOESB $PVDICBTF &MBTUJDTFBSDI FUDE *OqVY%# .FNDBDIFE .POHP%# 1PTUHSF42- 3FEJT 5J%# ʜͳͲ
Slide 44
Slide 44 text
,VCFSOFUFT0QFSBUPSͷ͜Ε͔Β %#Ҏ֎ؚΊɺ༷ʑͳ0QFSBUPS͕ެ։͞Ε͍ͯΔ PQFSBUPSGSBNFXPSLBXFTPNFPQFSBUPST ‣ ެ։͞Ε͍ͯΔ0QFSBUPSΛΞϓϦ͝ͱʹ ·ͱΊͨϦετ 0QFSBUPS)VCJP ‣ 0QFSBUPSͷҰཡΛఏڙ͢ΔϙʔλϧαΠτ ‣ "84 (PPHMF$MPVE .JDSPTPGU"[VSFͱڞಉͰ 3FE)BUʹΑΓެ։ ӡ༻λεΫΛ0QFSBUPSͱͯ͠ύοέʔδԽ͠ ϢʔβؒͰڞ༗͢Δ͜ͱ͕Ͱ͖Δ
Slide 45
Slide 45 text
,VCFSOFUFT0QFSBUPSͰ/P0QTΛ࣮ݱʁ /P0QT/P6ODPNGPSUBCMF0QT ‣ γεςϜӡ༻อकʹؔ͢Δʮخ͘͠ͳ͍ͷʯΛऔΓআ͘׆ಈ ‣ औΓΈͷͭγεςϜʹࣗӡ༻ೳྗΛ࣋ͨͤਓؒʹΑΔӡ༻Λ࠷খԽ͢Δ ࣗӡ༻ʹඞཁͳlճ෮ྗ 4FMG)FBMJOH োൃੜ࣌ͷʮαʔϏεແӨڹࣗݾम෮ʯ *OqJHIUSFOFXJOH มߋɾߋ৽ʹର͢Δʮແఀࢭϝϯςφϯεʯ "EBQUJWF4DBMF ෛՙมಈʹྗతʹదԠ͢ΔʮࣗతϦιʔεௐʯ IUUQTHJUIVCDPNOPPQTKBQBODPNNVOJUZCMPCNBTUFS%&'*/*5*0/NE 4FMG)FBMJOH 㾎 %FDMBSBUJWF$POpHVSBUJPO 㾎 -JWFOFTT3FBEJOFTT1SPCF *OqJHIUSFOFXJOH 㾎 3PMMJOH6QEBUF "EBQUJWF4DBMF 㾎 )PSJ[POUBM1PE"VUPTDBMFS 㾎 $MVTUFS"VUPTDBMFS ,VCFSOFUFTͷ࣋ͭճ෮ྗ /P0QT%FpOJUJPOW
Slide 46
Slide 46 text
,VCFSOFUFT0QFSBUPSͰ/P0QTΛ࣮ݱʁ 1MBUGPSN "QQMJDBUJPO ,VCFSOFUFT0QFSBUPS ,VCFSOFUFTͷίϯηϓτͱ֦ுੑΛ׆༻͠ γεςϜશମͷճ෮ྗΛߋʹߴ͍ͷʹͰ͖Δ 8FC4FSWFS %BUBCBTF .FTTBHF2VFVF $BDIF ΞϓϦΛؚΊͨγεςϜશମͰճ෮ྗΛ࣋ͭ͜ͱ͕ॏཁ ‣ ো͔Βͷ෮چ͕͍࣌ؒ ‣ ෮چͷͨΊͷखॱ͕ෳࡶ ճ෮ྗͷԼʹ ͭͳ͕ͬͯ͠·͏
Slide 47
Slide 47 text
͜Ε͔Βͷσʔλϕʔεߏஙɾӡ༻͜͏ͳΔͣʜ 130#-&. EBUBCBTF%08/ ࠓϦϦʔεͨ͠ࢪࡦͰ ϦΫΤετ૿͑ΔΒ͍͠ʜ %#૿͞ͳ͍ͱʜʂ ։ൃڥʹσʔλϕʔε ͙͢ʹ༻ҙͯ͠΄͍͠ͳ
Slide 48
Slide 48 text
͜Ε͔Βͷσʔλϕʔεߏஙɾӡ༻͜͏ͳΔͣʜ ಥൃతͳ࡞ۀͷෛՙ͕Լ͕Δ ਓखʹΑΔΦϖϛεݮΔ 130#-&. EBUBCBTF%08/ ࠓϦϦʔεͨ͠ࢪࡦͰ ϦΫΤετ૿͑ΔΒ͍͠ʜ %#૿͞ͳ͍ͱʜʂ ։ൃڥʹσʔλϕʔε ͙͢ʹ༻ҙͯ͠΄͍͠ͳ LVCFDUMBQQMZGDMVTUFSZBNM
Slide 49
Slide 49 text
͜Ε͔Βͷσʔλϕʔεߏஙɾӡ༻͜͏ͳΔͣʜ ಥൃతͳ࡞ۀͷෛՙ͕Լ͕Δ ਓखʹΑΔΦϖϛεݮΔ Ϗδωεͷεϐʔυ͕Ճ͢Δ ਫ਼ਆతෛ୲͕Լ͕Δ 130#-&. EBUBCBTF%08/ ࠓϦϦʔεͨ͠ࢪࡦͰ ϦΫΤετ૿͑ΔΒ͍͠ʜ %#૿͞ͳ͍ͱʜʂ LVCFDUMBQQMZGDMVTUFSZBNM ։ൃڥʹσʔλϕʔε ͙͢ʹ༻ҙͯ͠΄͍͠ͳ LVCFDUMBQQMZGDMVTUFSZBNM
Slide 50
Slide 50 text
͜Ε͔Βͷσʔλϕʔεߏஙɾӡ༻͜͏ͳΔͣʜ ෮چͷख͕ؒ࠷খԽ͞ΕΔ ۓٸରԠݮΔ ಥൃతͳ࡞ۀͷෛՙ͕Լ͕Δ ਓखʹΑΔΦϖϛεݮΔ Ϗδωεͷεϐʔυ͕Ճ͢Δ ਫ਼ਆతෛ୲͕Լ͕Δ 130#-&. EBUBCBTF%08/ 㵺Т㵺 ţźōʜ ࠓϦϦʔεͨ͠ࢪࡦͰ ϦΫΤετ૿͑ΔΒ͍͠ʜ %#૿͞ͳ͍ͱʜʂ LVCFDUMBQQMZGDMVTUFSZBNM ։ൃڥʹσʔλϕʔε ͙͢ʹ༻ҙͯ͠΄͍͠ͳ LVCFDUMBQQMZGDMVTUFSZBNM
Slide 51
Slide 51 text
͜Ε͔Βͷσʔλϕʔεߏஙɾӡ༻͜͏ͳΔͣʜ ͨͩ͠ɺҙ͠ͳ͚ΕͳΒͳ͍͜ͱ ‣ γεςϜઃܭνϡʔχϯά·Ͱ͕ࣗಈԽ ͞ΕΔΘ͚Ͱͳ͍ ‣ ࣗಈԽ͞ΕͨγεςϜϒϥοΫϘοΫεʹ ͳΓ͕ͪ ਓؒͷӡ༻ऀ͕θϩʹͳΔΘ͚Ͱͳ͍ʂ ‣ ൃݟղܾͷख͕͔ΓΛ͓ͯ͜͠͏ ‣ ϞχλϦϯάɾϩΪϯάͷΈ͕ඞਢ ‣ ࣗಈԽ͕ࣦഊͨ͠߹ͷखஈΛ༻ҙ͓ͯ͘͠ ‣ ࠷ޙͷखஈʜਓख োൃੜ࣌ͷඋ͑ඞ͓ͣͯ͘͠ʂ
Slide 52
Slide 52 text
͜Ε͔Βͷσʔλϕʔεߏஙɾӡ༻͜͏ͳΔͣʜ "ϚωʔδυαʔϏεΛ͍·͠ΐ͏ʂ ͍͍ͨ%#ͷϚωʔδυαʔϏε͕ఏڙ͞Ε͍ͯΔ͚ΕͲɺ ,VCFSOFUFT0QFSBUPSΛͬͯࣗͰӡ༻ͨ͠΄͏͕ྑ͔ͬͨΓ͢Δʁ ‣ ಈ࡞ͤ͞ΔΞϓϦέʔγϣϯʹ͍ͭͯͷ ઐࣝඞཁ ‣ ,VCFSOFUFTࣗମͷӡ༻͍͠ εςʔτϑϧͳϫʔΫϩʔυΛಈ͔͢Έ ͖͍ͬͯͯΔ͕ʜ ‣ 1BB44FSWFSMFTTͷબݕ౼͠Α͏ ‣ ϓϥοτϑΥʔϜͱͯ͠ճ෮ੑ͕୲อ ͞Ε͍ͯΔ ແཧʹ,VCFSOFUFTͰಈ͔ͦ͏ͱ͠ͳ͍ LTΫϥελ্ͷσʔλϕʔεͰͳ͘ɺΫϥυ্ͷϚωʔδυαʔϏεΛ ૢ࡞͢Δ0QFSBUPS͋Γ·͢ "844FSWJDF0QFSBUPSͳͲ ɻ ผ్*B$πʔϧͳͲͰߦ͍ͬͯͨΠϯϑϥڥͷߏஙΛ0QFSBUPSʹͤ ΞϓϦͱҰॹʹ3FTPVSDFఆٛΛHJUཧࣗӡ༻ɺͱ͍͏͜ͱͰ͖ͦ͏Ͱ͢ɻ ิ
Slide 53
Slide 53 text
·ͱΊ ,VCFSOFUFT0QFSBUPS ‣ ,VCFSOFUFTͷΈΛԠ༻ͨ͠ӡ༻ࣗಈԽͷύλʔϯ ‣ $VTUPN3FTPVSDF$VTUPN$POUSPMMFS ‣ ΞϓϦέʔγϣϯݻ༗ͷӡ༻࡞ۀΛਓʹΘͬͯࣗಈԽ .Z42-0QFSBUPS ‣ ,VCFSOFUFT্ʹ.Z42-*OOP%#$MVTUFSΛߏங ‣ એݴతͳઃఆʹج͖֤ͮछӡ༻࡞ۀΛࣗಈԽ ‣ Ϋϥελߏங εέʔϧ όοΫΞοϓϦετΞ োݕͱϑΣΠϧΦʔόʔ
Slide 54
Slide 54 text
0QFSBUPSͰεςʔτϑϧͳϫʔΫϩʔυ,VCFSOFUFTͷࢥͰࣗಈ࡞͕Մೳ ‣ γεςϜશମͷճ෮ྗΛΑΓߴΊΔ ‣ σʔλʔϕʔεӡ༻ͷ࠷খԽΛਤΔ͜ͱ͕Ͱ͖ͦ͏ʂ ·ͱΊ "QQ "QQ "NFCBϓϩϑΟʔϧγεςϜͰͷ ಋೖ͕Մೳ͔ݕূ༧ఆ ‣ Δ՝CJOMPHϩετ࣌ͷ෮چํ๏ ,VCFSOFUFT0QFSBUPSͷڥԼͰͷ ෮چखॱΛͲͷΑ͏ʹ͢Δ͔ ݟ͕ͨ·ͬͨΒ ·ͨผͷػձͰڞ༗͠·͢ωʂ .Z42-0QFSBUPS