My sql 5.6&MySQL Cluster 7.3

41
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1 <Insert Picture Here> MySQL 5.6 & MySQL Cluster 7.3 Overview Oleksii(Alexey) Porytskyi Senior Principal Consultant [email protected]

description

Slides from the MySQL Tech tour Russia

Transcript of My sql 5.6&MySQL Cluster 7.3

Page 1: My sql 5.6&MySQL Cluster 7.3

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 121

<Inser t Pic t ure Here>

MySQL 5.6 & MySQL Clust er 7 .3 Overv iew

Oleksii(Alexey) PorytskyiSenior Principal [email protected]

Page 2: My sql 5.6&MySQL Cluster 7.3

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

2

Safe Harbor Statement

The following is intended to outline our general product direction. It is intended for information

purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any

material, code, or functionality, and should not be relied upon in making purchasing decisions.The

development, release, and timing of any features or functionality described for Oracle’s products remains

at the sole discretion of Oracle.

Page 3: My sql 5.6&MySQL Cluster 7.3

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

3

Agenda – MySQL 5.6 New Features

• InnoDB• Performance

• Full-Text Search

• NoSQL

• Optimizer

• MySQL Improvements

• Replication

• Security

Page 4: My sql 5.6&MySQL Cluster 7.3

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

MySQL 5.5

MySQL 5.6

MySQL 5.6 SysBench Benchmarks

Up to 151% Performance Gain

Oracle Linux 6Intel(R) Xeon(R) E7540 x86_64MySQL leveraging:- 48 of 96 available CPU threads- 2 GHz, 512GB RAM

Page 5: My sql 5.6&MySQL Cluster 7.3

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

MySQL 5.5

MySQL 5.6

MySQL 5.6 SysBench Benchmarks

Up to 234% Performance Gain

Oracle Linux 6Intel(R) Xeon(R) E7540 x86_64MySQL leveraging:- 48 of 96 available CPU threads- 2 GHz, 512GB RAM

Page 6: My sql 5.6&MySQL Cluster 7.3

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

6

InnoDB

Page 7: My sql 5.6&MySQL Cluster 7.3

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

7

Performance - Online DDL

• DDL - SQL statements for changing database

• Automatically commit transactions

• Historically expensive

• 5.6 enhances optimized CREATE INDEX and DROP INDEX statements

• The ALTER TABLE process is much faster

Page 8: My sql 5.6&MySQL Cluster 7.3

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

8

Performance - Buffer Pool Pre-loading

• Load buffer pool at startup

• Load buffer pool on command (now)

• Dump buffer pool at shutdown

• Dump buffer pool now

1,2,3...

shutdown - list of pages dumped

12

3

12

start-up - list of pages reloaded

buffer pool buffer pool(list of pages from pool)

Page 9: My sql 5.6&MySQL Cluster 7.3

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

9

Performance - SSD Improvements

• 4k and 8k page sizes

• InnoDB Compression

• Portable .ibd (InnoDB data) files

• Separate tablespaces for the InnoDB UNDO log

Page 10: My sql 5.6&MySQL Cluster 7.3

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

10

Performance – Redo / Undo Logs

• Redo Logs:• Increased from 4GB to 512GB (1TB total)

• Improves performance of:

• write-heavy workloads

• long-running transactions

• Undo Logs:• Moves InnoDB UNDO out of system tablespace

• Good candidate to move to SSD

• I/O and memory optimization

Page 11: My sql 5.6&MySQL Cluster 7.3

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

11

Fulltext Search

mysql> SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);+----+-----------------------+-------------------------------------+| id | title | body |+----+-----------------------+-------------------------------------+| 1 | MySQL Tutorial | DBMS stands for DataBase ... || 3 | How To Use MySQL Well | After you went through a ... || 5 | Optimizing MySQL | In this tutorial we will show ... || 8 | 1001 MySQL Tricks | 1. Never run mysqld as root. 2. ... |+----+-----------------------+-------------------------------------+

• Fulltext search now in InnoDB

• Used with CHAR, VARCHAR or TEXT

Page 12: My sql 5.6&MySQL Cluster 7.3

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

12

NoSQL

• memcached as a daemon plugin of mysqld

• InnoDB handles memory caching

• ADD, SET, INCR stored to disk

Page 13: My sql 5.6&MySQL Cluster 7.3

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

13

Optimizer Improvements

• Subquery Optimizations

• Index Condition Pushdown

• File Sort Optimization • SELECT col1, ... FROM t1 ... • ORDER BY name LIMIT 10;

• Batched Key Access (BKA) and Multi-Range Read (MRR)

• Persistent Optimizer Stats

Page 14: My sql 5.6&MySQL Cluster 7.3

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

MySQL Improvements

14

Page 15: My sql 5.6&MySQL Cluster 7.3

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

15

Other MySQL Improvements

• Remote Binlog Backup

• Server UUID’s

• Fractional seconds for TIME, DATETIME, and TIMESTAMP

