รู้จักกับ mysql clusterclusterkit.co.th/pdf/mysql_cluster_ossfest11.pdf ·...

38
รู้จักกับ MySQL Cluster กตตรักษ์ ม่วงม่งสุข (Kittirak Moungmingsuk) [email protected] May 19, 2012 @ossfestival #11

Upload: dangmien

Post on 06-Mar-2018

239 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

รูจ้ักกับ MySQL Cluster

กิตติรักษ ์ม่วงมิ่งสุข(Kittirak Moungmingsuk)[email protected] 19, 2012 @ossfestival #11

Page 2: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

2

`whoami`A part of team at Cluster Kit Co.,Ltd. Since 2007.Adjacent Lecturer at Rajamangala University of

Technology Thanyaburi (RMUTT)About Cluster Kit

We have the technological know-how and experience necessary in the high performance computing

Our Service including Implementation & Training

Page 3: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

3

ThaiGrid (Tera Cluster)800 Cores, Linux Cluster133 Cores, Win Cluster

Sila Cluster @Ramkhamhaeng U. 286 Cores BIOTEC (Eclipse Cluster) 704 Cores Virgin Radio Thailand

7 nodes, Web ClusterGeo-Informatics and Space Technology Development Agency (GISTDA)

10 nodes, Web ClusterHAII (HAII Cluster I, II) 480 Cores

Cluster Kit: Achievement

Page 4: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

4

Out of Scope, Related AEC.

Page 5: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

5

Page 6: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

6

Agenda

Quick review MySQLMySQL Cluster ConceptWhat's MySQL Cluster Do?

Load BalanceHigh Availability

NDB Storage EngineMySQL Cluster FeaturesIn-Memory Vs. Disk-BasesMonitoring Tools

Page 7: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

7

MySQL Review Latest stable version is 5.5Written in C and C++. Works on many different platforms.Designed to be fully multi-threaded using kernel threadsSupport for large databases

200,000 tables and about 5,000,000,000 rows. supports high-availability database clustering using the

NDBCLUSTER storage

Page 8: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

8

MySQL Development Roadmap

Page 9: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

9

Storage Engines

MyISAMInnoDBNDBCLUSTER

MemoryMergeArchiveFederatedCVSBlackholeExample

Page 10: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

10

MyISAM

The default MySQL storage engine supported in all MySQL configurationsdefault storage engine unless you have configured

MySQL to use a different one by default.

Page 11: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

11

InnoDB

A transaction-safe (ACID compliant) Row-level locking Oracle-style consistent nonlocking reads increase

multi-user concurrency and performance. Stores user data in clustered indexes to reduce I/O for

common queries based on primary keys.Supports FOREIGN KEY referential integrity

constraints.

Page 12: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

12

NDBCLUSTER

known as NDBClustered database engine Particularly suited for applications that require the

highest possible degree of uptime and availabilityHigh Availabilitymission-critical 24/7 usage and heavy Web or

logging usage.

Page 13: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

13

MySQL Cluster

Enables clustering of both in-memory and on disk bases.

Shared-nothing architecture. No single point of failure.Storage engine called NDB or NDBCLUSTERLatest NDB 5.5.20-ndb-7.2.5

That's mean NDB 7.2.5, MySQL 5.5.20Both GPL License and Commercial

Page 14: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

14

In-memory Vs. Disk-Bases

In-MemoryFastest than DiskRequired more memoryFocus on real-time application

Disk-Base (Support on ndb-7.x up)Slower then MemoryWorking with larger dataCheapest in cost

Images from http://www.openclipart.org/

Page 15: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

15

MySQL Cluster Components

Management node (MGM node)Data nodeSQL node

Page 16: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

16

Scaling Out Configuration

Page 17: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

17

2 Node Groups Data Partitioning

Node Group 150%

ndb1

ndb2

Node Group 250%

ndb3

ndb4

Page 18: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

18

Multi-thread Data nodeSupport Maximum 8 threads per machine

Transaction Coordinator (TC) 1Transporter 1Replication 1

Local Query Handler (LQH)Access manager (ACC)Tuple Manager (TUP)

MaxNoOfExecutionThreads LQH Threads2 14 28 4

Page 19: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

19

Advantages

High availability and Load balancedHigh Throughput ScalabilityCan deploy with low cost hardware

