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
MySQL Shellを使ってみよう!
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
mikoma
January 17, 2020
Technology
0
1.9k
MySQL Shellを使ってみよう!
mikoma
January 17, 2020
Tweet
Share
More Decks by mikoma
See All by mikoma
MySQL最新動向 ー OSSとしてのMySQLはどう進化している?
ikomachi226
0
24
MySQLのJSON機能の活用術
ikomachi226
0
160
MySQL AIとMySQL Studioを使ってみよう
ikomachi226
0
290
MySQL最新情報 MySQL9.5
ikomachi226
0
58
MySQL 最新情報 MySQL9.4
ikomachi226
0
92
アプリ開発者のためのMySQLお役立ち機能マップ
ikomachi226
0
95
MySQL最新情報 MySQL9.2
ikomachi226
0
560
MySQL最新情報といま知っておきたいバージョンアップの基礎知識
ikomachi226
0
4.2k
MySQLのリリースモデルの変更点と最新アップデート
ikomachi226
0
480
Other Decks in Technology
See All in Technology
ビズリーチにおける検索・推薦の取り組み / DEIM2026
visional_engineering_and_design
1
100
プロジェクトマネジメントをチームに宿す -ゼロからはじめるチームプロジェクトマネジメントは活動1年未満のチームの教科書です- / 20260304 Shigeki Morizane
shift_evolve
PRO
1
110
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
44k
ソフトウェアアーキテクトのための意思決定術: Create Decision Readiness—The Real Skill Behind Architectural Decision
snoozer05
PRO
29
9k
Security Diaries of an Open Source IAM
ahus1
0
200
バクラクのSREにおけるAgentic AIへの挑戦/Our Journey with Agentic AI
taddy_919
2
1k
開発組織の課題解決を加速するための権限委譲 -する側、される側としての向き合い方-
daitasu
4
240
Lookerの最新バージョンv26.2がやばい話
waiwai2111
1
150
Ultra Ethernet (UEC) v1.0 仕様概説
markunet
3
200
「データとの対話」の現在地と未来
kobakou
0
1.3k
OpenClawで回す組織運営
jacopen
2
290
OSSで構築するIT基盤管理実践事例: NetBox・Snipe-IT・FreeRADIUS+PrivacyIDEA / Practical Case Studies of IT Infrastructure Management Using OSS
nttcom
0
200
Featured
See All Featured
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
260
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
380
Writing Fast Ruby
sferik
630
63k
A better future with KSS
kneath
240
18k
A Soul's Torment
seathinner
5
2.4k
エンジニアに許された特別な時間の終わり
watany
106
240k
The Spectacular Lies of Maps
axbom
PRO
1
580
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Six Lessons from altMBA
skipperchong
29
4.2k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
220
Done Done
chrislema
186
16k
How to make the Groovebox
asonas
2
2k
Transcript
MySQL GBU January 17, 2020 生駒 眞知子/Machiko Ikoma MySQL Technology
Café #7 MySQL Shell を使ってみよう!
2 Copyright © 2020 Oracle and/or its a!liates. Safe harbor
statement ⟃♴ך✲갪כծ䒦爡ך♧菙涸ז醡ㅷך倯ぢ䚍חꟼׅ嚊銲铡僇ׅךדׅկתծ䞔㜠䲿⣘㈓ ♧ך湡涸הׅךד֮ծְַז㤍秈ח穈鴥ֿהכדֹתׇկ⟃♴ך✲갪כծوذٔ، ٕװ؝٦سծ堣腉䲿⣘ֿׅה؝ىحزًٝز然秈ׅךדכזְծ飑顠寸㹀遤ֲ ꥷךⴻ倖勞俱חזׁזְד♴ְׁկ ؙٕؔٓ醡ㅷחꟼ׃ג鎸鯹ׁגְ堣腉ך涪ծٔٔ٦أֶ״ן儗劍חאְגכծ䒦爡ך鄩ꆀח״ 寸㹀ׁתׅկ 0SBDMFה+BWBכծ0SBDMF$PSQPSBUJPO⿹ןך㶨⠓爡ծꟼ鸬⠓爡ך碛㕂⿹ןך➭ך㕂חֶֽ涫 ꐮ㉀垥דׅկ 俑⚥ך爡せծ㉀ㅷせ瘝כぐ爡ך㉀垥תכ涫ꐮ㉀垥ד֮㜥さָ֮תׅկ
3 Copyright © 2020 Oracle and/or its a!liates. Innovation Dayご参加ありがとうございました!
4 Copyright © 2020 Oracle and/or its a!liates. أؾ٦ؕ٦傈劤弫㋪׃ת׃˘
5 Copyright © 2020 Oracle and/or its a!liates. Innovation Dayアンケートより
• .Z42-4IFMMך堣腉濼ֿהָדֹծהג葺ַ • .Z42-4IFMMכ莆帾ְ • .Z42-4IFMMכ״ַֻגְתׇד׃ָծׁג⢪ ִ״ֲחׅץֹה䙼ְתׅ • .Z42-湊鋔ׅךח.Z42-4IFMM⢪ְְה嗚鎢׃גְ ךד鑫׃ְ铡僇הرָٌ鋅ג״ַ • .Z42-4IFMMךفؚٓ؎ٝזו濼זַֿהָ㢳ֻהג חזת׃ ˘זוזו .Z42-4IFMMפך갟ְֹֻׁת׃
6 Copyright © 2020 Oracle and/or its a!liates. 本日のテーマは MySQL
Shellです
7 Copyright © 2020 Oracle and/or its a!liates. MySQL 8.0.19、MySQL
Cluster8.0.19リリース!
8 Copyright © 2020 Oracle and/or its a!liates. 本日のお品書き 18:30
-18:35 オープニング 18:35 -19:00 MySQL Shellの機能(Innovation Dayおさらい) 19:00 -19:15 休憩 19:15 -20:30 デモ&もくもく&シェア 20:30 -21:30 ネットワーキング 21:30 撤収
9 Copyright © 2020 Oracle and/or its a!liates. 本日使うもの •
.Z42-4FSWFS • .Z42-4IFMM • .Z42-3PVUFS • (JU)VCHJU • 1ZUIPO
ざっくり解説 MySQL Shell –Innovation Dayのおさらい
11 Copyright © 2020 Oracle and/or its a!liates. MySQL Shell
涪٥盖椚ךך؎ٝةؿؑ٦أ 㢳鎉铂؟ه٦ز ٥+BWB4DSJQU ٥1ZUIPO ٥42- Ύ 㹋遤䕎䒭鼅䫛〳腉 ٥غحث ٥؎ٝةؙٓذ؍ـ Ώ .Z42-ِ٦ذ؍ٔذ؍ ٥،حفؚٖ٦سثؑحؕ٦ ٥+40/؎ٝه٦ز ٥넝鸞ر٦ةٗ٦س ΐ 窟さׁ"1* ٥سًُؗٝزأز،乼⡲ ٥*OOP%#ؙٓأة盖椚
12 Copyright © 2020 Oracle and/or its a!liates. 㔳חׅה˘
13 Copyright © 2020 Oracle and/or its a!liates. 実は前から存在していた 5.7.12
2015/4/8 5.7GA (5.7.9) 2016/4/11 2017/4/11 5.7.18 2017/4/12 1.0.9 MySQL Server MySQL Shell 1.0.3 初版 2016/4/11 2019/10/14 8.0.18 2017/4/18 8.0GA (8.0.11) 2019/10/14 8.0.18 2017/4/18 8.0.11
14 Copyright © 2020 Oracle and/or its a!liates. インストール・セットアップでおすすめしたいこと h"ps://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-con#guring-options.html
• 最新のMySQL Shellを使用する • サーバーが5.7であってもMySQL Shell は8.0を使用する • 実行履歴を保存する • shell.options.setPersist • デフォルトのモードをお好みで設定する(JavaScript/Python/SQL) • JavaScript/Pythonのモジュールも実行可能(xxxx.js,xxxx.py) h"ps://insidemysql.com/mysql-shell-8-0-18/
15 Copyright © 2020 Oracle and/or its a!liates. MySQL Shellのオブジェクト
dba InnoDB cluster管理 ext MySQL Shellプラグイン mysql 旧プロトコル経由でのMySQL Server操作 mysqlx Xプロトコル経由でのMySQL Server操作 shell MySQL Shell自体のプロパティ sys システム設定 util ユーティリティ(アップグレードチェッカーなど)
16 Copyright © 2020 Oracle and/or its a!liates. MySQL Shellのオブジェクト
dba InnoDB cluster管理 ext MySQL Shellプラグイン mysql 旧プロトコル経由でのMySQL Server操作 mysqlx Xプロトコル経由でのMySQL Server操作 shell MySQL Shell自体のプロパティ sys システム設定 util ユーティリティ(アップグレードチェッカーなど)
17 Copyright © 2020 Oracle and/or its a!liates. プラグインを使うと… h"ps://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-con#guring-options.html
• MySQL Serverのステータス情報などのレポート形式をカスタマイズ • 独自オブジェクト、拡張プラグインを追加する • 決まって実施するルーティンの簡略化 • 足りない機能を補完
18 Copyright © 2020 Oracle and/or its a!liates. プラグインを拡張するには… https://dev.mysql.com/doc/dev/mysqlsh-api-python/8.0/
• MySQL Shellのメソッドを使う
19 Copyright © 2020 Oracle and/or its a!liates. 拡張機能を触ってみる!3ステップ 1.
MySQL Shellをインストール! 2. LeFredの公開サンプルをダウンロード! 3. オリジナル拡張機能(プラグイン)を作る!
20 Copyright © 2020 Oracle and/or its a!liates. 1. MySQL
Shellのインストール例 macOS 以下からdmgパッケージをダウンロードして実行 h"ps://dev.mysql.com/downloads/shell/ Windows 以下からmsiインストーラをダウンロードして実行 h"ps://dev.mysql.com/downloads/shell/ https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-install.html Linux系 APTレポジトリ、Yumレポジトリをダウンロードして実行 または以下からrpmパッケージをダウンロードして実行 h"ps://dev.mysql.com/downloads/shell/
21 Copyright © 2020 Oracle and/or its a!liates. 2. LeFredの公開サンプルをダウンロード
・URL https://github.com/lefred/mysqlshell-plugins ・ダウンロード方法 もしくはZIP形式ファイルをダウンロードして格納先ファイルパス配下(次ページ参照)にコピーする macOS/Linux $ mkdir -p ~/.mysqlsh/plugins $ git clone h"ps://github.com/lefred/mysqlshell-plugins.git ~/.mysqlsh/plugins/ext Windows $ mkdir %AppData%¥MySQL¥mysqlsh¥plugins $ git clone h"ps://github.com/lefred/mysqlshell-plugins.git %AppData%¥MySQL¥mysqlsh¥plugins¥ext
22 Copyright © 2020 Oracle and/or its a!liates. 3. オリジナルの拡張機能(プラグイン)を作る
• デフォルトの格納先ファイルパス • 初期化スクリプト • init.jsファイル or init.pyファイル • デフォルトのオブジェクト • shell, dba, util : グローバルオブジェクト • mysql : ShellAPI • mysqlx : Xプラグイン macOS/Linux ~/.mysqlsh/plugins Windows $ %AppData%¥MySQL¥mysqlsh¥plugins MYSQLSH_USER_CONFIG_HOMEで 変更可能
23 Copyright © 2020 Oracle and/or its a!liates. Pythonで拡張機能を作成する場合の注意点 •
Pythonのコーディング規約PEP8に準拠する h"ps://www.python.org/dev/peps/pep-0008/ • サブフォルダごとに__init.py__ファイルを格納しておく • モジュールをインポートする場合、fromはフルパスで指定する 例) from ext.demo.src import sample h"ps://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-plugins-package.html
24 Copyright © 2020 Oracle and/or its a!liates. プラグイングループ •
プラグインフォルダ配下にプラグインを分類して格納することが可能 例えば、以下のようなプラグインをまとめて格納する、 特定のテーマに関するレポートを提供する 同じ共通コードを再利用する 同じ拡張オブジェクトに機能を追加する h"ps://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-plugins-groups.html
25 Copyright © 2020 Oracle and/or its a!liates. 練習:Oracle8ball サンプル
h"ps://github.com/ikomachi226/tecnologycafe7/tree/master/demo
26 Copyright © 2020 Oracle and/or its a!liates. Fredのサンプルプラグイン check
collations connect innodb innodb_cluster maintenance proxysql router schema security support
27 Copyright © 2020 Oracle and/or its a!liates. LeFredのサンプルプラグイン ext.innodb.
getFragmentedTablesDisk() • 断片化されている可能性のあるディスクスペースを取得する
28 Copyright © 2020 Oracle and/or its a!liates. LeFredのサンプルプラグイン ext.innodb.getAlterProgress()
• ALTER TABLEの進捗を取得する
29 Copyright © 2020 Oracle and/or its a!liates. 改めまして… 2020/1/13
MySQL Server 8.0.19 リリース! MySQL NDB Cluster 8.0.19 リリース!
30 Copyright © 2020 Oracle and/or its a!liates. InnoDB Replicaset
New • 非同期レプリケーション • CLONEプラグイン • MySQL Routerを使った手動フェイルオーバー • MySQL Shellによる作成・管理 h"ps://dev.mysql.com/doc/refman/8.0/en/mysql-innodb-replicasets.html h"ps://mysqlserverteam.com/introducing-mysql-innodb-replicaset/
31 Copyright © 2020 Oracle and/or its a!liates. InnoDB Cluster
VS InnoDB Replicaset InnoDB Cluster InnoDB Replicaset
32 Copyright © 2020 Oracle and/or its a!liates. Let’s Replicaset
! サンプル h"ps://github.com/ikomachi226/tecnologycafe7/ ReplicaSet-8019-pb-trying.txt
33 Copyright © 2020 Oracle and/or its a!liates. もくもく!
34 Copyright © 2020 Oracle and/or its a!liates. Share your
ideas! • Shell使ってみた! • こんなプラグイン作ってみた! • あんなプラグインが欲しい! その思いつきが誰かの救世主!になるかも
None