Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
CockroachDBって何 / What is CockroachDB
Search
linyows
March 02, 2020
Programming
1
480
CockroachDBって何 / What is CockroachDB
Mar 2, 2020 Fukuoka.go#15 でお話しした資料です。
linyows
March 02, 2020
Tweet
Share
More Decks by linyows
See All by linyows
研究の再現性を高める 仕組みをGoでつくる / Creating a system to improve the reproducibility of research using go
linyows
1
110
奥が深いメールのシステム / The depth of Email system
linyows
3
410
IaCにおけるテスト考察 / Tests in IaC
linyows
2
420
リバースエンジニアリングとGoでSlackの認知負荷を下げる / Reducing cognitive load in Slack with Reverse-engineering and Go
linyows
2
270
透過型SMTPプロキシによる送信メールの可観測性向上 / Improved observability of outgoing emails with transparent smtp proxy
linyows
2
940
プロダクションで使うGo Pluginの利便性とパフォーマンス性 / Simplicity and Performance of Go plugin for Production
linyows
0
500
求められるソフトウェアエンジニア像とキャリア戦略 / Engineers and Career Strategies Required Now
linyows
2
470
CloudflareのCAPTCHAを使って ユーザ体験を下げず不正利用を排除する / Cloudflare's captcha case study that does not degrade ux
linyows
0
350
なぜNotionを使うのか2022 / Why use notion as our workspace in 2022
linyows
3
6k
Other Decks in Programming
See All in Programming
役立つログに取り組もう
irof
26
8.6k
Progressive Web Apps für Desktop und Mobile mit Angular (Hands-on)
christianliebel
PRO
0
110
色々なIaCツールを実際に触って比較してみる
iriikeita
0
260
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.1k
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
420
Vue.js学習の振り返り
hiro_xre
2
130
Kubernetes for Data Engineers: Building Scalable, Reliable Data Pipelines
sucitw
1
190
レガシーな Android アプリのリアーキテクチャ戦略
oidy
1
170
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
210
gopls を改造したら開発生産性が高まった
satorunooshie
8
240
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
530
Kaigi on Rails 2024 - Rails APIモードのためのシンプルで効果的なCSRF対策 / kaigionrails-2024-csrf
corocn
5
3.3k
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
7
150
RailsConf 2023
tenderlove
29
880
Measuring & Analyzing Core Web Vitals
bluesmoon
1
39
Side Projects
sachag
452
42k
GraphQLの誤解/rethinking-graphql
sonatard
66
9.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Faster Mobile Websites
deanohume
304
30k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
9
680
A better future with KSS
kneath
238
17k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
Adopting Sorbet at Scale
ufuk
73
9k
Transcript
Fukuoka.go#15 with Kagoshima Gophers Tomohisa Oda / Mar 2, 2020
What isCockroachDB
Fukuoka.go#15 with Kagoshima Gophers @linyows blog: tomohisaoda.com affiliation: GMO pepabo,
inc.
Fukuoka.go#15 with Kagoshima Gophers Private Projects ΞϓϦέʔγϣϯ͕ࣗϦϙδτϦ͔Β࠷৽ͷίʔυΛݕ ͯࣗ͠ಈͰσϓϩΠͱσϦόϦʔΛߦ͏πʔϧ MJOVYͷVTFS໊લղܾΛ(JU)VCͷ5FBNϝϯόʔϦϙδτ ϦͷΞΫηεݖݶऀ͔Βߦ͏πʔϧ
Fukuoka.go#15 with Kagoshima Gophers ͓ͼ"CockroachDBίʔυϦʔσΟϯά" "CockroachDBͬͯԿ" ʹͳΓ·ͨ͠ɻ
Fukuoka.go#15 with Kagoshima Gophers CockroachDBͱ
Fukuoka.go#15 with Kagoshima Gophers ๏ ཧతࢄ42-σʔλϕʔε ๏ 3%#ͱ/P42-ͷਐԽܥͰ͋Δ/FX42- ๏ ࣗಈ'BJMPWFSͱࣗಈ3FQBJS
๏ .VMUJ"DUJWFͳՄ༻ੑ ๏ 1PTUHSF42-ޓͰطଘͷυϥΠό͕༻Ͱ͖Δ CockroachDB
Fukuoka.go#15 with Kagoshima Gophers
Fukuoka.go#15 with Kagoshima Gophers Design ਫฏͷεέʔϥϏϦςΟ ๏ ཧతʹແݶʹ૿ͤΔ ๏ ΫΤϦࢄͰ୯ҰΫΤϦΛશମత
εϧʔϓοτ্ ߴ͍ੜଘੑ ๏ ϚγϯࢄɺϥοΫࢄɺཧత ࢄ ๏ ࣗݾम෮ɺࣗݾෛՙόϥϯγϯά ڧ͍Ұ؏ੑ ๏ ߹ҙϕʔεͷϨϓϦέʔγϣϯ ๏ "$*%ηϚϯςΟΫεΛຬͨ͢ ࢄτϥϯβΫγϣϯ
Fukuoka.go#15 with Kagoshima Gophers ๏ 42-*OUFSGBDF͕ͩதࢄ,74UPSF -FWFM%#ͷϑΥʔΫ3PDLT%# ๏ ςʔϒϧΛ3BOHFͱ͍͏.#ҎͷαΠζʹͨ͠୯ҐͰׂ
๏ 3BOHF͕ϨϓϦέʔγϣϯͷ୯ҐͰ/PEFؒͰ4IBSEJOH͢Δ ๏ ϨϓϦέʔγϣϯ3BGUΞϧΰϦζϜͰߦ͍ɺ5SJQMJDBUFEʢ̏ॏʣߦ͑Δ ๏ ϨϓϦΧͷ૯/' ͱ͢Δͱ࠷େ'ݸͷোʹ͑Δ Architecture
Fukuoka.go#15 with Kagoshima Gophers SQL Transactional Distribution Replication Storage Client
Foo : ID = [1, 51] Foo : ID = [51, 103] … Table Foo Index FooIdx Table Bar … Node1 Node2 Node3 Node4 64M Ranges Range Index 64M
Fukuoka.go#15 with Kagoshima Gophers CockroachDB͕ͬͯ͘ΕΔ͜ͱ
Fukuoka.go#15 with Kagoshima Gophers ReplicasͷϦόϥϯγϯάۉҰԽ $MVTUFSʹ/PEFΛ৽͘͠Ճ͢Δ $PDLSPBDI%#3BOHFΛஔ͢Δ $PDLSPBDI%#$MVTUFSΛۉʹ͢Δ
Fukuoka.go#15 with Kagoshima Gophers ReplicasͷϦόϥϯγϯάम෮ ো͕ൃੜ͠/PEFΛফࣦ͢Δ $PDLSPBDI%#3FQMJDBͷܽམΛೝࣝͯ͠ "DUJWF/PEF্ʹϨϓϦΧΛஔ͖͑Δ ো͕Ұ࣌తͰ/PEF͕෮ؼͨ͠Β -FBTIPMEFSͱݺΕΔ3BGU-FBEFS͕
ϨϓϦΧΛΩϟονΞοϓ͢Δ
Fukuoka.go#15 with Kagoshima Gophers ๏ 51$$ϕϯνϚʔΫʹ͓͍ͯ"NB[PO"VSPSB ͱൺֱ͢Δͱഒͷεϧʔϓοτ͕͋Δ ๏ ͜ͷεϧʔϓοτ51$$ϥϯΩϯάͰ൪ ʹେ͖͍
๏ ,7 SFBE XSJUF Ͱ/PEFͷ૿Ճʹ ΑͬͯτϥϯβΫγϣϯͷॲཧೳྗ͕ઢܗʹ ্͍ͯ͘͜͠ͱ͕Θ͔͍ͬͯΔ ๏ $PDLSPBDI%#ʹཧ্ͷεέʔϦϯά੍ ݶͳ͍ͱͷ͜ͱ Performance
Fukuoka.go#15 with Kagoshima Gophers CockroachDBͷ࣮
Fukuoka.go#15 with Kagoshima Gophers ๏ (P Ҏ্ඇਪ ๏
$ DPNQJMFS͕ඞཁ 3PDLT%#$SZQUP ɺ,FSCFSPTɺ4OBQQZͳͲʹґଘ ๏ (Pͷσ ΟϨΫτϦߏࢸͬͯී௨QLHʹ࣮͕͋Δ ๏ ֎෦QLHఔͳͷͰنతʹґଘ͕গͳ͍Α͏ʹݟ͑Δ https://github.com/cockroachdb/cockroach ࣮ʹ͍ͭͯ $ tree pkg | grep .go | grep -v test.go | wc -l 2405 // ͜ͷϑΝΠϧͰίʔυϦʔσΟϯά͢Δؾ͕ͳ͘ͳͬͨ $ grep 'name =' Gopkg.toml | grep -v golang | grep -v cockroach | wc -l 20
Fukuoka.go#15 with Kagoshima Gophers CockroachDBΛ͞ΘͬͯΈΔ
Fukuoka.go#15 with Kagoshima Gophers ๏ IFMNͰ$PDLSPBDI%#ΫϥελΛ࡞ 4UBUFGVM4FUͷͭͷ1PE͕ىಈ helm install
my-release --values my-values.yaml stable/cockroachdb kubectl get csr ๏ $PDLSPBDI%#ϊʔυͷূ໌ॻʹॺ໊͢ΔͨΊͷ$43Λঝೝ kubectl certificate approve default.node.my-release-cockroachdb-0 kubectl certificate approve default.client.root kubectl get pv ๏ #VJMUJO$MJFOUͷ४උ kubectl create -f client-secure.yaml kubectl exec -it cockroachdb-client-secure -- ./cockroach sql --certs-dir=/cockroach-certs —host=my-release-cockroachdb-public https://www.cockroachlabs.com/docs/stable/orchestrate-a-local-cluster-with-kubernetes.html KubernetesΛͬͯDemo: ४උ
Fukuoka.go#15 with Kagoshima Gophers ๏ 42-ͷ࣮ߦ CREATE DATABASE bank; CREATE
TABLE bank.accounts (id INT PRIMARY KEY, balance DECIMAL); INSERT INTO bank.accounts VALUES (1, 1000.50); SELECT * FROM bank.accounts; CREATE USER roach WITH PASSWORD 'Q7gc8rEdS'; INSERT INTO system.role_members (role, member, "isAdmin") VALUES ('admin', 'roach', true); ๏ ίϯιʔϧϩάΠϯ kubectl port-forward my-release-cockroachdb-0 8080 ๏ /PEF'BJMPWFSɺ/PEFͷՃɺআ kubectl delete pod my-release-cockroachdb-2 helm upgrade my-release stable/cockroachdb --set statefulset.replicas=4 —reuse-values kubectl certificate approve default.node.my-release-cockroachdb-3 kubectl exec -it cockroachdb-client-secure -- ./cockroach node status --certs-dir=/cockroach-certs —host=my-release-cockroachdb-public kubectl exec -it cockroachdb-client-secure -- ./cockroach node decommission 2 --certs-dir=/cockroach-certs —host=my-release-cockroachdb-public helm upgrade my-release stable/cockroachdb --set statefulset.replicas=3 --reuse-values https://www.cockroachlabs.com/docs/stable/orchestrate-a-local-cluster-with-kubernetes.html KubernetesΛͬͯDemo: ૢ࡞
Fukuoka.go#15 with Kagoshima Gophers add node to cluster delete a
pod
Fukuoka.go#15 with Kagoshima Gophers ๏ IUUQTHJUIVCDPNDPDLSPBDIECDPDLSPBDICMPCNBTUFSEPDTEFTJHONE ๏ IUUQTXXXDPDLSPBDIMBCTDPNEPDTTUBCMFBSDIJUFDUVSFPWFSWJFXIUNM ๏ IUUQTXXXDPDLSPBDIMBCTDPNEPDTTUBCMFDPDLSPBDIECJODPNQBSJTPOIUNM
๏ IUUQTXXXDPDLSPBDIMBCTDPNEPDTTUBCMFNVMUJBDUJWFBWBJMBCJMJUZIUNM ๏ IUUQTXXXDPDLSPBDIMBCTDPNCMPHMJNJUTPGUIFDBQUIFPSFN ๏ IUUQTXXXJOGPRDPNQSFTFOUBUJPOTDPDLSPBDIECEJTUSJCVUFETRM ๏ IUUQTXXXDPDLSPBDIMBCTDPNCMPHUQDDL ๏ IUUQTXXXDPDLSPBDIMBCTDPNEPDTTUBCMFPSDIFTUSBUFBMPDBMDMVTUFSXJUILVCFSOFUFTIUNM References
Fukuoka.go#15 with Kagoshima Gophers Thank youaʕ⊙౪⚆ʔ