mysql> SELECT MICROSECOND('2010-12-10 14:12:09.219473');+-------------------------------------------+| MICROSECOND('2010-12-10 14:12:09.019473') |+-------------------------------------------+| 219473 |+-------------------------------------------+

Page 16: My sql 5.6&MySQL Cluster 7.3

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

16

MySQL Partition Import/Export• Exchange table partition/sub-partition with non-

partitioned table

• Rows in non-partitioned table must be in the range of partition/sub-partition

• Foreign keys not supported

• Triggers are not invoked

Page 17: My sql 5.6&MySQL Cluster 7.3

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

Replication

17

Page 18: My sql 5.6&MySQL Cluster 7.3

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

18

Replication I• Global Transaction ID’s (GTID’s)

• GTID Utilities

• Self-Healing Replication Clusters

• Multi-Threaded Slaves

• Binary Log Group Commit

• Time-delayed replication slaves

Page 19: My sql 5.6&MySQL Cluster 7.3

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

19

Replication II• Informational Log Events

• Optimized Row-Based Replication

• Crash Safe Slaves and Binlog

• Data Integrity - Replication Event Checksums

• New MySQL Replication Utilities

• mysqlfailover

• mysqlrpladmin

Page 20: My sql 5.6&MySQL Cluster 7.3

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

Security

20

Page 21: My sql 5.6&MySQL Cluster 7.3

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

21

MySQL Enterprise Audit

• Policy-based auditing

• Logging of connections, logins, query activity

• User defined policies, filtering and log rotation

• Dynamically enabled/disabled: no server restart

• XML-based audit stream

• Version MySQL 5.5.28 and higher

• Adds regulatory compliance to MySQL applications.

• HIPAA, Sarbanes-Oxley, PCI, etc.

Page 22: My sql 5.6&MySQL Cluster 7.3

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

22

MySQL Enterprise Audit Flow1. DBA Enables on Server1

2. User Joe Connects and Queries Server1

3. Joe’s connection, login and query logged

Page 23: My sql 5.6&MySQL Cluster 7.3

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

23

MySQL 5.6 Security Improvements I

•Storing authentication credentials in .mylogin.cnf# mysql_config_editor set --login-path=local \ --host=localhost --user=localuser --password

$ ls -la /var/root/.mylogin.cnf-rw------- 1 root wheel 136 Aug 8 15:15 .mylogin.cnf

$ file .*cnf.mylogin.cnf: data

Page 24: My sql 5.6&MySQL Cluster 7.3

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

24

MySQL 5.6 Security Improvements II

•Stronger encryption for user account passwords (SHA-256)[mysqld]default-authentication-plugin=sha256_password

Page 25: My sql 5.6&MySQL Cluster 7.3

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

25

MySQL 5.6 Security Improvements III•User password expired column (5.6.6)mysql> select host, user, password_expired from user where user = "WebUser" and host = ‘localhost’;+-------------+---------+------------------+| host | user | password_expired |+-------------+---------+------------------+| localhost | test | Y |+-------------+---------+------------------+root@MacBook-Tony:~$ mysql --host=localhost -utest -pEnter password: mysql> select 1;ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

Page 26: My sql 5.6&MySQL Cluster 7.3

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

26

MySQL 5.6 Security Improvements IV•Provision for establishing password security policyvalidate_password.so plugin[mysqld]plugin-load=validate_password.sovalidate-password=FORCE_PLUS_PERMANENTvalidate_password_policy_number = 2mysql> INSTALL PLUGIN validate_password SONAME 'validate_password.so';

mysql> SHOW VARIABLES LIKE 'validate_password%';+--------------------------------------+---------------+| Variable_name | Value |+--------------------------------------+---------------+| validate_password_dictionary_file | pass_dict.txt |

| validate_password_length | 8 || validate_password_mixed_case_count | 1 || validate_password_number_count | 1 || validate_password_policy_number | STRONG | | validate_password_special_char_count | 1 |+--------------------------------------+---------------+

(validate_password_policy_number = 2 must be set to a value of 2)

file is located in your data directory

Page 27: My sql 5.6&MySQL Cluster 7.3

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

27

MySQL 5.6 Security Improvements V

•SQL function - VALIDATE_PASSWORD_STRENGTH()

mysql> select VALIDATE_PASSWORD_STRENGTH ('test');+-------------------------------------+| VALIDATE_PASSWORD_STRENGTH ('test') |+-------------------------------------+| 25 |+-------------------------------------+mysql> select VALIDATE_PASSWORD_STRENGTH ('Wh4tAr3Y0u!');+--------------------------------------------+| VALIDATE_PASSWORD_STRENGTH ('Wh4tar3Y0u!') |+--------------------------------------------+| 100 |+--------------------------------------------+

Password Test ReturnValue

Length < 4 0Length ≥ 4 and < validate_password_length 25

Satisfies policy 1 (WEAK) 50

Satisfies policy 2 (MEDIUM) 75

Satisfies policy 3 (STRONG) 100

Page 28: My sql 5.6&MySQL Cluster 7.3

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

28

MySQL 5.6 Security Improvements VI

