- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2021-01-05T11:56:41+00:00","default:wikiadmin","wikiadmin")
#author("2021-02-05T06:38:32+00:00","default:wikiadmin","wikiadmin")
-PersonaによるMySQLクローン
#contents
*インストール [#dbd68274]
yumでリポジトリ入れて、パッケージを入れる。MySQLの代わりには入れたことがなくて、PerconaToolkit(Perlのユーティリティ集)のみしか使っていない。
*Percona Toolkit [#tdeb0a06]
**pt-show-grants [#q61c1633]
ユーザー権限をSQLの形で出力してくれる便利ツール
ローカルであれば以下でOK
pt-show-grants --ask-pass
**pt-online-schema-change [#v21310e6]
オンラインでもテーブルロックせずにDDL変更ができるツール
仕組みは
+変更後の構造のテーブルを作成
+元のテーブルにトリガー仕込む
+データコピー
+完了したら元のテーブルと入れ替える
+トリガーを消す
-dry-run
pt-online-schema-change --alter="ADD Column item1 char(10) after id" h=localhost,D=DB_NAME,t=pt_test,u=root --ask-pass
-execute
pt-online-schema-change --alter="ADD Column item1 char(10) after id" h=localhost,D=DB_NAME,t=pt_test,u=root --ask-pass --execute
-トリガーも旧テーブルも削除しない
pt-online-schema-change --alter="ADD Column item1 char(10) after id" h=localhost,D=cakephp,t=pt_test,u=root --ask-pass --no-drop-triggers --no-swap-tables --dry-run
**pt-query-digest [#u2d67fd4]
スロークエリーログを解析してくれる。
pt-query-digest /var/log/mysql/slow.log
#conter