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
210
非コンテナ環境において宣言的Deploymentを手軽に実現する / Declarative deployment in non-container environments
linyows
0
30
メール送信サーバの集約における透過型SMTP プロキシの定量評価 / Quantitative Evaluation of Transparent SMTP Proxy in Email Sending Server Aggregation
linyows
0
490
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
270
研究の再現性を高める 仕組みをGoでつくる / Creating a system to improve the reproducibility of research using go
linyows
1
140
奥が深いメールのシステム / The depth of Email system
linyows
4
460
IaCにおけるテスト考察 / Tests in IaC
linyows
2
490
リバースエンジニアリングとGoでSlackの認知負荷を下げる / Reducing cognitive load in Slack with Reverse-engineering and Go
linyows
2
310
透過型SMTPプロキシによる送信メールの可観測性向上 / Improved observability of outgoing emails with transparent smtp proxy
linyows
2
1k
Other Decks in Programming
See All in Programming
fs2-io を試してたらバグを見つけて直した話
chencmd
0
260
Jaspr Dart Web Framework 박제창 @Devfest 2024
itsmedreamwalker
0
120
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
190
バグを見つけた?それAppleに直してもらおう!
uetyo
0
190
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
240
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
760
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
160
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
1.1k
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
7
1.6k
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.8k
php-conference-japan-2024
tasuku43
0
380
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
260
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
5
180
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Language of Interfaces
destraynor
155
24k
Being A Developer After 40
akosma
89
590k
Optimising Largest Contentful Paint
csswizardry
33
3k
Speed Design
sergeychernyshev
25
690
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
50k
4 Signs Your Business is Dying
shpigford
182
21k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.2k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
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ʕ⊙౪⚆ʔ