Page 20: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

20

Disadvantages

Need many number of machines Difficult in configurationNot work with complex queryRequired high technical skill

Page 21: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

21

Disk Bases Table

Beginning with MySQL 5.1Disk based data does not support variable sized

storage.A disk-based table stores its data in a tablespace and

stores undo data in a log file group

Page 22: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

22

On-line add node 1

Page 23: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

23

On-line add node 2update config.ini

Page 24: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

24

On-line add node 3Rolling Restart

Page 25: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

25

On-line add node 4Repartition Data

Page 26: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

26

On-line add node 5Data Repartitioned

Page 27: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

27

Cluster Backup & Restore

Two mechanisms NDB native backupThe mysqldump program

NDB native backup not restorable to clusters running earlier or later versions.

Page 28: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

28

Limitation Cannot create indexes on NDB table columns that use

any of the TEXT or BLOB data types. Does not support FULLTEXT indexes The NDBCLUSTER storage engine supports only the

READ COMMITTED transaction isolation levelThere are no partial transactions, and no partial

rollbacks of transactions.MySQL Cluster does not handle large transactions wellTRUNCATE & LOAD DATA INFILE are non-

transactional and cannot be rolled back.

Page 29: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

29

CMON Web MonitoringCMON is a daemon that aggregates information from

MySQL Cluster that earlier was only accessible from the cluster log or the management client, such as: cluster state, node state, backup statistics, Statistics and Cluster events (cluster log basically)

CMON can also start ndbd nodes and make decisions on how they should be started (with or without --initial).

CMON also does analysis and suggests changes to mysql variables in case they are wrongly set.

Page 30: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

30

CMON Screen

Page 31: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

31

References & Recommended Site

http://dev.mysql.com/downloads/cluster

“MySQL Cluster 7.0: Architecture and New Features”. A MySQL® Technical White Paper by Sun Microsystems, April 2009.

Configurator for MySQL Clusterhttp://www.severalnines.com/config/

Principal Consultant, MySQL AB http://johanandersson.blogspot.com/

Page 32: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

32

“คอมพิวเตอร์มือสอง เพื่อน้องในชนบท”

Page 33: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

33

เกี่ยวกับโครงการ

กิจกรรมทำำอะไร ?รับบริจำคเครื่องคอมพิวเตอร์และอะไหล่ต่ำง ๆ มำประกอบเป็น

เครื่องที่สมบูรณ์ ติดตั้งระบบปฏิบัติกำรลีนุกซ์เพื่อกำรศึกษำ Edubuntu แล้วนำำไปส่งมอบให้โรงเรียน พร้อมทำำให้ทุกเครื่องเชื่อมต่ออินเทอร์เน็ตได้ ด้วยกำรวำงระบบเครือข่ำยให้กับทำงโรงเรียน

ทำำในรูปแบบไหน ?เป็นกิจกรรมที่รวมตัวกันทำำในกลุ่มเพื่อน ๆ คนคอมพิวเตอร์ที่

อยำกไปเที่ยว อยำกทำำดี

Page 34: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

34

เกี่ยวกับโครงการ (ต่อ)

ทำำมำแล้วกี่ครั้งจัดส่งมอบมำแล้วทั้งหมด 6 โรงเรียน รวมส่งมอบไปห้ำสิบกว่ำ

เครื่อง ติดตั้งระบบเครือข่ำยให้ 5 โรงเรียน เครื่องที่บริจำคสเปกแรงแค่ไหน

เครื่องที่ส่งไป RAM 512 MB. ฮำร์ดดิสก์รวมกันให้ได้ 6 GB. ก็เอำละ ก็ตำมคุณสมบัติขั้นตำ่ำที่ลง Edubuntu ได้ครับ (เรำจัดตำ่ำกว่ำที่เขำกำำหนด แต่ใช้ได้ครับ)

Page 35: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

35

Page 36: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

36

Page 37: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

37

Page 38: รู้จักกับ MySQL Clusterclusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf · รู้จักกับ MySQL Cluster กิตติรักษ์ ม่วงมิ่งสุข

38

Thank you.

Tweet to me at @kittirakDownload this presentation at

http://www.clusterkit.co.th/pdf/MySQL_Cluster_Ossfest11.pdf