74
1 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 第二回 中国地方DB勉強会 MySQL Cluster 解説 MySQL Cluster 7.3 最新情報 日本オラクル株式会社 山崎 由章 / MySQL Senior Sales Consultant, Asia Pacific and Japan

MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

Embed Size (px)

DESCRIPTION

第二回 中国地方DB勉強会での発表資料です。

Citation preview

Page 1: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

1 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

第二回 中国地方DB勉強会

MySQL Cluster 解説 &

MySQL Cluster 7.3 最新情報

日本オラクル株式会社

山崎 由章 / MySQL Senior Sales Consultant,

Asia Pacific and Japan

Page 2: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

2 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

以下の事項は、弊社の一般的な製品の方向性に関する概要を説明するものです。また、情報提供を唯一の目的とするものであり、いかなる契約にも組み込むことはできません。以下の事項は、マテリアルやコード、機能を提供することをコミットメント(確約)するものではないため、購買決定を行う際の判断材料になさらないで下さい。オラクル製品に関して記載されている機能の開発、リリースおよび時期については、弊社の裁量により決定されます。

OracleとJavaは、Oracle Corporation 及びその子会社、関連会社の米国及びその他の国における登録商標です。文中の社名、商品名等は各社の商標または登録商標である場合があります。

Page 3: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

3 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Continuous Improvement

MySQL Enterprise Monitor 2.2

MySQL Cluster 7.1

MySQL Cluster Manager 1.0

MySQL Workbench 5.2

MySQL Database 5.5

MySQL Enterprise Backup 3.5

MySQL Enterprise Monitor 2.3

MySQL Cluster Manager 1.1

DRIVING MySQL

INNOVATION

All GA!

MySQL Enterprise Backup 3.7

Oracle VM Template for MySQL

Enterprise Edition

MySQL Enterprise Oracle

Certifications

MySQL Windows Installer

MySQL Enterprise Security

MySQL Enterprise Scalability

MySQL Database 5.6 DMR*

MySQL Cluster 7.2 DMR

MySQL Labs!

(“early and often”)

All GA!

MySQL Cluster 7.2

MySQL Cluster Manager 1.4

MySQL Utilities 1.0.6

MySQL Migration Wizard

MySQL Enterprise Backup 3.8

MySQL Enterprise Audit

MySQL Database 5.6

MySQL Cluster 7.3

MySQL Database 5.7 DMR

A BETTER

MySQL *Development Milestone Release

2010 2011 2012-13

All GA!

Available Now!

Page 4: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

外部キー

Connection Thread Scalability

MySQL 5.6との統合

Auto-Installer

NoSQL API : JavaScript

for node.js

New!!

Page 5: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Clusterとは?

• MySQLとは開発ツリーの異なる別製品

• 共有ディスクを使わずに、アクティブ-アクティブのクラスタ構成が組める

• 元々はSQLを使わないデータベースだったが、MySQLと統合され

SQLも使えるようになった

(NoSQL(KVS)とSQLの両方が使えるデータベース)

向いているシステム

• 高可用性が求められるシステム

• 同時多発的に大量のトランザクションが発生するシステム

• 読込み処理だけでなく、書込み処理に対しても拡張性が求められるシステム

Page 6: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster: Overview

• 自動シャーディング、マルチマスター

• ACID 準拠のトランザクション, OLTP + Real-Time Analytics

読込み/書込み処理

に対する高い拡張性

• シェアードナッシング、単一障害点無し

• 自動修復 + オンラインオペレーション 99.999% の高可用性

• オープンソース + 商用版

• コモディディハードウェア + 充実した管理ツール、監視ツール 低い TCO

• Key/Value + SQL の柔軟性

• SQL + Memcached + JavaScript + Java + JPA + HTTP/REST & C++ SQL + NoSQL

• インメモリデータベース + ディスクデータ

• 非常に低いレイテンシ、短いアクセス時間 リアルタイム

Page 7: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Who’s Using MySQL Cluster?

Page 8: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

導入事例: 携帯電話ネットワーク

HLR / HSS

課金, 認証, VLR

認証, 追跡接続サービス, 課金

位置情報 の更新

プリペイ& ポストペイ課金

• 大量の書き込みトランザクション

• 3ms未満のデータベースレスポンス

• 停止時間 & トランザクション消失 = ビジネスの損失

MySQL Cluster in Action: http://bit.ly/oRI5tF

Page 9: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

