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
500
CockroachDBって何 / What is CockroachDB
Mar 2, 2020 Fukuoka.go#15 でお話しした資料です。
linyows
March 02, 2020
Tweet
Share
More Decks by linyows
See All by linyows
研究を支える拡張性の高い ワークフローツールの提案 / Proposal of highly expandable workflow tools to support research
linyows
0
240
非コンテナ環境において宣言的Deploymentを手軽に実現する / Declarative deployment in non-container environments
linyows
0
38
メール送信サーバの集約における透過型SMTP プロキシの定量評価 / Quantitative Evaluation of Transparent SMTP Proxy in Email Sending Server Aggregation
linyows
0
530
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
280
研究の再現性を高める 仕組みをGoでつくる / Creating a system to improve the reproducibility of research using go
linyows
1
150
奥が深いメールのシステム / The depth of Email system
linyows
4
460
IaCにおけるテスト考察 / Tests in IaC
linyows
2
510
リバースエンジニアリングとGoでSlackの認知負荷を下げる / Reducing cognitive load in Slack with Reverse-engineering and Go
linyows
2
320
透過型SMTPプロキシによる送信メールの可観測性向上 / Improved observability of outgoing emails with transparent smtp proxy
linyows
2
1k
Other Decks in Programming
See All in Programming
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
130
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
500
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
140
MCP with Cloudflare Workers
yusukebe
2
270
良いユニットテストを書こう
mototakatsu
11
3.5k
快速入門可觀測性
blueswen
0
480
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
230
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
200
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
820
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
720
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
270
Flatt Security XSS Challenge 解答・解説
flatt_security
0
590
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
850
How to Ace a Technical Interview
jacobian
276
23k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
RailsConf 2023
tenderlove
29
960
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
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ʕ⊙౪⚆ʔ