<Insert Picture Here>
2
以下の事項は、弊社の一般的な製品の方向性に関する概要を説明するものです。
また、情報提供を唯一の目的とするものであり、いかなる契約にも組み込むことは
できません。以下の事項は、マテリアルやコード、機能を提供することをコミットメン
ト(確約)するものではないため、購買決定を行う際の判断材料になさらないで下さ
い。オラクル製品に関して記載されている機能の開発、リリースおよび時期につい
ては、弊社の裁量により決定されます。
OracleとJavaは、Oracle Corporation 及びその子会社、関連会社の米国及びその他の国における登録商標です。文 中の社名、商品名等は各社の商標または登録商標である場合があります。The world's most popular open source database
MySQLの高可用性構成
MySQL Cluster MySQL Cluster アプリケーション/ APサーバ 負荷分散 双方向 同期複製•
MySQL Cluster
シェアードナッシング型高性能クラスタ
MySQL Server•
MySQL+DRBD
Linux用のノード間データコピー
アプリケーション/ APサーバ フェールオーバー 同期複製 MySQL Server アプリケーション/ APサーバ 共有ディスク•
3
rdベンダ製HAソフト利用
共有ディスクにデータを格納
フェールオーバー MySQL Server MySQL Server アプリケーション/ APサーバ 負荷分散 非同期複製 準同期複製•
レプリケーション(標準機能)
非同期&準同期データレプリケーション
MySQL Server MySQL Server•
MySQL Cluster
+レプリケーション
MySQL Cluster MySQL Cluster アプリケーション/ APサーバ 負荷分散 双方向 同期複製 MySQL Cluster MySQL Cluster 双方向 同期複製 非同期複製 アプリケーション/ APサーバ 共有ディスク フェールオーバー MySQL Server MySQL Server•
共有ディスク型構成
+レプリケーション
MySQL Server ・・・ 非同期複製 アプリケーション/ APサーバ 参照処理の 負荷分散 MySQL Server MySQL Server複合型の高可用性構成例
データの変更点を
1
つ以上の場所に複製すること
update customer update customer非同期レプリケーション - Asynchronous Replication
同期レプリケーション - Synchronous Replication
レプリケーションとは?
Webアプリケーションでは参照が95%、
更新が5%というケースも (Digg.com)
> シンプルなスケールアウト構成によって
簡単に20倍以上の性能向上が図れる
レプリケーション
•
MySQLの標準機能
–
シンプルな設定
–
マスタ
→スレーブ
–
多数Webでの実績
•
非同期型&準同期型
•
特徴
–
参照性能を向上させる構成
–
バックアップ用途での利用も
–
基本は一方向でのデータコピ
ーだが、双方向や循環型で
の利用も可能 (データの更新
には注意が必要)
–
更新ログ(bin-log)を利用
非同期レプリケーション
Application
Master
Connection Thread
Data
Binlog
Slave
Data
Relaylog
Commit
Changing
Data
Changing
Binlog
Replication
Response
Changing
Data
マスタ > スレーブ
マルチマスタ > スレーブ (マルチソース)
マスタ < > マスタ (マルチマスタ)
マスタ > マルチスレーブ
循環型 (マルチマスタ)
マスタ > スレーブ > マルチスレーブ
MySQL レプリケーションの構成パターン
準同期レプリケーション
Application
Master
Connection Thread
Data
Binlog
Slave
Data
Relaylog
Commit
Changing
Data
Changing
Binlog
Replication
Response
Changing
Data
Response
MySQL 5.5のレプリケーション改善点
1.
準同期(Semisynchronous)レプリケーション
スレーブに変更点を転送してからアプリケーションに応答を返
すため、信頼性が向上
2.
スレーブでのfsync改良&リレーログの自動復旧
fsyncsを改良しスレーブの障害時のログ破損を回避。
破損した場合にも自動普及
3.
レプリケーション ハードビート
障害発生検知のメカニズムの精度を向上
4.
サーバ毎のレプリケーション フィルタリング
特定のサーバIDを持つマスターのイベントを無視
MySQL 5.5のレプリケーション改善点
5.
スレーブでのデータ型変換の自動化(RBR)
マスターとスレーブ間でデータ型が異なる場合に自動的に型
を変換
6.
ログを個別にフラッシュ
'FLUSH LOGS'実行時にログを選択してフラッシュ可能に
7.
トランザクション非対応に関係なく安全にログに記録
InnoDBとMyISAMのテーブルを同一のトランザクション内で
更新した場合、コミット後に全変更点をバイナリログに記録
NDB API JDBC/ODBC/etc SQL Based Applications MySQL Server C++/Java Applications Management Client Management Node LDAP MySQL Cluster Data Node N D B A PI MGM API Data Node Data Node Data Node
MySQL Cluster
•
非共有ディスク型高可用性クラスタソリューション
–
サーバの追加により性能&データ容量を拡大する
スケールアウト構成
•
無停止でのサーバ追加&データ再構成が可能
–
データを複数のサーバにデータの複製を
分散配置
•
マルチマスタ構成、単一障害点無し
•
ミリ秒単位での障害検知、自動フェールオーバー、自動リカバリ
•
ACID準拠の
トランザクション
–
通信系の加入者データベースや
Webのセッション永続化など、
シンプルなトランザクションが
同時多発的に発生するシステム向き
–
SQL以外にもC++やJavaのAPI経由
で直接データアクセス可能
SQL Node
(MySQL)• 標準的なSQLインターフェース
• スケールアウトによる性能向上
• レプリケーション構成可能
• 高パフォーマンス
• C++ API
• 開発ガイドを公開
• データストレージ (ディスク/メモリ)
• 自動的なパーティショニング
• ローカル&グローバルチェックポイント
• スケールアウトによる容量と可用性向上
• 管理および設定
• "Arbitration" 調停役
• 2ノードでの可用性
NDB API
(Application)Data Node
(NDB Storage Engine)Management
Node
MySQL Clusterを構成するコンポーネント
MySQL Clusterに関するキーワード
•
パーティション
–
水平(行単位)パーティショニング
–
主キー(または指定のインデックス)のKeyパーティショニング
–
パーティション数 = データノード数
•
レプリカ
–
データの完全なコピー
•
ノードグループ
–
自動的に作成される
–
グループ数 = データノード数÷レプリカ数
SQL Node (MySQL) NDB API Data Node (NDB Storage Engine)
X
NDB APIによるアクセス
•
NDB API = 高パフォーマンス C++ API
•
キー、インデックススキャン、テーブルスキャン
•
ACIDトランザクション対応
•
オブジェクト指向エラーハンドリング
•
SQLでは達成できない非常に高いパフォーマンス
>
レイテンシーの低減による10倍
以上のスループット
>
Javaプログラマの「普通の」コ
ーディングで利用可能
MySQL Cluster Connector for Java
•
MySQL Cluster Connector for Java
– ネイティブJavaインターフェース – SQLは利用しない
•
MySQL Cluster Java API :ドメイン
オブジェクトモデルのパーシステンスAPI
– 別名Cluster/J
– Javaアプリケーションに組み込んで利用
•
JPA準拠のO/Rマッパーでのアクセス
– MySQL Cluster Plug-in for OpenJPA
– 主キーによる参照、更新、挿入や削除は
Cluster/Jで
Measured as CPU time on a single host
Cluster 1
同期型
レプリケーション
Cluster 2
MyISAM MEMORY InnoDB
非同期型 レプリケーション
•
クラスタのノードグループ間で
は同期型レプリケーションで、
冗長性を確保
•
地理的に離れたクラスタ間で、
双方向の非同期型レプリケー
ションを行い、地理的冗長性を
確保
•
(MySQL Clusterではない)通
常のMySQLサーバへ非同期
型のレプリケーションを行い、
レポート生成や課金処理など
のアプリケーションを実行
Geographical Replication - 地理的冗長性の確保
Delivering up to 10x higher
Java Throughput
MySQL Cluster Connector for
Java:
Native Java API
JPA Plug-In
Reducing Cost of Operations
Simplified Management &
Monitoring:
NDBINFO
MySQL Cluster Manager (part of CGE only)
Faster Restarts
ndbinfo
•
New database (ndbinfo) which
presents real-time metric data
in the form of tables
•
Exposes new information
together with providing a
simpler, more consistent way
to access existing data
•
Examples include:
– Resource usage (memory, buffers)
– Event counters (such as number of READ operations since last restart)
– Data node status and connection status
mysql> use ndbinfo mysql> show tables; +---+ | Tables_in_ndbinfo | +---+ | blocks | | config_params | | counters | | logbuffers | | logspaces | | memoryusage | | nodes | | resources | | transporters | +---+
ndbinfo
•
Example 1: Check memory usage/availability
mysql> select * from memoryusage;
+---+---+---+---+ | node_id | DATA_MEMORY | used | max | +---+---+---+---+ | 3 | DATA_MEMORY | 594 | 2560 | | 4 | DATA_MEMORY | 594 | 2560 | | 3 | INDEX_MEMORY | 124 | 2336 | | 4 | INDEX_MEMORY | 124 | 2336 | +---+---+---+---+
•
Note that there is a DATA_MEMORY and INDEX_MEMORY row for
each data node in the cluster
•
If the Cluster is nearing the configured limit then increase the
DataMemory and/or IndexMemory parameters in config.ini and then
perform a rolling restart
ndbinfo
•
Example 2: Check how many table scans performed on each data node
since the last restart
mysql> select node_id as 'data node', val as 'Table Scans' from counters where counter_name='TABLE_SCANS';
+---+---+ | data node | Table Scans | +---+---+ | 3 | 3 | | 4 | 4 | +---+---+
•
You might check this if your database performance is lower than
anticipated
•
If this figure is rising faster than you expected then examine your
application to understand why there are so many table scans
MySQL Cluster 7.1: ndbinfo
•
Example 3: Check if approaching the point at which the undo log completely fills up
between local checkpoints (which could result in delayed transactions or even a
database halt if not addressed):
mysql> select node_id as 'data node', total as 'configured undo log buffer size', used as 'used buffer space' from logbuffers where log_type='DD-UNDO‘;
+---+---+---+ | data node | configured undo log buffer size | used buffer space | +---+---+---+ | 3 | 2096128 | 0 | | 4 | 2096128 | 0 | +---+---+---+
Monitoring
Status Monitoring &
Recovery
Automated Management
Cluster-Wide
Management
Process Management
On-Line Operations
(Upgrades /
Reconfiguration)
HA Operations
Disk Persistence
Configuration
Consistency
HA Agent Operation
MySQL Cluster Manager 1.0 Features
Example configuration
•
MySQL Cluster Manager agent
runs on each physical host
•
No central process for Cluster
Manager – agents co-operate,
each one responsible for its local
nodes
•
Agents are responsible for
managing all nodes in the cluster
•
Management responsibilities
– Starting, stopping & restarting nodes
– Configuration changes – Upgrades
– Host & Node status reporting – Recovering failed nodes
agent 1. ndb_mgmd 7. mysqld 192.168.0.10 agent 2. ndb_mgmd 8. mysqld 192.168.0.11 agent 5. ndbd 3. ndbd 192.168.0.12 agent 6. ndbd 4. ndbd 192.168.0.13 mysql client agent n. ndb_mgmd n. mysqld n. ndbd
MySQL Server (ID=n)
Management Node (ID=n)
Data Node (ID=n)
Creating & Starting a Cluster
1. Define the site:
2. Expand the MySQL Cluster tar-ball(s) from mysql.com to known directory
3. Define the package(s):
Note that the basedir should match the directory used in Step 2.
4. Create the Cluster
This is where you define what
nodes/processes make up the Cluster and where they should run
5. Start the Cluster:
agent 1. ndb_mgmd 7. mysqld 192.168.0.10 agent 2. ndb_mgmd 8. mysqld 192.168.0.11 agent 5. ndbd 3. ndbd 192.168.0.12 agent 6. ndbd 4. ndbd 192.168.0.13 mysql client
Mysql> create site --hosts=192.168.0.10,192.168.0.11, -> 192.168.0.12,192.168.0.13 mysite;
Mysql> add package --basedir=/usr/local/mysql_6_3_26 6.3; Mysql> add package --basedir=/usr/local/mysql_7_0_7 7.0;
Mysql> create cluster --package=6.3
-> [email protected],[email protected], -> [email protected],[email protected], [email protected], -> [email protected],[email protected],[email protected] -> mycluster;
Upgrade Cluster
• Upgrade from MySQL Cluster 6.3.26 to 7.0.7:
• Automatically upgrades each node and restarts the process – in the correct order to avoid any loss of service
• Without MySQL Cluster Manager, the
administrator must stop each process in turn, start the process with the new version and wait for the node to restart before moving onto the next one agent 1. ndb_mgmd 7. mysqld 192.168.0.10 agent 2. ndb_mgmd 8. mysqld 192.168.0.11 agent 5. ndbd 3. ndbd 192.168.0.12 agent 6. ndbd 4. ndbd 192.168.0.13 mysql client
MySQL Cluster Manager 1.1
GA 1
stNovember 2010
•
On-line add-node
mysql> add hosts --hosts=192.168.0.35,192.168.0.36 mysite;
mysql> add package --basedir=/usr/local/mysql_7_0_7 –
hosts=192.168.0.35,192.168.0.36 7.0;
mysql> add process
[email protected],[email protected],ndbd@19
2.168.0.35,[email protected] mycluster;
mysql> start process --added mycluster;
•
Restart optimizations
–
Fewer nodes restarted on some parameter changes
Data Node Data Node mysqld Mgmt Node mysqld Mgmt Node 31 32 33 34 Data Node Data Node mysqld mysqld 31 32 33 34 Data Node Data Node •35 36 mysqld Mgmt Node mysqld Mgmt Node米国海軍 航空母艦用 航空機管理システム
Aviation Data Management and Control System (ADMACS)
•
艦載機・飛行甲板の運用管理
–
空母に搭載された航空機のメンテ
ナンス、燃料補給計画の管理
–
空母上の飛行甲板の利用を含む、
フライトプランの作成および管理
•
MySQL Cluster
–
4ノードのLinux上で利用
–
単一障害点のない完全な冗長性
–
障害を想定したテストでの安定性と
フットプリントの小ささが選択理由
•
世界最大の軍艦 ニミッツ級航空母艦で運用中
NEC モバイルインターネットプラットフォーム
•
3G通信の顧客情報管理、ユーザ認証、
アクセス制御、課金システム
–
アプリケーションによってSQLおよびAPIを利用
–
2,000万加入者のデータを管理
–
2,400TPSを処理
•
将来の加入者やデータ量、
処理能力の増加に備えた
フレキシブルなサーバ構成が可能
お客様の声 MySQL Clusterの安定性と処理性能はすでに 理解していましたが、特に選定の決め手となっ たのは導入の容易性と、拡張性の高さです。MySQLの高可用性構成
MySQL Cluster MySQL Cluster アプリケーション/ APサーバ 負荷分散 双方向 同期複製•
MySQL Cluster
シェアードナッシング型高性能クラスタ
MySQL Server•
MySQL+DRBD
Linux用のノード間データコピー
アプリケーション/ APサーバ フェールオーバー 同期複製 MySQL Server アプリケーション/ APサーバ 共有ディスク•
3
rdベンダ製HAソフト利用
共有ディスクにデータを格納
フェールオーバー MySQL Server MySQL Server アプリケーション/ APサーバ 負荷分散 非同期複製 準同期複製•
レプリケーション(標準機能)
非同期&準同期データレプリケーション
MySQL Server MySQL ServerRequirements
Replication
Cluster
MySQL &
DRBD
Availability
Automatic Fail Over No Yes Yes Fail Over Time Varies < 1 sec < 5 min Resynch of Data No Yes Yes Geographic Redundancy Yes Yes No
Scalability
Load Balancing Scale-Out Yes No Read Intensive Yes Yes No Write Intensive No Yes No
# of Nodes 100’s(reads) 255 1 Active
SQL Functionality
Primary Key Lookups Yes Yes Yes Simple JOINs Yes Yes Yes Complex JOINs Yes No Yes Transactions Yes Yes Yes