導入事例: 航空機管制システム • 米国海軍航空母艦

• 包括的航空機運用管制システム • メンテナンス記録

• 燃料搭載量管理

• 気象状況

• 飛行甲板管理

• システム要件 • 単一障害点無し

• 完全な冗長性

• 小さなフットプリント & 過酷な利用環境での利用

• 4台のMySQL Clusterノード LinuxおよびWindows

MySQL User Conference Session: http://bit.ly/ogeid3

Page 10: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

PAYPAL OVERVIEW

• Processed $145bn in transactions (CY2012)

• 前年比成長率22%、1億23百万アカウント、190マーケット

課題/機会

• グローバル単位での不正検知システム構築

• ユーザセッション、トランザクション追跡のリアルタイム処理

DATABASEに求められた要件

• 100TB のデータ & 1億ユーザ に対応可能

• ACID 準拠のトランザクション

• 書込まれたデータを1秒以内に全世界のどこからでも確認可能

• ユーザのトランザクション履歴をリアルタイムで分析可能

• クラウド環境における、高い性能拡張性と99.999%の高可用性

CUSTOMER PERSPECTIVE "Technologies such as MySQL Cluster enables users to

get the best of both world’s…the agility of NoSQL

systems with the trust, maturity and reliability of the

SQL model "

Daniel Austin, Chief Architect, PayPal

結果

• 設計目標より3倍速いパフォーマンス

• 40TB のデータをCluster間で同期

• 5つのAWS リージョンにMySQL Clusterを構築

• Self-healing

http://www.mysql.com/customers/view/?id=1223

課題解決策

• MySQL Cluster 7.2 with Geo-Replication

• AWS

Page 11: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

11 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster アーキテクチャ

データ・ノード

ノード・グループ1

F1

F3

F3

F1

ノード

1

ノード

2

ノード・グールプ 2

F2

F4

F4

F2

ノード

3

ノード

4

アプリケーション・ノード

管理ノード 管理ノード

REST JPA

Page 12: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

SQLとNoSQL それぞれのベストを採用 SQL と NoSQLの組み合わせ

• SQL: 複雑なリレーショナル・クエリ

• HTTP / memcached: キー・バリュー型Webサービス

• Java: エンタープライズ・アプリケーション

• NDB API: リアルタイム・サービス

• Node.js: 非同期処理

様々な

組み合わせ

データ・ノード

NDB API

クライアント

ネイティブ memcached HTTP/REST

JDBC / ODBC

PHP / PERL

Python / Ruby Node.js

Page 13: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

自動シャーディングによる高可用性

• アプリケーションに影響なし – アプリケーション層でのシャーディング・ロジックは不要

– 主キーの全てまたは1部のハッシュをベースとしてパーティショニング

– 各ノードが1つのパーティションの主フラグメントを格納し、他のノードがそのバックアップを格納

• フェイルオーバー、アップグレード、スケールアウト時も処理を継続可能

• アプリケーションを1シャードだけ使用するトランザクションに制限する必要なし

Page 14: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

14 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

自動シャーディングによる高可用性

Table T1 Data Node 1

Data Node 2

Data Node 3

Data Node 4

ID FirstName LastName Email Phone

Page 15: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

自動シャーディングによる高可用性

Data Node 1

Data Node 2

Data Node 3

Data Node 4 - 水平パーティショニング

- パーティション数=データノード数

- フラグメント数=パーティション数×レプリカ数

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

4パーティション×2レプリカ=8フラグメント Table T1

Page 16: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

自動シャーディングによる高可用性

Data Node 1

Data Node 2

F1

Primary Fragment

Secondary Fragment

F1

Data Node 3

Data Node 4 Fx

Fx

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

4パーティション×2レプリカ=8フラグメント Table T1

Page 17: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

自動シャーディングによる高可用性

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4 Fx

Fx

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

4パーティション×2レプリカ=8フラグメント Table T1

Page 18: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

18 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

自動シャーディングによる高可用性

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Fx

Fx

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

4パーティション×2レプリカ=8フラグメント Table T1

Page 19: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

19 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

自動シャーディングによる高可用性

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Node Group 1

Node Group 2 Fx

Fx

- ノードグループは自動的に作成される

- ノードグループ数=データノード数/レプリカ数

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

4パーティション×2レプリカ=8フラグメント Table T1

Page 20: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

自動シャーディングによる高可用性

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Node Group 1