•Non-usable passwords fileecho “ilovepizza2!” > pass_dict.txt

mysql> CREATE USER 'test3'@'192.168.1.2' IDENTIFIED BY 'ilovepizza2!’;ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

Page 29: My sql 5.6&MySQL Cluster 7.3

Copyright © 2013, Oracle and/or its affiliates. All rights reserved | Oracle reserves the right to change the content and timing of all future releases29

Foreign Key Support Connection Thread Scalability NoSQL JavaScript for node.js

MySQL 5.6 Auto-Installer

Page 30: My sql 5.6&MySQL Cluster 7.3

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

MySQL Cluster 7.3: Foreign Keys• Brings MySQL Cluster to a broader range of workloads

• Packaged apps, custom projects• Adds powerful functionality while reducing complexity

• App logic & data model • Enabled by default• Enforced for SQL & NoSQL APIs• On-line add and drop

MySQL Cluster 7.3 Foreign Keys

Page 31: My sql 5.6&MySQL Cluster 7.3

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

MySQL Cluster 7.3: Foreign Keys• Implementation goal: compatibility with InnoDB

• Easy migration of solutions already working with InnoDB• Natively implemented in the storage engine• Created in SQL• Enforced in SQL & NoSQL

• C++, ClusterJ, memcached, node.js

MySQL Cluster 7.3 Foreign Keys

http://www.clusterdb.com/mysql-cluster/foreign-keys-in-mysql-cluster/

Page 32: My sql 5.6&MySQL Cluster 7.3

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

Foreign Keys - Examplemysql> 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 constraint violated: Referenced row exists' from NDB |

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

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

Foreign Keys-Example

Page 33: My sql 5.6&MySQL Cluster 7.3
Page 34: My sql 5.6&MySQL Cluster 7.3

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

Storage Engine CompatibilityInnoDB MyISAM MySQL Clust er

Fore ign K eys ✔ ✖ ✔

CASCADE ✔ N/A ✔

UPDATE ✔ N/A No PK UPDATE

DELETE ✔ N/A ✔

RESTRICT ✔ N/A ✔

NO ACTION Same as RESTRICT N/A Deferred Check

SET NULL ✔ N/A ✔

Storage Engine Compability

Page 35: My sql 5.6&MySQL Cluster 7.3

35

MySQL Cluster 7.3: NoSQL Access to data

MySQL Clust er Dat a Nodes

Page 36: My sql 5.6&MySQL Cluster 7.3

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

MySQL Cluster 7.3: NoSQL API

• Native JavaScript access to MySQL Cluster

• End-to-End JavaScript: browser to the app & DB

• Storing and retrieving JavaScript objects directly in MySQL Cluster

• Eliminate SQL transformation• Implemented as a module for node.js

• Integrates Cluster API library within the web app

• Optionally routes through MySQL Server

MySQL Cluster 7.3 – Node.js

Page 37: My sql 5.6&MySQL Cluster 7.3

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

InnoDB vs NDB ConsiderationsInnoDB NDB/Clus t er

Fore ign K eys ✔ ✔

Max Row Size 64K 14K

Table Par t i t ion ing Range, List, Key, Hash Key only

Aut o-shard ing X ✔

Min num of servers 1 3

NoSQL Ac c ess memcache NDBAPI (C/C++)memcache

node.js (JavaScript)ClusterJ (Java)

mod_ndb (Apache module)

InnoDB vs NDB Considerations

Page 38: My sql 5.6&MySQL Cluster 7.3

Copyright © 2013, Oracle and/or its affiliates. All rights reserved | Oracle reserves the right to change the content and timing of all future releases38

MSQL Cluster 7.3: MySQL 5.6 Support

Select storage engine per table–InnoDB

Large Rows, DSS Queries, FTS

–NDB/Cluster Auto-sharding, real-time, HA

Uses latest MySQL 5.6 Server–Enhanced Optimizer–Replication Checksums–Time-Delayed Replication

MySQL Cluster NDB Storage Engine

Local InnoDB Tables

Local InnoDB Tables

MySQL Cluster 7.3 – MySQL 5.6 Support

Page 39: My sql 5.6&MySQL Cluster 7.3

Copyright © 2013, Oracle and/or its affiliates. All rights reserved | Oracle reserves the right to change the content and timing of all future releases39

Increases throughput of each connection to the data layerIncreases cluster scalability–Each connection consumes one of 256 node ids

Up to 8x higher performance per connection–SQL & NoSQL interfaces

MySQL Cluster Data Nodes

MySQL Cluster Data Nodes

Wit h Connec t ion Thread Sc a labi l i t y

MySQL Cluster 7.3 – Connection Thread Scalability

Page 40: My sql 5.6&MySQL Cluster 7.3

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

• Fast configuration• Auto-discovery• Workload optimized• Repeatable best

practices• MySQL Cluster 7.2

& 7.3

Specify Workload Auto-Discover

Define TopologyDeploy

MySQL Cluster 7.3 Auto-Installer

Page 41: My sql 5.6&MySQL Cluster 7.3

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

41

Questions?