Node Group 2 Fx

Fx

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

4パーティション×2レプリカ=8フラグメント

ノードグループ内にひとつでも生き残っている

ノードがあれば、処理を継続できる

Table T1

Page 21: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

21 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

自動シャーディングによる高可用性

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Node Group 1

Node Group 2 Fx

Fx

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

4パーティション×2レプリカ=8フラグメント

ノードグループ内にひとつでも生き残っている

ノードがあれば、処理を継続できる

Table T1

Page 22: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

22 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

自動シャーディングによる高可用性

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Node Group 1

Node Group 2 Fx

Fx

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

4パーティション×2レプリカ=8フラグメント

ノードグループ内にひとつでも生き残っている

ノードがあれば、処理を継続できる

Table T1

Page 23: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

23 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster 7.2 ベンチマーク結果 7.1と比べて8倍の性能向上

1分間に10億回の読取り(SELECT)

- 8x Intel Xeon x5670, NoSQL C++ API, flexAsynch benchmark

0

2

4

6

8

10

12

14

16

18

20

MySQL Cluster 7.1 MySQL Cluster 7.2

Re

ads

pe

r Se

con

d (

Mill

ion

s)

Page 24: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

24 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

0

5

10

15

20

25

2 4 6 8 10 12 14 16 18 20 22 24 26 28 30

Mil

lio

ns

of

UP

DA

TE

s p

er

Se

co

nd

MySQL Cluster Data Nodes

MySQL Cluster 7.2 ベンチマーク結果 非常に高いスケーラビリティ

1分間に12億回の書込み(UPDATE)

- 30x Intel Xeon E5-2670, NoSQL C++ API, flexAsynch benchmark

Page 25: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

25 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

実例テストケース

0

20

40

60

80

100

MySQL Cluster 7.1 MySQL Cluster 7.2

クエリー実行時間 (秒)

70倍高速

87.23 秒

1.26 秒

• Webベース・コンテンツ管理システム - 11テーブル、33,500行を結合(JOIN)

- 結果セット:2,060行、1行あたり19列を返す

Page 26: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

ベンチマークの詳細

データ ノード1

データ ノード 2

MySQLサーバー

http://clusterdb.com/u/70x

Page 27: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

27 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

アダプティブ・クエリー・ローカライゼーション 分散JOINスケーリング

• シャード間で複雑なクエリを実行 • JOIN処理をデータ・ノードに移行

• 並列実行

• 一つの結果セットをMySQLに戻す

• これまででは性能的に難しかった処理も

実行可能に • リアルタイム分析

• レコメンデーション・エンジン

• クリックストリームを分析

mysqld

データ・ノード

mysqld

A

Q

L

データ・ノード

70倍以上の

パフォーマンス向上

機能性を犠牲にせず、スケールアウトを向上!!

Page 28: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

28 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

AQL – 使用方法

• ndb_join_pushdown がONで有効(デフォルト)

• 結合(JOIN)を移行するためのルール: 1. 結合する列のタイプは全て完全に同じ

2. BLOBまたはTEXT列への参照なし

3. 明示的ロックなし

4. 結合内の子テーブルはref、eq_ref、またはconstを使用してアクセス

5. テーブルは[LINEAR] HASH、 LIST、または RANGEを使用して明示的に

パーティショニングされていない

6. クエリー・プランが ‘Using join buffer’ を選択していない

7. 結合のルートが eq_ref または const の場合、子テーブルは eq_refで結合

• 各テーブルに対し ANALYZE TABLE <tab-name> を実行

• EXPLAIN を使用してどのコンポーネントが移行されるか確認: – Extra: Child of 'd' in pushed join@1

Page 29: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

29 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

外部キー

Connection Thread Scalability

MySQL 5.6との統合

Auto-Installer

NoSQL API : JavaScript

for node.js

New!!

Page 30: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

30 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster 7.3: Connection Thread Scalability

データノードへのコネクションのスループット向上

mutexの分割により、スループットが向上

設定をより簡単に

スケーラビリティの向上

最大ノード数は256ノードまで

接続毎に7.5倍の性能向上

SQL & NoSQL の両方において

MySQL Cluster Data Nodes

MySQL Cluster Data Nodes

With Connection

Thread Scalability

Page 31: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

31 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster Connection Thread Scalability

• DBT2 Benchmark

– Single MySQL Server

– Single Data Node

– 128 client connections

8.5x

Page 32: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

32 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

• Sysbench read-only

Benchmark

– Single MySQL Server

– Single Data Node

– 128 client connections

6x

MySQL Cluster Connection Thread Scalability

Page 33: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

33 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

• Sysbench read-write

Benchmark

– Single MySQL Server

– Single Data Node

– 128 client connections

4x

MySQL Cluster Connection Thread Scalability

Page 34: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

34 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster 7.3: MySQL 5.6 との統合

MySQL Cluster NDB Storage Engine

Local InnoDB Tables InnoDB

アプリケーションに合わせて、ストレージ

エンジンを選択可能

– InnoDB: Large Rows, DSS Queries, FTS

– MySQL Cluster: Auto-sharding, real-time, HA

最新の MySQL 5.6 を使用可能

– Optimizer の改善

– クラッシュセーフのスレーブ

– レプリケーション チェックサム

– バイナリログサイズの削減

– 遅延レプリケーション

Page 35: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

35 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

サブクエリの高速化

LIMIT句で少数のレコードを取得する際のファイル・ソートを最適化

- 4倍高速化 - 40秒から10秒に短縮

インデックス条件のプッシュダウン

- 160倍高速化 - 15秒から90ミリ秒に短縮

FROMからのビュー/サブクエリの実データ取得を遅延

- EXPLAINが240倍高速化 - 8分から2秒に短縮

バッチ・キー・アクセスと複数範囲の読み取り

- 280倍高速化 - 2800秒から10秒に短縮

オプティマイザの統計情報の永続化

MySQL 5.6: オプティマイザ

Page 36: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

36 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

0 8 16 24 32 40 48 56 64 5

50

500

5000

1225

9.63

2821

No BKA

BKA

Join Buffer Size (MB)

Que

ry T

ime

(秒)

MySQL 5.6: オプティマイザ バッチ・キー・アクセス(BKA)およびマルチ・レンジ・リード (MRR)

ディスクアクセスの多いJOINクエリのパフォーマンスを向上

MRR + BKA無しの

実行時間

MRR + BKA有りの実行時間

DBT3 Q3: "Customer Distribution Query"

optimizer_switchの

batched_key_accessで制御

Page 37: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

37 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

• MySQL Clusterの適用範囲がより広範囲に

– パッケージアプリケーション、カスタムプロジェクト

• 複雑さを軽減しつつ、強力な機能を追加

– アプリケーションロジック & データモデル

• デフォルトで使用可能

• SQL&NoSQLの両方で

使用可能

• オンラインで追加/削除可能

MySQL Cluster 7.3 GA: 外部キー

Page 39: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

39 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

外部キー:例)

mysql> CREATE TABLE towns (town VARCHAR(30) NOT NULL PRIMARY KEY, county

VARCHAR(30), INDEX county_county_index (county), CONSTRAINT county_town FOREIGN

KEY (county) REFERENCES counties(county) ON DELETE RESTRICT ON UPDATE RESTRICT)

ENGINE=ndb;

mysql> DELETE FROM counties WHERE county='Berkshire';

ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key

constraint fails (Unknown error code)

mysql> SHOW WARNINGS;

+---------+------+-------------------------------------------------------------------------------------------+

| Level | Code | Message |

+---------+------+-------------------------------------------------------------------------------------------+

| Warning | 1296 | Got error 256 'Foreign key constaint violated: Referenced row exists' from NDB |

| Error | 1451 | Cannot delete or update a parent row: a foreign key constraint fails (Unknown error code) |

+---------+------+-------------------------------------------------------------------------------------------+

Page 40: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

40 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Workbench: MySQL Clusterの外部キーをサポート

Page 41: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

41 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

NoSQL Access to MySQL Cluster data

ClusterJ

MySQL

JDBC

Apps

JPA

JNI

Python Ruby

ClusterJPA

Apps Apps Apps Apps Apps

Node.js

JS

Apps

mod-ndb

Apache

Apps

ndb-eng

Memcached

Apps Apps

NDB API (C++)

MySQL Cluster Data Nodes

Apps

PHP PERL

Apps

Page 42: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

42 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster 7.3 : Node.js NoSQL API

• ネイディブJAVAスクリプトからMySQL Clusterへアクセス

– JavaScript オブジェクトから、直接MySQL Cluster

へアクセス

– SQLの変換をバイパス

• Node.js用のモジュールとして実装

– Webアプリケーションの中に、Cluster API

ライブラリを統合

V8 JavaScript Engine

MySQL Cluster Node.js Module

MySQL Cluster Data Nodes

Clients

Page 43: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

43 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster 7.3: Auto-Installer

• 素早く設定可能

• リソースを自動検出

• ワークロードに合わせた最適化

• 再現可能なベストプラクティス

• MySQL Cluster 7.2 + 7.3 で

使用可能

Specify Workload

Auto-Discover

Define Topology Deploy

Page 44: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

44 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster 7.3: Auto-Installer

• マルチホストサポート

• リモートサーバへもデプロイ可能

• 簡単に実行可能: – bin/ndb_setup

– setup.bat

MySQL Cluster Auto-Installer

Page 45: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

45 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-Installerを使って、MySQL Clusterの

テスト環境を作成してみよう

1.MySQL Cluster7.3をダウンロードする

2.Auto-Installerを起動して、各種設定を行う

3.Auto-InstallerからDeployする

4.稼働確認

Page 46: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

46 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster7.3をダウンロードする

• http://dev.mysql.com/downloads/cluster/ へアクセス

• 環境に応じたモジュールをダウンロード

– 今回は、 Linux - Generic (glibc 2.5) (x86, 64-bit), Compressed TAR Archive

(mysql-cluster-gpl-7.3.2-linux-glibc2.5-x86_64.tar.gz)

をダウンロード

Page 47: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

47 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-Installerを起動して、各種設定を行う

• TARファイルを解凍 – cd /usr/local

– tar xvzf /<<ファイルパス>>/mysql-cluster-gpl-7.3.2-linux-glibc2.5-x86_64.tar.gz

– mv mysql-cluster-gpl-7.3.2-linux-glibc2.5-x86_64 mysql-cluster

• mysqlユーザ作成 – groupadd -g 502 mysql

– useradd -u 502 -g mysql -d /home/mysql -s /bin/bash mysql

• Auto-Installerを起動(mysqlユーザで実行) – /usr/local/mysql-cluster/bin/ndb_setup.py

Page 48: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

48 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-Installerを起動して、各種設定を行う

• 「Create New MySQL Cluster」をクリック後、

「Next」をクリックし続ける

– 設定を変更したい場合は、設定を変更後、「Next」をクリック

Page 49: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

49 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-Installerを起動して、各種設定を行う

Page 50: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

50 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-Installerを起動して、各種設定を行う

Page 51: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

51 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-Installerを起動して、各種設定を行う

Page 52: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

52 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-Installerを起動して、各種設定を行う

Page 53: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

53 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-Installerを起動して、各種設定を行う

Page 54: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

54 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-Installerを起動して、各種設定を行う

Page 55: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

55 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-InstallerからDeployする

• 「Deploy and start cluster」をクリック

Page 56: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

56 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-InstallerからDeployする

Page 57: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

57 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-InstallerからDeployする

Page 58: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

58 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-InstallerからDeployする

Page 59: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

59 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Auto-InstallerからDeployする

Page 60: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

60 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

稼働確認

• SQLノード1に接続 – mysql -u root --port=3306 --socket=/home/mysql/MySQL_Cluster/53/mysql.socket

• SQLノード2に接続 – mysql -u root --port=3307 --socket=/home/mysql/MySQL_Cluster/54/mysql.socket

※各種パラメータは、必要に応じて変更して下さい。

特に、以下の設定は、すぐに容量不足になりデータを挿入できなくなるので要注意!!

- DataMemory=1M

- IndexMemory=1M

Page 61: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

61 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

稼働確認

• SQLノード1から実行

– InnoDBとNDBでテーブルを作成し、データをinsert • use test;

• create table t_ndb (id int auto_increment, col1 char(20), primary key(id)) engine=ndb;

• create table t_innodb (id int auto_increment, col1 char(20), primary key(id)) engine=innodb;

• insert into t_innodb(col1) values('InnoDB');

• insert into t_ndb(col1) values('NDB');

– データを確認 • show tables;

• select * from t_innodb;

• select * from t_ndb;

Page 62: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

62 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

稼働確認

• SQLノード2から実行

– データを確認(NDBのテーブルのみが確認できる) • use test;

• show tables;

• select * from t_innodb;

• select * from t_ndb;

– NDBのテーブルにデータをinsert • insert into t_ndb(col1) values('NDB_Node2');

– データを確認 • select * from t_ndb;

Page 63: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

63 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

稼働確認

• SQLノード1から実行

– データを確認(SQLノード2から INSERT したデータも確認できる) • select * from t_ndb;

Page 64: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

64 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

第一回 中国地方DB勉強会に登壇された

奥野さんの書籍です。

MySQL Clusterのノウハウがぎっしり詰まった1冊です。 (http://gihyo.jp/book/にて、電子書籍版もあります)

お勧め書籍

Page 65: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

65 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

監視 &

リカバリ

無停止

メンテナンス

管理作業

の自動化

低コストでより柔軟性をもった

高可用性データベース環境を構築&管理可能に

MySQL Cluster Manager

Page 66: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

66 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

MySQL Cluster Manager

例: MySQL Cluster 7.0 から 7.2へのアップグレード

• 1 x クラスタの事前状態チェック • 8 x ssh コマンド/サーバー • 8 x 停止コマンド/プロセス • 4 x 構成ファイルの転送 - scp

(2 x mgmd & 2 x mysqld) • 8 x プロセスごとの開始コマンド • 8 x 開始または再参加プロセスの確認 • 8 x 完了確認処理 • 1 x クラスタ全体の完了確認 • 各構成ファイルの手動による編集を除

合計: 46 コマンド- 2.5 時間の作業

MySQL Cluster Manager 導入前 MySQL Cluster Manager では

upgrade cluster --package=7.2 mycluster;

合計: 1 コマンド -

完全自動処理 – データベース・クラスタ管理の負荷および複雑さを削減

– 管理エラーによるダウンタイムのリスクを排除

– クラスタ管理のベストプラクティスを自動化

Page 67: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

67 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

参考情報

http://dev.mysql.com/tech-resources/articles/mysql-cluster-auto-installer.html

• Auto-Installer: Video Tutorial

• Using JavaScript and Node.js with MySQL Cluster – First steps

• ホワイトペーパー : MySQL Cluster 7.3 の新機能

• ホワイトペーパー : MySQL Cluster 評価ガイド

http://www-jp.mysql.com/why-mysql/white-papers/mysql-cluster-new-features-

whitepaper-ja/

http://www.clusterdb.com/mysql/mysql-cluster-with-node-js/

http://www.mysql.com/why-mysql/white-papers/mysql-cluster-eval-7-2-jp/

Page 68: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

68 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

今後のイベントのご紹介

• 10/6(日) OSC広島

– ブース出展とセミナー開催

– セミナー:MySQL最新動向と便利ツールMySQL Workbench https://www.ospn.jp/osc2013-hiroshima/modules/eguide/event.php?eid=14

• 10/10(木) Webセミナー

– MySQL Enterprise Monitor 3.0 :パフォーマンスと可用性のリアルタイム監視 http://www-jp.mysql.com/news-and-events/web-seminars/mysql-enterprise-monitor-3-0-ja/

• 10/19(土)、20(日) OSC東京

– ブース出展とセミナー開催 http://www.ospn.jp/osc2013-fall/

Page 70: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

70 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

今後のイベントのご紹介

• 10/30(水) MySQL User Forum 大阪 – http://www.oracle.com/webapps/events/ns/EventsDetail.jsp?p_eventId=1

75533&src=7882844&src=7882844&Act=34

• 10/31(木) MySQL User Forum 名古屋 – http://www.oracle.com/webapps/events/ns/EventsDetail.jsp?p_eventId=1

75536&src=7882844&src=7882844&Act=35

• 11/7(木) MySQL勉強会 in 大阪(第5回) – http://atnd.org/events/44157

Page 71: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

71 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

今後のイベントのご紹介

• 11/8(金)、11/9(土) KOF(関西オープンフォーラム)

– ブース出展とセミナー開催

– セミナー:States of Dolphin - MySQL最新技術情報2013秋 -

https://k-of.jp/2013/session/466

– セミナー:SQL+NoSQL!? それならMySQL Clusterでしょ。

https://k-of.jp/2013/session/467

• 11/13(水)~11/15(金) db tech showcase 東京 2013

– MySQL関連のセミナーを3つ開催予定(調整中)

– http://www.insight-tec.com/dbts-tokyo-2013.html

Page 72: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

72 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

今後のイベントのご紹介

• 11/16(土) OSC福岡

– ブース出展とセミナー開催

Page 73: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

73 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Page 74: MySQL Cluster 解説 & MySQL Cluster 7.3 最新情報

74 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

74