SlideShare a Scribd company logo
1 of 88
Download to read offline
MySQL Fabric 
Tutorial 
Lars Thalmann, Development Director 
Narayanan Venkateswaran, Principal Software Engineer 
Mats Kindahl, Sr. Principal Software Engineer 
Copyright © 2014, Oracle and/or its affiliates. AAllll All rriigghhttss rights rreesseerrvveedd.. reserved. 
||
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. 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
2014-10-02
Tutorial Outline 
1 What is MySQL Fabric? 
2 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
3 
4 
5 
Downloading and Installing 
High Availability 
Sharding 
Closing Remarks
What is MySQL Fabric? 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
What is MySQL Fabric? 
An extensible and easy-to-use 
framework for managing 
a farm of MySQL servers 
supporting high-availability 
and sharding 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
What does all that mean? 
● Management System 
– Manages a MySQL Farm 
– Distributed Framework 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
● Framework 
– Procedure execution 
– State store 
– Transaction Routing 
● Extensible 
– Extensions are first-class 
– High-availability groups 
– “Semi-automatic” sharding 
● Written in Python 
● Latest Release 1.5.2 GA 
● Open Source 
– You can participate 
– Suggest features 
– Report bugs 
– Contribute patches 
● MySQL 5.6 is focus
Birds-eye View 
Application 
SQL 
Connector 
Connector 
Connector 
High Availability Groups 
SQL 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Operator 
MySQL 
Fabric 
Node 
Database 
Servers
Downloading & Installing 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Download & Install 
● Download MySQL Connector Python 
– http://dev.mysql.com/downloads/connector/python/ 
– This connector is needed for MySQL Fabric 
● Download MySQL Utilities 
– http://dev.mysql.com/downloads/utilities/ 
– MySQL Fabric is part of the MySQL Utilities release 
● Install MySQL Connector Python 
– For Ubuntu, simply click on the downloaded deb package 
● Install MySQL Utilities 
– For Ubuntu, simply click on the downloaded deb package 
– Note that MySQL Connector Python must be installed before this step 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Download & Install 
● Install MySQL Server 5.6 
– For Ubuntu 14.04, just two commands: 
● sudo apt-get install mysql-client-core-5.6 
● sudo apt-get install mysql-server-5.6 
– MySQL 5.6 server is needed for the MySQL Fabric backing store 
– For the rest of the tutorial, we will assume that you have this server running 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Starting MySQL Fabric 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Starting Fabric 
$ mysqlfabric 
Usage: mysqlfabric [­­param, 
­­config] 
<grp> <cmd> [arg, ...]. 
MySQL Fabric 1.5.2 ­MySQL 
server farm management framework 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Options: 
­­version 
show program's version number and exit 
­h, 
­­help 
show this help message and exit 
­­param= 
CONFIG_PARAMS 
Override a configuration parameter. 
­­config= 
FILE Read configuration from FILE. 
Basic commands: 
help <grp> <cmd> Show help for command 
help commands List all commands 
help groups List all groups
Getting Help 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Getting Help 
$ mysqlfabric help groups 
Available groups: statistics, group, dump, manage, 
server, role, user, threat, sharding, event 
$ mysqlfabric help group 
Commands available in group 'group' are: 
group activate group_id [­­synchronous] 
group description group_id [­­description= 
NONE] [­­synchronous] 
group deactivate group_id [­­synchronous] 
group create group_id [­­description= 
NONE] [­­synchronous] 
group remove group_id server_id [­­synchronous] 
group add group_id address [­­timeout= 
5] [­­update_ 
only] [­­synchronous] 
group health group_id 
group lookup_servers group_id [­­server_ 
id=NONE] [­­status= 
NONE] [­­mode= 
NONE] 
group destroy group_id [­­force] 
[­­synchronous] 
group demote group_id [­­update_ 
only] [­­synchronous] 
group promote group_id [­­slave_ 
id=NONE] [­­update_ 
only] [­­synchronous] 
group lookup_groups [­­group_ 
id=NONE]
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Getting Help 
$ mysqlfabric help group demote 
group demote group_id [­­update_ 
only] [­­synchronous] 
Demote the current master if there is one. 
If users just want to update the state store and skip provisioning 
steps such as configuring replication, the update_only parameter 
must be set to true. Otherwise any write access to the master is 
blocked, slaves are synchronized with the master, stopped and 
their replication configuration reset. Note that no slave is 
promoted as master.
Configuring 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
MySQL Fabric Users 
● Backing Store User 
– The user identity that Fabric will use to modify the backing store 
– Can be configured in /etc/mysql/fabric.cfg [storage] 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
● Server User 
– The user identity used to connect to managed MySQL Servers 
– Can be configured in /etc/mysql/fabric.cfg [servers] 
● Admin user 
– The user identity used to control MySQL Fabric 
– Can be configured in /etc/mysql/fabric.cfg [protocol.xmlrpc] 
● Invoked client tools user 
– The user identity used to connect to managed MySQL Servers via Fabric-invoked command-line tools 
– Can be configured in /etc/mysql/fabric.cfg [protocol.xmlrpc]
Configuring the backing store 
● On the MySQL Backing Store Server 
– Create a Backing Store user on the backing store MySQL Server 
– Grant access for the user to the “fabric” database 
lars@silver3:~$ mysql ­u 
root 
mysql> CREATE USER 'fabric'@'localhost' IDENTIFIED BY 'SECRET'; 
mysql> GRANT ALL ON fabric.* TO 'fabric'@'localhost'; 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Original 
lars@silver3:~$ sudo emacs /etc/mysql/fabric.cfg 
[DEFAULT] 
prefix = 
sysconfdir = /etc 
logdir = /var/log 
[storage] 
address = localhost:3306 
user = fabric 
password = 
database = fabric 
auth_plugin = mysql_native_password 
connection_timeout = 6 
connection_attempts = 6 
connection_delay = 1 
[servers] 
user = fabric 
password = 
[protocol.xmlrpc] 
address = localhost:32274 
threads = 5 
user = admin 
password = 
disable_authentication = no 
realm = MySQL Fabric 
ssl_ca = 
ssl_cert = 
ssl_key = 
[executor] 
executors = 5 
[logging] 
level = INFO 
url = file:///var/log/fabric.log 
[sharding] 
mysqldump_program = /usr/bin/mysqldump 
mysqlclient_program = /usr/bin/mysql 
[statistics] 
prune_time = 3600 
[failure_tracking] 
notifications = 300 
notification_clients = 50 
notification_interval = 60 
failover_interval = 0 
detections = 3 
detection_interval = 6 
detection_timeout = 1 
prune_time = 3600 
[connector] 
ttl = 1 
[client] 
password =
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Edited 
lars@silver3:~$ sudo emacs /etc/mysql/fabric.cfg 
[DEFAULT] 
prefix = 
sysconfdir = /etc 
logdir = /var/log 
[storage] 
address = localhost:3306 
user = fabric 
password = SECRET 
database = fabric 
auth_plugin = mysql_native_password 
connection_timeout = 6 
connection_attempts = 6 
connection_delay = 1 
[servers] 
user = fabric 
password = 
[protocol.xmlrpc] 
address = localhost:32274 
threads = 5 
user = admin 
password = 
disable_authentication = yes 
realm = MySQL Fabric 
ssl_ca = 
ssl_cert = 
ssl_key = 
[executor] 
executors = 5 
[logging] 
level = INFO 
url = file:///var/log/fabric.log 
[sharding] 
mysqldump_program = /usr/bin/mysqldump 
mysqlclient_program = /usr/bin/mysql 
[statistics] 
prune_time = 3600 
[failure_tracking] 
notifications = 300 
notification_clients = 50 
notification_interval = 60 
failover_interval = 0 
detections = 3 
detection_interval = 6 
detection_timeout = 1 
prune_time = 3600 
[connector] 
ttl = 1 
[client] 
password =
Creating the backing store 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Creating the backing store 
● Create the database storing info for MySQL Fabric 
– Since we have disabled authentication for this tutorial, admin/xmlrpc 
password will actually not be used for anything 
$ mysqlfabric manage setup 
[INFO] 1411584079.046989 ­MainThread 
­Initializing 
persister: 
user (fabric), server (localhost:3306), database (fabric). 
Finishing initial setup 
======================= 
Password for admin user is not yet set. 
Password for admin/xmlrpc: 
Repeat Password: 
Password set. 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
A deeper look into the architecture 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Birds-eye View 
Application 
SQL 
Connector 
Connector 
Connector 
High Availability Groups 
SQL 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Operator 
MySQL 
Fabric 
Node 
Database 
Servers
High-Level Components 
● Fabric-aware Connectors 
– Python, PHP, Java, .NET, C 
– Enhanced Connector API 
● MySQL Fabric Node 
– Manage information about farm 
– Provide status information 
– Execute procedures 
● MySQL Servers 
– Organized in high-availability 
groups 
– Handling application data 
Application Connector 
High Availability 
Group 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Connector 
Connector 
MySQL 
Fabric 
Node
MySQL Fabric Node Architecture 
Connector ? 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
MySQL 
MySQL Fabric 
Framework 
Executor State Store 
(Persister) 
Sh 
? 
HA 
AMQP MySQL-RPC XML-RPC 
Connector 
Connector 
Protocols 
Extensions 
Backing 
Store
Starting the Fabric server 
● MySQL Fabric will be run in the foreground 
– You can also run as deamon in the backgroud, using --deamonize 
$ mysqlfabric manage start 
[INFO] 1411822940.181810 ­MainThread 
­Initializing 
persister: user (root), 
server (localhost:13000), database (fabric). 
[INFO] 1411822940.188654 ­MainThread 
­Loading 
Services. 
[WARNING] 1411822940.198591 ­MainThread 
­Authentication 
disabled 
[INFO] 1411822940.198668 ­MainThread 
­MySQL­RPC 
protocol server started, 
listening on localhost:32275 
[WARNING] 1411822940.198773 ­MainThread 
­Authentication 
disabled 
[INFO] 1411822940.212181 ­MainThread 
­Executor 
started. 
[INFO] 1411822940.215672 ­MainThread 
­Starting 
failure detector. 
[INFO] 1411822940.216747 ­XML­RPC­Server 
­XML­RPC 
protocol server ('127.0.0.1', 32274) 
started. 
[INFO] 1411822940.217083 ­XML­RPC­Server 
­Setting 
1 XML­RPC 
session(s). 
[INFO] 1411822940.217331 ­XML­RPC­Session­0 
­Started 
XML­RPC­Session. 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
High Availability 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
High-Availability Concepts 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
● Redundancy 
– Duplicate components 
● Monitoring 
– Detecting failing components 
– Monitor load 
● Procedures 
– Activate replacements 
– Distribute load
Using the Fabric client 
● Create a High Availability group 
– The Fabric client will connect to the Fabric server that is configured in the 
Fabric.cfg file 
$ mysqlfabric group create "group­1" 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
uuid finished success result 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­254f8b62­8ea9­4350­a46e­77fefafc0f41 
1 1 1 
state success when description 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­3 
2 1411822993.11 Triggered by <mysql.fabric.events.Event object at 0x7fbdef77aa50>. 
4 2 1411822993.12 Executing action (_create_group). 
5 2 1411822993.12 Executed action (_create_group).
Add a MySQL server to the group 
● The MySQL server is now managed by MySQL Fabric 
$ mysqlfabric group add group­1 
localhost:13001 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
uuid finished success result 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­bb73e411­0705­47dd­86f9­b99798c97c9c 
1 1 1 
state success when description 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­3 
2 1411823050.61 Triggered by <mysql.fabric.events.Event object at 0x7fbdef77ae10>. 
4 2 1411823050.61 Executing action (_add_server). 
5 2 1411823050.62 Executed action (_add_server).
Add a second MySQL server to the group 
● The MySQL servers are now managed by MySQL 
Fabric 
$ mysqlfabric group add group­1 
localhost:13002 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
uuid finished success result 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­feba445d­47bd­4681­a8b8­8ae88d1d12a3 
1 1 1 
state success when description 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­3 
2 1411823077.84 Triggered by <mysql.fabric.events.Event object at 0x7fbdef77ae10>. 
4 2 1411823077.84 Executing action (_add_server). 
5 2 1411823077.85 Executed action(_add_server).
Listing the MySQL servers of the group 
● Two servers in the high availability group 
$ mysqlfabric group lookup_servers group­1 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
server_uuid address status mode weight 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­1906aa45­4646­11e4­926f­e82aea9348c9 
localhost:13001 SECONDARY READ_ONLY 1.0 
1937e215­4646­11e4­926f­e82aea9348c9 
localhost:13002 SECONDARY READ_ONLY 1.0
Promote a server to master 
● Will pick the “best” server of the group 
– Since the servers are empty, this will be a random choice 
$ mysqlfabric group promote group­1 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
uuid finished success result 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­4295faef­e6e1­4df1­9493­1b9b9cdc3a48 
1 1 1 
state success when description 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­3 
2 1411823267.15 Triggered by <mysql.fabric.events.Event object at 0x7fbdef4615d0>. 
4 2 1411823267.15 Executing action (_define_ha_operation). 
5 2 1411823267.16 Executed action (_define_ha_operation).
Promote a specific server to become the master 
● The server specified with --slave-id will be the 
master 
$ mysqlfabric group promote group­1 
­­slave_ 
id=1906aa45­4646­11e4­926f­e82aea9348c9 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
uuid finished success result 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­4295faef­e6e1­4df1­9493­1b9b9cdc3a48 
1 1 1 
state success when description 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­3 
2 1411823267.15 Triggered by <mysql.fabric.events.Event object at 0x7fbdef4615d0>. 
4 2 1411823267.15 Executing action (_define_ha_operation). 
5 2 1411823267.16 Executed action (_define_ha_operation).
Using the High Availability Group 
of the farm 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Birds-eye View 
Application 
SQL 
Connector 
Connector 
Connector 
High Availability Groups 
XML-RPC 
MySQL-RPC 
SQL 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Operator 
MySQL 
Fabric 
Node 
Database 
Servers
MySQL Connector Python 
● There is also Java, PHP, Connector/C (labs), .Net 
– And support for frameworks Doctrine, Hibernate 
import mysql.connector 
from mysql.connector import fabric 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Create a table in the group 
● Connect to Fabric, not to MySQL servers directly 
conn = mysql.connector.connect( 
fabric={"host" : "localhost", "port" : 32274, 
"username": "admin", "password" : "", 
'report_errors': True 
}, 
user="root", password="", autocommit=True) 
conn.set_property(group="group­1", 
mode=fabric.MODE_READWRITE) 
cur = conn.cursor() 
cur.execute("CREATE DATABASE IF NOT EXISTS employees") 
cur.execute("USE employees") 
cur.execute("DROP TABLE IF EXISTS employees") 
cur.execute( 
"CREATE TABLE employees (" 
" emp_no INT, first_name CHAR(40), last_name CHAR(40)" 
")") 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Insert data into the group 
● Specifying it is for group-1, read-write transaction 
def add_employee(conn, emp_no, first_name, last_name): 
conn.set_property(group="group­1", 
mode=fabric.MODE_READWRITE) 
cur = conn.cursor() 
cur.execute("USE employees") 
cur.execute( 
"INSERT INTO employees VALUES (%s, %s, %s)", 
(emp_no, first_name, last_name) 
) 
# We need to keep track of what we have executed in order to, 
# at least, read our own updates from a slave. 
cur.execute("SELECT @@global.gtid_executed") 
for row in cur: 
print "Transactions executed on the master", row[0] 
return row[0] 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Select data from the group 
● Specifying that it is group-1, and that this is a 
read-only transaction 
def find_employee(conn, emp_no, gtid_executed): 
conn.set_property(group="group­1", 
mode=fabric.MODE_READONLY) 
cur = conn.cursor() 
# Guarantee that a slave has applied our own updates before 
# reading anything. 
cur.execute( 
"SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('%s', 0)" % 
(gtid_executed, )) 
for row in cur: 
print "Had to synchronize", row, "transactions." 
cur.execute("USE employees") 
cur.execute( 
"SELECT first_name, last_name FROM employees " 
"WHERE emp_no = %s", (emp_no, )) 
for row in cur: 
print "Retrieved", row 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Failure Detection 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
● Monitors servers within each group 
Application Connector 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
Failure Detector 
Fabric Monitoring 
● On master failure, 
– mark server as faulty, and 
– trigger fail-over 
● On slave failure, 
– mark as faulty 
Jan 2010 
High Availability 
Group 
Connector 
Connector 
MySQL 
Fabric 
Node
Failure Detector (fabric.cfg) 
Fabric Monitoring 
2x Engineering Staf 
3x QA Staf 
2x Support Staf 
Jan 2010 Sept 2014 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
[failure_tracking] 
detections = 3 
detection_interval = 6 
detection_timeout = 1 
detections 
The number of times a server fails alive checks, before being marked as FAULTY. 
detection_interval 
Time between alive checks. 
detection_timeout 
The time after which a server alive ping timeouts.
Distributed Failure Reporting 
● Connector reports error to Fabric 
● Error used to update backing store 
Application Connector 
Jan 2010 Sept 2014 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
● Trigger fail-over 
– Error count reaches threshold 
High Availability 
Group 
Connector 
Connector 
MySQL 
Fabric 
Node
Distributed Failure Reporting (fabric.cfg) 
2x Engineering Staf 
3x QA Staf 
2x Support Staf 
Jan 2010 Sept 2014 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
[failure_tracking] 
notifications = 300 
notification_clients = 50 
notification_interval = 60 
failover_interval = 0 
prune_time = 3600 
notifications 
The number of error notifications required to mark a server FAULTY. 
notification_clients 
The number of clients that need to report an error to mark a server FAULTY.
Distributed Failure Reporting (fabric.cfg) 
notification_interval 
The interval of interest in which we want to verify error notifications. 
failover_interval 
The interval at which we can safely do a failover in a group without causing system 
instability. 
prune_time 
Interval at which we need to prune the error logs. 
2x Engineering Staf 
3x QA Staf 
2x Support Staf 
Jan 2010 Sept 2014 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Distributed Failure Reporting (Connector) 
Enabling Error Reporting 
● The option to report errors is part of the Fabric configuration 
2x Engineering Staf 
3x QA Staf 
2x Support Staf 
● “report_errors” can be turned on as follows 
● Causes a connector-server connection error to be reported to Fabric 
Jan 2010 Sept 2014 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
fabric_config = { 
'host': .., 
'report_errors': True, 
} 
cnx = mysql.connector.connect(fabric=fabric_config)
Distributed Failure Reporting (Connector) 
Error Reporting 
● The following errors are reported by default 
REPORT_ERRORS = ( 
errorcode.CR_SERVER_LOST, 
errorcode.CR_SERVER_GONE_ERROR, 
errorcode.CR_CONN_HOST_ERROR, 
errorcode.CR_CONNECTION_ERROR, 
errorcode.CR_IPSOCK_ERROR, 
) 
● The above can be extended by setting extra_failure_report 
from mysql.connector.fabric import extra_failure_report 
extra_failure_report([error_code_0, error_code_1, ...]) 
Jan 2010 Sept 2014 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Distributed Failure Reporting (Connectors) 
Cache Invalidation 
2x Engineering Staf 
3x QA Staf 
2x Support Staf 
● Define which errors cause invalidation of the connector cache 
● The following errors cause a cache invalidation by default 
RESET_CACHE_ON_ERROR = ( 
errorcode.CR_SERVER_LOST, 
errorcode.ER_OPTION_PREVENTS_STATEMENT, 
) 
Jan 2010 Sept 2014 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
● The above can be extended by 
from mysql.connector.fabric import RESET_CACHE_ON_ERROR 
RESET_CACHE_ON_ERROR.append(error_code_0)
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Sharding
Birds-eye View 
Application 
SQL 
Connector 
Connector 
Connector 
High Availability Groups 
XML-RPC 
MySQL-RPC 
SQL 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Operator 
MySQL 
Fabric 
Node 
Database 
Servers
Creating a sharding definition 
● In this example, we use Hash sharding 
– Fabric also supports Range sharding 
– This will define Group-1 as the “global group” of the shard definition 
– Group-1 is not a shard 
– All shard groups that are added, will be slave groups to the global group 
$ mysqlfabric sharding create_definition HASH group­1 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
uuid finished success result 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­90bbd7a7­8996­4a5a­a971­32d10e3591c4 
1 1 1
List the sharding definitions 
● The created sharding definition has identifier 1 
$ mysqlfabric dump shard_maps 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
mapping_id type_name global_group_id 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­1 
HASH group­1 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Register a table to the sharding definition 
● Table “db1.t1” to be sharded according to 
definition “1” 
– The table will be created later 
– The column “emp_no” will be used as the sharding key 
$ mysqlfabric sharding add_table 1 db1.t1 emp_no 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
uuid finished success result 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­57aa21ef­1315­4da7­8295­aa2a0f4339e0 
1 1 1
Add shards (groups) to the sharding definition 
● Add two groups as shards 
– Global Group: group-1 
– Shards: group-2 and group-3 
– --state=ENABLED will start replication 
$ mysqlfabric sharding add_shard 1 group­2, 
group­3 
­­state= 
ENABLED 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
uuid finished success result 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­f1e2d884­1d67­4a3a­b5d2­5b29b2a6d451 
1 1 1
What do we have now? 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
● The groups 
– One global group 
– Two shards
Using the Global Group 
of the farm 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Create a table (on all shards) 
● Use the global group (SCOPE_GLOBAL) 
– Afterwards set back to the default, i.e. SCOPE_LOCAL 
– The properties are for the connection, not only for a single transaction 
conn.set_property(tables=["db1.t1"], scope=fabric.SCOPE_GLOBAL, 
mode=fabric.MODE_READWRITE) 
cur = conn.cursor() 
cur.execute("CREATE DATABASE IF NOT EXISTS db1") 
cur.execute("USE db1") 
cur.execute("DROP TABLE IF EXISTS t1") 
cur.execute( 
"CREATE TABLE t1 (" 
" emp_no INT, " 
" first_name CHAR(40), " 
" last_name CHAR(40)" 
")") 
conn.set_property(scope=fabric.SCOPE_LOCAL) 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Table propagated to all groups 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
● The table 
– First created on the global group 
– Then replicated to the two shards
Using the Sharding Groups 
of the farm 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Inserting into the shards 
● Using the table name and the sharding key 
def add_employee(conn, emp_no, first_name, last_name, gtid_executed): 
conn.set_property(tables=["db1.t1"], key=emp_no, 
mode=fabric.MODE_READWRITE, 
scope=fabric.SCOPE_LOCAL) 
cur = conn.cursor() 
synchronize(cur, gtid_executed) 
cur.execute("USE db1") 
cur.execute( 
"INSERT INTO t1 VALUES (%s, %s, %s)", 
(emp_no, first_name, last_name) 
) 
conn.commit() 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Select data from the shards 
● Using the table name and the sharding key 
– Will only execute this on the correct shard 
def find_employee(conn, emp_no, gtid_executed): 
conn.set_property(tables=["db1.t1"], key=emp_no, 
mode=fabric.MODE_READONLY) 
cur = conn.cursor() 
synchronize(cur, gtid_executed) 
cur.execute("USE db1") 
for row in cur: 
print "Had to synchronize", row, "transactions." 
cur.execute( 
"SELECT first_name, last_name FROM t1 " 
"WHERE empno = %s", (emp_no, ) 
) 
for row in cur: 
print row 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Shard split 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Create a new group with MySQL servers 
● Creating the 4th group 
● Adding two servers 
● Promote one of them to master 
$ mysqlfabric group create "group­4" 
$ mysqlfabric group add group­4 
localhost:13007 
$ mysqlfabric group add group­4 
localhost:13008 
$ mysqlfabric group promote group­4 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Sharding information 
● Two shards 1, 2 
● Hosted on two groups “group-2” and “group-3” 
$ mysqlfabric dump sharding_information 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
schema_name table_name column_name lower_bound shard_id type_name group_id global_group 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­db1 
t1 empno E6416... 1 HASH group­2 
group­1 
db1 t1 empno DC3AD... 2 HASH group­3 
group­1 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Check how much data we have 
● Checking on a MySQL server (shard 1 on “group-2”) 
directly 
mysql> use db1; 
Reading table information for completion of table and column names 
You can turn off this feature to get a quicker startup with ­A 
Database changed 
mysql> select count(empno) from t1; 
+­­­­­­­­­­­­­­+ 
| count(empno) | 
+­­­­­­­­­­­­­­+ 
| 1009 | 
+­­­­­­­­­­­­­­+ 
1 row in set (0.00 sec) 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Split the shard into two shards 
● Part of shard 1 (“group-2”) moved to “group-4” 
$ mysqlfabric sharding split_shard 1 group­4 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
uuid finished success result 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­80788beb­be2f­4b26­84f5­20bb2964ff70 
1 1 1 
state success when description 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­4 
2 1411863534.16 Executing action (_check_shard_information). 
4 2 1411863534.17 Executing action (_backup_source_shard). 
4 2 1411863534.25 Executing action (_restore_shard_backup). 
4 2 1411863534.37 Executing action (_setup_replication). 
4 2 1411863534.39 Executing action (_setup_sync). 
4 2 1411863534.4 Executing action (_setup_resharding_switch). 
4 2 1411863535.45 Executing action (_prune_shard_tables_after_split).
How much data after the split? 
● Checking on a MySQL server (shard 1 on “group-2”) 
directly 
mysql> use db1; 
Reading table information for completion of table and column names 
You can turn off this feature to get a quicker startup with ­A 
Database changed 
mysql> select count(empno) from t1; 
+­­­­­­­­­­­­­­+ 
| count(empno) | 
+­­­­­­­­­­­­­­+ 
| 532 | 
+­­­­­­­­­­­­­­+ 
1 row in set (0.00 sec) 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Looking up servers responsible for sharding key 
● For any sharding key, you can check which servers 
are responsible 
$ mysqlfabric sharding lookup_servers db1.t1 42000 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
server_uuid address status mode weight 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­83f2dd4f­46a1­11e4­94c4­e82aea9348c9 
localhost:13007 SECONDARY READ_ONLY 1.0 
8426dd92­46a1­11e4­94c4­e82aea9348c9 
localhost:13008 PRIMARY READ_WRITE 1.0
Shard move 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Create a new group with MySQL servers 
● Creating the 5th group 
● Adding two servers 
● Promote one of them to master 
$ mysqlfabric group create "group­5" 
$ mysqlfabric group add group­5 
localhost:13009 
$ mysqlfabric group add group­5 
localhost:13010 
$ mysqlfabric group promote group­5 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Looking up servers for a sharding key 
● For any sharding key, you can check which servers 
are responsible (Ports 13007, 13008 = “group-4”) 
$ mysqlfabric sharding lookup_servers db1.t1 42000 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
server_uuid address status mode weight 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­83f2dd4f­46a1­11e4­94c4­e82aea9348c9 
localhost:13007 SECONDARY READ_ONLY 1.0 
8426dd92­46a1­11e4­94c4­e82aea9348c9 
localhost:13008 PRIMARY READ_WRITE 1.0
Perform the shard move 
● Move shard “4” to “group-5” 
$ mysqlfabric sharding move_shard 4 group­5 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
… 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Verify the move 
● Afterwards, check which servers are responsible 
(Ports 13009, 13010 = “group-5”) 
$ mysqlfabric sharding lookup_servers db1.t1 42000 
Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e 
Time­To­Live: 
1 
server_uuid address status mode weight 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­8489b2ff­46a1­11e4­94c4­e82aea9348c9 
localhost:13009 SECONDARY READ_ONLY 1.0 
84bc4d59­46a1­11e4­94c4­e82aea9348c9 
localhost:13010 PRIMARY READ_WRITE 1.0
Fabric Executor 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
MySQL Fabric executor 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
● Event driven 
– Events will trigger execution of procedures 
– Procedures can trigger events themselves 
– Each step of a procedure is called a job 
● Procedures 
– Written in Python 
– Interacts with servers 
– Write state changes into backing store 
– Lock manager for conflict resolution 
● Conservative two-phase locking strategy 
● Avoid deadlocks 
Queue 
Backing 
Store 
Events
Automatically adding a server to a group 
● Register procedure for event 
– @on_event decorator 
– Accept event to register for 
● Fetch the group the server 
belonged to 
● Fetch a new server from the 
provider 
● Add the server to the group 
@on_event(SERVER_LOST) 
def _add_server(group_id, server_uuid): 
group = Group.fetch(group_id) 
machines = PROVIDER.create_machines( 
parameters 
) 
server = MySQLServer( 
server_uuid, address 
) 
MySQLServer.add(server) 
group.add(server) 
_configure_as_slave(server) 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
MySQL Fabric procedure execution 
● Before starting a job: 
– Acquire the necessary locks 
– Checkpoint execution state in backing store 
– Start a transaction on the backing store 
● When executing job: 
– Make updates to backing store inside transaction 
– Interact with servers 
● After executing a job: 
– Mark job completed in internal log 
– Commit transaction on backing store 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Queue 
Backing 
Store 
Events 
What about crashes?
MySQL Fabric executor recovery 
● Two types of jobs: 
– Idempotent: Restart the job 
– Not idempotent: Execute compensation 
● Recovery procedure 
– Start the executor 
– Collect unfinished checkpoints 
– Execute compensation activity for each job 
associated with the checkpoint 
… if there is one 
– Re-schedule each job 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
Queue 
Backing 
Store 
Events
Defining an compensation procedure 
● Use the @undo decorator 
● Compensating action 
– Search for the machine by UUID 
– Give it back to provider 
● Compensating actions 
shall succeed 
@_add_server.undo 
def _undo_add_srv(group_id, server_uuid): 
meta_filters = { 
'mysql­fabric­machine­group­uuid': 
server_uuid 
} 
machines = MANAGER.search_machines( 
{}, meta_filters 
) 
for machine in machines: 
MANAGER.destroy_machine( 
machine.uuid 
) 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Going Forward 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
What do we have now? 
● High-availability 
– Group Concept 
– Slave promotion 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
● Sharding 
– Range and hash sharding 
– Shard move and shard split 
● Connector APIs 
– Transaction properties 
– “Virtual” connections 
● Cloud integration 
– “Server providers” 
– OpenStack Nova 
● Enhanced connectors 
– Connector/Python 
– Connector/PHP 
– Connector/J 
– Connector/NET 
● Interfaces 
– Command-line 
– XML-RPC 
– MySQL-RPC 
● Distributed failure detector 
– Connectors report failures 
– Custom failure detectors 
● Credentials 
– RFC 2617 
– SSL support
Reading for the Interested 
● MySQL Forum: Fabric, Sharding, HA, Utilities 
http://forums.mysql.com/list.php?144 
● MySQL Fabric Documentation 
http://dev.mysql.com/doc/mysql-utilities/1.4/en/fabric.html 
● Migrating From an Unsharded to a Sharded Setup 
http://vnwrites.blogspot.com/2013/09/mysqlfabric-sharding-migration.html 
● Configuring and running MySQL Fabric 
http://alfranio-distributed.blogspot.com/2014/03/mysqlfabric-installation.html 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Want to contribute? 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 
● Check it 
– … and send us use-case and feature suggestions 
● Test it 
– … and send comments to the forum 
● Break it 
– … and send in bugs to http://bugs.mysql.com
Keeping in Touch 
Lars Thalmann 
Twitter: @larsthalmann 
http://larsthalmann.blogspot.com 
Mats Kindahl 
Twitter: @mkindahl 
http://mysqlmusings.blogspot.com 
Alfranio Correia 
Twitter: @alfranio 
http://alfranio-distributed.blogspot.com 
Narayanan Venkateswaran 
Twitter: @vn_tweets 
http://vnwrites.blogspot.com 
Geert Vanderkelen 
Twitter: @geertjanvdk 
http://geert.vanderkelen.org 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
MySQL Central Sessions 
● Elastic Scalability in MySQL Fabric with OpenStack 
Thursday, Oct 2, 1:15 PM-2:00 PM 
Moscone South, 252 
● MySQL Fabric: High Availability at Different Levels 
Wednesday, Oct 1, 2:00 PM-2:45 PM 
Moscone South, 250 
Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
Safe Harbor Statement 
The preceding 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. 
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 
2014-10-02

More Related Content

What's hot

MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMario Beck
 
High-Availability using MySQL Fabric
High-Availability using MySQL FabricHigh-Availability using MySQL Fabric
High-Availability using MySQL FabricMats Kindahl
 
MySQL High Availability: Managing Farms of Distributed Servers (MySQL Fabric)
MySQL High Availability: Managing Farms of Distributed Servers (MySQL Fabric)MySQL High Availability: Managing Farms of Distributed Servers (MySQL Fabric)
MySQL High Availability: Managing Farms of Distributed Servers (MySQL Fabric)Alfranio Júnior
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQLTed Wennmark
 
Why MySQL High Availability Matters
Why MySQL High Availability MattersWhy MySQL High Availability Matters
Why MySQL High Availability MattersMatt Lord
 
MySQL Group Replication - an Overview
MySQL Group Replication - an OverviewMySQL Group Replication - an Overview
MySQL Group Replication - an OverviewMatt Lord
 
MySQL for Software-as-a-Service (SaaS)
MySQL for Software-as-a-Service (SaaS)MySQL for Software-as-a-Service (SaaS)
MySQL for Software-as-a-Service (SaaS)Mario Beck
 
Python Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesPython Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesMats Kindahl
 
MySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMorgan Tocker
 
MySQL NDB Cluster 8.0
MySQL NDB Cluster 8.0MySQL NDB Cluster 8.0
MySQL NDB Cluster 8.0Ted Wennmark
 
MySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big DataMySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big DataMorgan Tocker
 
My sql5.7 whatsnew_presentedatgids2015
My sql5.7 whatsnew_presentedatgids2015My sql5.7 whatsnew_presentedatgids2015
My sql5.7 whatsnew_presentedatgids2015Sanjay Manwani
 
Methods of Sharding MySQL
Methods of Sharding MySQLMethods of Sharding MySQL
Methods of Sharding MySQLLaine Campbell
 
Scaling MySQL using Fabric
Scaling MySQL using FabricScaling MySQL using Fabric
Scaling MySQL using FabricKarthik .P.R
 
MySQL Document Store
MySQL Document StoreMySQL Document Store
MySQL Document StoreMario Beck
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance TuningMark Swarbrick
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLOlivier DASINI
 
MySQL 5.7 Replication News
MySQL 5.7 Replication News MySQL 5.7 Replication News
MySQL 5.7 Replication News Ted Wennmark
 
MySQL Performance - Best practices
MySQL Performance - Best practices MySQL Performance - Best practices
MySQL Performance - Best practices Ted Wennmark
 

What's hot (20)

MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
 
High-Availability using MySQL Fabric
High-Availability using MySQL FabricHigh-Availability using MySQL Fabric
High-Availability using MySQL Fabric
 
MySQL High Availability: Managing Farms of Distributed Servers (MySQL Fabric)
MySQL High Availability: Managing Farms of Distributed Servers (MySQL Fabric)MySQL High Availability: Managing Farms of Distributed Servers (MySQL Fabric)
MySQL High Availability: Managing Farms of Distributed Servers (MySQL Fabric)
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
 
Why MySQL High Availability Matters
Why MySQL High Availability MattersWhy MySQL High Availability Matters
Why MySQL High Availability Matters
 
MySQL Group Replication - an Overview
MySQL Group Replication - an OverviewMySQL Group Replication - an Overview
MySQL Group Replication - an Overview
 
MySQL for Software-as-a-Service (SaaS)
MySQL for Software-as-a-Service (SaaS)MySQL for Software-as-a-Service (SaaS)
MySQL for Software-as-a-Service (SaaS)
 
Python Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesPython Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL Databases
 
MySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMySQL Cloud Service Deep Dive
MySQL Cloud Service Deep Dive
 
MySQL NDB Cluster 8.0
MySQL NDB Cluster 8.0MySQL NDB Cluster 8.0
MySQL NDB Cluster 8.0
 
MySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big DataMySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big Data
 
My sql5.7 whatsnew_presentedatgids2015
My sql5.7 whatsnew_presentedatgids2015My sql5.7 whatsnew_presentedatgids2015
My sql5.7 whatsnew_presentedatgids2015
 
Methods of Sharding MySQL
Methods of Sharding MySQLMethods of Sharding MySQL
Methods of Sharding MySQL
 
Scaling MySQL using Fabric
Scaling MySQL using FabricScaling MySQL using Fabric
Scaling MySQL using Fabric
 
MySQL Document Store
MySQL Document StoreMySQL Document Store
MySQL Document Store
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
 
MySQL 5.7 Replication News
MySQL 5.7 Replication News MySQL 5.7 Replication News
MySQL 5.7 Replication News
 
MySQL Security
MySQL SecurityMySQL Security
MySQL Security
 
MySQL Performance - Best practices
MySQL Performance - Best practices MySQL Performance - Best practices
MySQL Performance - Best practices
 

Similar to MySQL Fabric Tutorial Overview

My sql fabric webinar v1.1
My sql fabric webinar v1.1My sql fabric webinar v1.1
My sql fabric webinar v1.1Ricky Setyawan
 
2014 OpenSuse Conf: Protect your MySQL Server
2014 OpenSuse Conf: Protect your MySQL Server2014 OpenSuse Conf: Protect your MySQL Server
2014 OpenSuse Conf: Protect your MySQL ServerGeorgi Kodinov
 
MySQL High Availability - Managing Farms of Distributed Servers
MySQL High Availability - Managing Farms of Distributed ServersMySQL High Availability - Managing Farms of Distributed Servers
MySQL High Availability - Managing Farms of Distributed ServersNarayanan Venkateswaran
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsSveta Smirnova
 
MySQL sys schema deep dive
MySQL sys schema deep diveMySQL sys schema deep dive
MySQL sys schema deep diveMark Leith
 
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...Courtney Llamas
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsBen Krug
 
New Not Your Father's Enterprise Manager
New Not Your Father's Enterprise ManagerNew Not Your Father's Enterprise Manager
New Not Your Father's Enterprise ManagerKellyn Pot'Vin-Gorman
 
MySQL 5.7: Performance Schema Improvements
MySQL 5.7: Performance Schema ImprovementsMySQL 5.7: Performance Schema Improvements
MySQL 5.7: Performance Schema ImprovementsMark Leith
 
Writing & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp BostonWriting & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp BostonPuppet
 
MySQL Database Architectures - 2020-10
MySQL Database Architectures -  2020-10MySQL Database Architectures -  2020-10
MySQL Database Architectures - 2020-10Kenny Gryp
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsMario Beck
 
Hkosc group replication-lecture_lab07
Hkosc group replication-lecture_lab07Hkosc group replication-lecture_lab07
Hkosc group replication-lecture_lab07Ivan Ma
 
MySQL Proxy. A powerful, flexible MySQL toolbox.
MySQL Proxy. A powerful, flexible MySQL toolbox.MySQL Proxy. A powerful, flexible MySQL toolbox.
MySQL Proxy. A powerful, flexible MySQL toolbox.Miguel Araújo
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMark Swarbrick
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksDave Stokes
 
Changes in WebLogic 12.1.3 Every Administrator Must Know
Changes in WebLogic 12.1.3 Every Administrator Must KnowChanges in WebLogic 12.1.3 Every Administrator Must Know
Changes in WebLogic 12.1.3 Every Administrator Must KnowBruno Borges
 

Similar to MySQL Fabric Tutorial Overview (20)

My sql fabric webinar v1.1
My sql fabric webinar v1.1My sql fabric webinar v1.1
My sql fabric webinar v1.1
 
2014 OpenSuse Conf: Protect your MySQL Server
2014 OpenSuse Conf: Protect your MySQL Server2014 OpenSuse Conf: Protect your MySQL Server
2014 OpenSuse Conf: Protect your MySQL Server
 
MySQL High Availability - Managing Farms of Distributed Servers
MySQL High Availability - Managing Farms of Distributed ServersMySQL High Availability - Managing Farms of Distributed Servers
MySQL High Availability - Managing Farms of Distributed Servers
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAs
 
MySQL NoSQL APIs
MySQL NoSQL APIsMySQL NoSQL APIs
MySQL NoSQL APIs
 
MySQL sys schema deep dive
MySQL sys schema deep diveMySQL sys schema deep dive
MySQL sys schema deep dive
 
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...
Zero to Manageability in 60 Minutes: Building a Solid Foundation for Oracle E...
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
MySQL Quick Dive
MySQL Quick DiveMySQL Quick Dive
MySQL Quick Dive
 
New Not Your Father's Enterprise Manager
New Not Your Father's Enterprise ManagerNew Not Your Father's Enterprise Manager
New Not Your Father's Enterprise Manager
 
MySQL 5.7: Performance Schema Improvements
MySQL 5.7: Performance Schema ImprovementsMySQL 5.7: Performance Schema Improvements
MySQL 5.7: Performance Schema Improvements
 
Writing & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp BostonWriting & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp Boston
 
Stackato Presentation Techzone 2013
Stackato Presentation Techzone 2013Stackato Presentation Techzone 2013
Stackato Presentation Techzone 2013
 
MySQL Database Architectures - 2020-10
MySQL Database Architectures -  2020-10MySQL Database Architectures -  2020-10
MySQL Database Architectures - 2020-10
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Hkosc group replication-lecture_lab07
Hkosc group replication-lecture_lab07Hkosc group replication-lecture_lab07
Hkosc group replication-lecture_lab07
 
MySQL Proxy. A powerful, flexible MySQL toolbox.
MySQL Proxy. A powerful, flexible MySQL toolbox.MySQL Proxy. A powerful, flexible MySQL toolbox.
MySQL Proxy. A powerful, flexible MySQL toolbox.
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disks
 
Changes in WebLogic 12.1.3 Every Administrator Must Know
Changes in WebLogic 12.1.3 Every Administrator Must KnowChanges in WebLogic 12.1.3 Every Administrator Must Know
Changes in WebLogic 12.1.3 Every Administrator Must Know
 

Recently uploaded

Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Anthony Dahanne
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profileakrivarotava
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 

Recently uploaded (20)

Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profile
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 

MySQL Fabric Tutorial Overview

  • 1. MySQL Fabric Tutorial Lars Thalmann, Development Director Narayanan Venkateswaran, Principal Software Engineer Mats Kindahl, Sr. Principal Software Engineer Copyright © 2014, Oracle and/or its affiliates. AAllll All rriigghhttss rights rreesseerrvveedd.. 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. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02
  • 3. Tutorial Outline 1 What is MySQL Fabric? 2 Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | 3 4 5 Downloading and Installing High Availability Sharding Closing Remarks
  • 4. What is MySQL Fabric? Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 5. What is MySQL Fabric? An extensible and easy-to-use framework for managing a farm of MySQL servers supporting high-availability and sharding Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 6. What does all that mean? ● Management System – Manages a MySQL Farm – Distributed Framework Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ● Framework – Procedure execution – State store – Transaction Routing ● Extensible – Extensions are first-class – High-availability groups – “Semi-automatic” sharding ● Written in Python ● Latest Release 1.5.2 GA ● Open Source – You can participate – Suggest features – Report bugs – Contribute patches ● MySQL 5.6 is focus
  • 7. Birds-eye View Application SQL Connector Connector Connector High Availability Groups SQL Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Operator MySQL Fabric Node Database Servers
  • 8. Downloading & Installing Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 9. Download & Install ● Download MySQL Connector Python – http://dev.mysql.com/downloads/connector/python/ – This connector is needed for MySQL Fabric ● Download MySQL Utilities – http://dev.mysql.com/downloads/utilities/ – MySQL Fabric is part of the MySQL Utilities release ● Install MySQL Connector Python – For Ubuntu, simply click on the downloaded deb package ● Install MySQL Utilities – For Ubuntu, simply click on the downloaded deb package – Note that MySQL Connector Python must be installed before this step Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 10. Download & Install ● Install MySQL Server 5.6 – For Ubuntu 14.04, just two commands: ● sudo apt-get install mysql-client-core-5.6 ● sudo apt-get install mysql-server-5.6 – MySQL 5.6 server is needed for the MySQL Fabric backing store – For the rest of the tutorial, we will assume that you have this server running Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 11. Starting MySQL Fabric Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 12. Starting Fabric $ mysqlfabric Usage: mysqlfabric [­­param, ­­config] <grp> <cmd> [arg, ...]. MySQL Fabric 1.5.2 ­MySQL server farm management framework Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Options: ­­version show program's version number and exit ­h, ­­help show this help message and exit ­­param= CONFIG_PARAMS Override a configuration parameter. ­­config= FILE Read configuration from FILE. Basic commands: help <grp> <cmd> Show help for command help commands List all commands help groups List all groups
  • 13. Getting Help Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 14. Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Getting Help $ mysqlfabric help groups Available groups: statistics, group, dump, manage, server, role, user, threat, sharding, event $ mysqlfabric help group Commands available in group 'group' are: group activate group_id [­­synchronous] group description group_id [­­description= NONE] [­­synchronous] group deactivate group_id [­­synchronous] group create group_id [­­description= NONE] [­­synchronous] group remove group_id server_id [­­synchronous] group add group_id address [­­timeout= 5] [­­update_ only] [­­synchronous] group health group_id group lookup_servers group_id [­­server_ id=NONE] [­­status= NONE] [­­mode= NONE] group destroy group_id [­­force] [­­synchronous] group demote group_id [­­update_ only] [­­synchronous] group promote group_id [­­slave_ id=NONE] [­­update_ only] [­­synchronous] group lookup_groups [­­group_ id=NONE]
  • 15. Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Getting Help $ mysqlfabric help group demote group demote group_id [­­update_ only] [­­synchronous] Demote the current master if there is one. If users just want to update the state store and skip provisioning steps such as configuring replication, the update_only parameter must be set to true. Otherwise any write access to the master is blocked, slaves are synchronized with the master, stopped and their replication configuration reset. Note that no slave is promoted as master.
  • 16. Configuring Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 17. MySQL Fabric Users ● Backing Store User – The user identity that Fabric will use to modify the backing store – Can be configured in /etc/mysql/fabric.cfg [storage] Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ● Server User – The user identity used to connect to managed MySQL Servers – Can be configured in /etc/mysql/fabric.cfg [servers] ● Admin user – The user identity used to control MySQL Fabric – Can be configured in /etc/mysql/fabric.cfg [protocol.xmlrpc] ● Invoked client tools user – The user identity used to connect to managed MySQL Servers via Fabric-invoked command-line tools – Can be configured in /etc/mysql/fabric.cfg [protocol.xmlrpc]
  • 18. Configuring the backing store ● On the MySQL Backing Store Server – Create a Backing Store user on the backing store MySQL Server – Grant access for the user to the “fabric” database lars@silver3:~$ mysql ­u root mysql> CREATE USER 'fabric'@'localhost' IDENTIFIED BY 'SECRET'; mysql> GRANT ALL ON fabric.* TO 'fabric'@'localhost'; Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 19. Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Original lars@silver3:~$ sudo emacs /etc/mysql/fabric.cfg [DEFAULT] prefix = sysconfdir = /etc logdir = /var/log [storage] address = localhost:3306 user = fabric password = database = fabric auth_plugin = mysql_native_password connection_timeout = 6 connection_attempts = 6 connection_delay = 1 [servers] user = fabric password = [protocol.xmlrpc] address = localhost:32274 threads = 5 user = admin password = disable_authentication = no realm = MySQL Fabric ssl_ca = ssl_cert = ssl_key = [executor] executors = 5 [logging] level = INFO url = file:///var/log/fabric.log [sharding] mysqldump_program = /usr/bin/mysqldump mysqlclient_program = /usr/bin/mysql [statistics] prune_time = 3600 [failure_tracking] notifications = 300 notification_clients = 50 notification_interval = 60 failover_interval = 0 detections = 3 detection_interval = 6 detection_timeout = 1 prune_time = 3600 [connector] ttl = 1 [client] password =
  • 20. Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Edited lars@silver3:~$ sudo emacs /etc/mysql/fabric.cfg [DEFAULT] prefix = sysconfdir = /etc logdir = /var/log [storage] address = localhost:3306 user = fabric password = SECRET database = fabric auth_plugin = mysql_native_password connection_timeout = 6 connection_attempts = 6 connection_delay = 1 [servers] user = fabric password = [protocol.xmlrpc] address = localhost:32274 threads = 5 user = admin password = disable_authentication = yes realm = MySQL Fabric ssl_ca = ssl_cert = ssl_key = [executor] executors = 5 [logging] level = INFO url = file:///var/log/fabric.log [sharding] mysqldump_program = /usr/bin/mysqldump mysqlclient_program = /usr/bin/mysql [statistics] prune_time = 3600 [failure_tracking] notifications = 300 notification_clients = 50 notification_interval = 60 failover_interval = 0 detections = 3 detection_interval = 6 detection_timeout = 1 prune_time = 3600 [connector] ttl = 1 [client] password =
  • 21. Creating the backing store Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 22. Creating the backing store ● Create the database storing info for MySQL Fabric – Since we have disabled authentication for this tutorial, admin/xmlrpc password will actually not be used for anything $ mysqlfabric manage setup [INFO] 1411584079.046989 ­MainThread ­Initializing persister: user (fabric), server (localhost:3306), database (fabric). Finishing initial setup ======================= Password for admin user is not yet set. Password for admin/xmlrpc: Repeat Password: Password set. Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 23. A deeper look into the architecture Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 24. Birds-eye View Application SQL Connector Connector Connector High Availability Groups SQL Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Operator MySQL Fabric Node Database Servers
  • 25. High-Level Components ● Fabric-aware Connectors – Python, PHP, Java, .NET, C – Enhanced Connector API ● MySQL Fabric Node – Manage information about farm – Provide status information – Execute procedures ● MySQL Servers – Organized in high-availability groups – Handling application data Application Connector High Availability Group Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Connector Connector MySQL Fabric Node
  • 26. MySQL Fabric Node Architecture Connector ? Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | MySQL MySQL Fabric Framework Executor State Store (Persister) Sh ? HA AMQP MySQL-RPC XML-RPC Connector Connector Protocols Extensions Backing Store
  • 27. Starting the Fabric server ● MySQL Fabric will be run in the foreground – You can also run as deamon in the backgroud, using --deamonize $ mysqlfabric manage start [INFO] 1411822940.181810 ­MainThread ­Initializing persister: user (root), server (localhost:13000), database (fabric). [INFO] 1411822940.188654 ­MainThread ­Loading Services. [WARNING] 1411822940.198591 ­MainThread ­Authentication disabled [INFO] 1411822940.198668 ­MainThread ­MySQL­RPC protocol server started, listening on localhost:32275 [WARNING] 1411822940.198773 ­MainThread ­Authentication disabled [INFO] 1411822940.212181 ­MainThread ­Executor started. [INFO] 1411822940.215672 ­MainThread ­Starting failure detector. [INFO] 1411822940.216747 ­XML­RPC­Server ­XML­RPC protocol server ('127.0.0.1', 32274) started. [INFO] 1411822940.217083 ­XML­RPC­Server ­Setting 1 XML­RPC session(s). [INFO] 1411822940.217331 ­XML­RPC­Session­0 ­Started XML­RPC­Session. Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 28. High Availability Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 29. High-Availability Concepts Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ● Redundancy – Duplicate components ● Monitoring – Detecting failing components – Monitor load ● Procedures – Activate replacements – Distribute load
  • 30. Using the Fabric client ● Create a High Availability group – The Fabric client will connect to the Fabric server that is configured in the Fabric.cfg file $ mysqlfabric group create "group­1" Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 uuid finished success result Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­254f8b62­8ea9­4350­a46e­77fefafc0f41 1 1 1 state success when description ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­3 2 1411822993.11 Triggered by <mysql.fabric.events.Event object at 0x7fbdef77aa50>. 4 2 1411822993.12 Executing action (_create_group). 5 2 1411822993.12 Executed action (_create_group).
  • 31. Add a MySQL server to the group ● The MySQL server is now managed by MySQL Fabric $ mysqlfabric group add group­1 localhost:13001 Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 uuid finished success result Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­bb73e411­0705­47dd­86f9­b99798c97c9c 1 1 1 state success when description ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­3 2 1411823050.61 Triggered by <mysql.fabric.events.Event object at 0x7fbdef77ae10>. 4 2 1411823050.61 Executing action (_add_server). 5 2 1411823050.62 Executed action (_add_server).
  • 32. Add a second MySQL server to the group ● The MySQL servers are now managed by MySQL Fabric $ mysqlfabric group add group­1 localhost:13002 Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 uuid finished success result Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­feba445d­47bd­4681­a8b8­8ae88d1d12a3 1 1 1 state success when description ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­3 2 1411823077.84 Triggered by <mysql.fabric.events.Event object at 0x7fbdef77ae10>. 4 2 1411823077.84 Executing action (_add_server). 5 2 1411823077.85 Executed action(_add_server).
  • 33. Listing the MySQL servers of the group ● Two servers in the high availability group $ mysqlfabric group lookup_servers group­1 Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 server_uuid address status mode weight Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­1906aa45­4646­11e4­926f­e82aea9348c9 localhost:13001 SECONDARY READ_ONLY 1.0 1937e215­4646­11e4­926f­e82aea9348c9 localhost:13002 SECONDARY READ_ONLY 1.0
  • 34. Promote a server to master ● Will pick the “best” server of the group – Since the servers are empty, this will be a random choice $ mysqlfabric group promote group­1 Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 uuid finished success result Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­4295faef­e6e1­4df1­9493­1b9b9cdc3a48 1 1 1 state success when description ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­3 2 1411823267.15 Triggered by <mysql.fabric.events.Event object at 0x7fbdef4615d0>. 4 2 1411823267.15 Executing action (_define_ha_operation). 5 2 1411823267.16 Executed action (_define_ha_operation).
  • 35. Promote a specific server to become the master ● The server specified with --slave-id will be the master $ mysqlfabric group promote group­1 ­­slave_ id=1906aa45­4646­11e4­926f­e82aea9348c9 Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 uuid finished success result ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­4295faef­e6e1­4df1­9493­1b9b9cdc3a48 1 1 1 state success when description ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­3 2 1411823267.15 Triggered by <mysql.fabric.events.Event object at 0x7fbdef4615d0>. 4 2 1411823267.15 Executing action (_define_ha_operation). 5 2 1411823267.16 Executed action (_define_ha_operation).
  • 36. Using the High Availability Group of the farm Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 37. Birds-eye View Application SQL Connector Connector Connector High Availability Groups XML-RPC MySQL-RPC SQL Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Operator MySQL Fabric Node Database Servers
  • 38. MySQL Connector Python ● There is also Java, PHP, Connector/C (labs), .Net – And support for frameworks Doctrine, Hibernate import mysql.connector from mysql.connector import fabric Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 39. Create a table in the group ● Connect to Fabric, not to MySQL servers directly conn = mysql.connector.connect( fabric={"host" : "localhost", "port" : 32274, "username": "admin", "password" : "", 'report_errors': True }, user="root", password="", autocommit=True) conn.set_property(group="group­1", mode=fabric.MODE_READWRITE) cur = conn.cursor() cur.execute("CREATE DATABASE IF NOT EXISTS employees") cur.execute("USE employees") cur.execute("DROP TABLE IF EXISTS employees") cur.execute( "CREATE TABLE employees (" " emp_no INT, first_name CHAR(40), last_name CHAR(40)" ")") Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 40. Insert data into the group ● Specifying it is for group-1, read-write transaction def add_employee(conn, emp_no, first_name, last_name): conn.set_property(group="group­1", mode=fabric.MODE_READWRITE) cur = conn.cursor() cur.execute("USE employees") cur.execute( "INSERT INTO employees VALUES (%s, %s, %s)", (emp_no, first_name, last_name) ) # We need to keep track of what we have executed in order to, # at least, read our own updates from a slave. cur.execute("SELECT @@global.gtid_executed") for row in cur: print "Transactions executed on the master", row[0] return row[0] Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 41. Select data from the group ● Specifying that it is group-1, and that this is a read-only transaction def find_employee(conn, emp_no, gtid_executed): conn.set_property(group="group­1", mode=fabric.MODE_READONLY) cur = conn.cursor() # Guarantee that a slave has applied our own updates before # reading anything. cur.execute( "SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('%s', 0)" % (gtid_executed, )) for row in cur: print "Had to synchronize", row, "transactions." cur.execute("USE employees") cur.execute( "SELECT first_name, last_name FROM employees " "WHERE emp_no = %s", (emp_no, )) for row in cur: print "Retrieved", row Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 42. Failure Detection Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 43. ● Monitors servers within each group Application Connector Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Failure Detector Fabric Monitoring ● On master failure, – mark server as faulty, and – trigger fail-over ● On slave failure, – mark as faulty Jan 2010 High Availability Group Connector Connector MySQL Fabric Node
  • 44. Failure Detector (fabric.cfg) Fabric Monitoring 2x Engineering Staf 3x QA Staf 2x Support Staf Jan 2010 Sept 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | [failure_tracking] detections = 3 detection_interval = 6 detection_timeout = 1 detections The number of times a server fails alive checks, before being marked as FAULTY. detection_interval Time between alive checks. detection_timeout The time after which a server alive ping timeouts.
  • 45. Distributed Failure Reporting ● Connector reports error to Fabric ● Error used to update backing store Application Connector Jan 2010 Sept 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ● Trigger fail-over – Error count reaches threshold High Availability Group Connector Connector MySQL Fabric Node
  • 46. Distributed Failure Reporting (fabric.cfg) 2x Engineering Staf 3x QA Staf 2x Support Staf Jan 2010 Sept 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | [failure_tracking] notifications = 300 notification_clients = 50 notification_interval = 60 failover_interval = 0 prune_time = 3600 notifications The number of error notifications required to mark a server FAULTY. notification_clients The number of clients that need to report an error to mark a server FAULTY.
  • 47. Distributed Failure Reporting (fabric.cfg) notification_interval The interval of interest in which we want to verify error notifications. failover_interval The interval at which we can safely do a failover in a group without causing system instability. prune_time Interval at which we need to prune the error logs. 2x Engineering Staf 3x QA Staf 2x Support Staf Jan 2010 Sept 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 48. Distributed Failure Reporting (Connector) Enabling Error Reporting ● The option to report errors is part of the Fabric configuration 2x Engineering Staf 3x QA Staf 2x Support Staf ● “report_errors” can be turned on as follows ● Causes a connector-server connection error to be reported to Fabric Jan 2010 Sept 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | fabric_config = { 'host': .., 'report_errors': True, } cnx = mysql.connector.connect(fabric=fabric_config)
  • 49. Distributed Failure Reporting (Connector) Error Reporting ● The following errors are reported by default REPORT_ERRORS = ( errorcode.CR_SERVER_LOST, errorcode.CR_SERVER_GONE_ERROR, errorcode.CR_CONN_HOST_ERROR, errorcode.CR_CONNECTION_ERROR, errorcode.CR_IPSOCK_ERROR, ) ● The above can be extended by setting extra_failure_report from mysql.connector.fabric import extra_failure_report extra_failure_report([error_code_0, error_code_1, ...]) Jan 2010 Sept 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 50. Distributed Failure Reporting (Connectors) Cache Invalidation 2x Engineering Staf 3x QA Staf 2x Support Staf ● Define which errors cause invalidation of the connector cache ● The following errors cause a cache invalidation by default RESET_CACHE_ON_ERROR = ( errorcode.CR_SERVER_LOST, errorcode.ER_OPTION_PREVENTS_STATEMENT, ) Jan 2010 Sept 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ● The above can be extended by from mysql.connector.fabric import RESET_CACHE_ON_ERROR RESET_CACHE_ON_ERROR.append(error_code_0)
  • 51. Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Sharding
  • 52. Birds-eye View Application SQL Connector Connector Connector High Availability Groups XML-RPC MySQL-RPC SQL Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Operator MySQL Fabric Node Database Servers
  • 53. Creating a sharding definition ● In this example, we use Hash sharding – Fabric also supports Range sharding – This will define Group-1 as the “global group” of the shard definition – Group-1 is not a shard – All shard groups that are added, will be slave groups to the global group $ mysqlfabric sharding create_definition HASH group­1 Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 uuid finished success result Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­90bbd7a7­8996­4a5a­a971­32d10e3591c4 1 1 1
  • 54. List the sharding definitions ● The created sharding definition has identifier 1 $ mysqlfabric dump shard_maps Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 mapping_id type_name global_group_id ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­1 HASH group­1 Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 55. Register a table to the sharding definition ● Table “db1.t1” to be sharded according to definition “1” – The table will be created later – The column “emp_no” will be used as the sharding key $ mysqlfabric sharding add_table 1 db1.t1 emp_no Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 uuid finished success result Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­57aa21ef­1315­4da7­8295­aa2a0f4339e0 1 1 1
  • 56. Add shards (groups) to the sharding definition ● Add two groups as shards – Global Group: group-1 – Shards: group-2 and group-3 – --state=ENABLED will start replication $ mysqlfabric sharding add_shard 1 group­2, group­3 ­­state= ENABLED Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 uuid finished success result Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­f1e2d884­1d67­4a3a­b5d2­5b29b2a6d451 1 1 1
  • 57. What do we have now? Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ● The groups – One global group – Two shards
  • 58. Using the Global Group of the farm Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 59. Create a table (on all shards) ● Use the global group (SCOPE_GLOBAL) – Afterwards set back to the default, i.e. SCOPE_LOCAL – The properties are for the connection, not only for a single transaction conn.set_property(tables=["db1.t1"], scope=fabric.SCOPE_GLOBAL, mode=fabric.MODE_READWRITE) cur = conn.cursor() cur.execute("CREATE DATABASE IF NOT EXISTS db1") cur.execute("USE db1") cur.execute("DROP TABLE IF EXISTS t1") cur.execute( "CREATE TABLE t1 (" " emp_no INT, " " first_name CHAR(40), " " last_name CHAR(40)" ")") conn.set_property(scope=fabric.SCOPE_LOCAL) Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 60. Table propagated to all groups Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ● The table – First created on the global group – Then replicated to the two shards
  • 61. Using the Sharding Groups of the farm Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 62. Inserting into the shards ● Using the table name and the sharding key def add_employee(conn, emp_no, first_name, last_name, gtid_executed): conn.set_property(tables=["db1.t1"], key=emp_no, mode=fabric.MODE_READWRITE, scope=fabric.SCOPE_LOCAL) cur = conn.cursor() synchronize(cur, gtid_executed) cur.execute("USE db1") cur.execute( "INSERT INTO t1 VALUES (%s, %s, %s)", (emp_no, first_name, last_name) ) conn.commit() Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 63. Select data from the shards ● Using the table name and the sharding key – Will only execute this on the correct shard def find_employee(conn, emp_no, gtid_executed): conn.set_property(tables=["db1.t1"], key=emp_no, mode=fabric.MODE_READONLY) cur = conn.cursor() synchronize(cur, gtid_executed) cur.execute("USE db1") for row in cur: print "Had to synchronize", row, "transactions." cur.execute( "SELECT first_name, last_name FROM t1 " "WHERE empno = %s", (emp_no, ) ) for row in cur: print row Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 64. Shard split Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 65. Create a new group with MySQL servers ● Creating the 4th group ● Adding two servers ● Promote one of them to master $ mysqlfabric group create "group­4" $ mysqlfabric group add group­4 localhost:13007 $ mysqlfabric group add group­4 localhost:13008 $ mysqlfabric group promote group­4 Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 66. Sharding information ● Two shards 1, 2 ● Hosted on two groups “group-2” and “group-3” $ mysqlfabric dump sharding_information Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 schema_name table_name column_name lower_bound shard_id type_name group_id global_group ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­db1 t1 empno E6416... 1 HASH group­2 group­1 db1 t1 empno DC3AD... 2 HASH group­3 group­1 Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 67. Check how much data we have ● Checking on a MySQL server (shard 1 on “group-2”) directly mysql> use db1; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with ­A Database changed mysql> select count(empno) from t1; +­­­­­­­­­­­­­­+ | count(empno) | +­­­­­­­­­­­­­­+ | 1009 | +­­­­­­­­­­­­­­+ 1 row in set (0.00 sec) Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 68. Split the shard into two shards ● Part of shard 1 (“group-2”) moved to “group-4” $ mysqlfabric sharding split_shard 1 group­4 Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 uuid finished success result Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­80788beb­be2f­4b26­84f5­20bb2964ff70 1 1 1 state success when description ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­4 2 1411863534.16 Executing action (_check_shard_information). 4 2 1411863534.17 Executing action (_backup_source_shard). 4 2 1411863534.25 Executing action (_restore_shard_backup). 4 2 1411863534.37 Executing action (_setup_replication). 4 2 1411863534.39 Executing action (_setup_sync). 4 2 1411863534.4 Executing action (_setup_resharding_switch). 4 2 1411863535.45 Executing action (_prune_shard_tables_after_split).
  • 69. How much data after the split? ● Checking on a MySQL server (shard 1 on “group-2”) directly mysql> use db1; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with ­A Database changed mysql> select count(empno) from t1; +­­­­­­­­­­­­­­+ | count(empno) | +­­­­­­­­­­­­­­+ | 532 | +­­­­­­­­­­­­­­+ 1 row in set (0.00 sec) Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 70. Looking up servers responsible for sharding key ● For any sharding key, you can check which servers are responsible $ mysqlfabric sharding lookup_servers db1.t1 42000 Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 server_uuid address status mode weight Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­83f2dd4f­46a1­11e4­94c4­e82aea9348c9 localhost:13007 SECONDARY READ_ONLY 1.0 8426dd92­46a1­11e4­94c4­e82aea9348c9 localhost:13008 PRIMARY READ_WRITE 1.0
  • 71. Shard move Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 72. Create a new group with MySQL servers ● Creating the 5th group ● Adding two servers ● Promote one of them to master $ mysqlfabric group create "group­5" $ mysqlfabric group add group­5 localhost:13009 $ mysqlfabric group add group­5 localhost:13010 $ mysqlfabric group promote group­5 Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 73. Looking up servers for a sharding key ● For any sharding key, you can check which servers are responsible (Ports 13007, 13008 = “group-4”) $ mysqlfabric sharding lookup_servers db1.t1 42000 Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 server_uuid address status mode weight Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­83f2dd4f­46a1­11e4­94c4­e82aea9348c9 localhost:13007 SECONDARY READ_ONLY 1.0 8426dd92­46a1­11e4­94c4­e82aea9348c9 localhost:13008 PRIMARY READ_WRITE 1.0
  • 74. Perform the shard move ● Move shard “4” to “group-5” $ mysqlfabric sharding move_shard 4 group­5 Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 … Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 75. Verify the move ● Afterwards, check which servers are responsible (Ports 13009, 13010 = “group-5”) $ mysqlfabric sharding lookup_servers db1.t1 42000 Fabric UUID: 5ca1ab1e­a007­feed­f00d­cab3fe13249e Time­To­Live: 1 server_uuid address status mode weight Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­8489b2ff­46a1­11e4­94c4­e82aea9348c9 localhost:13009 SECONDARY READ_ONLY 1.0 84bc4d59­46a1­11e4­94c4­e82aea9348c9 localhost:13010 PRIMARY READ_WRITE 1.0
  • 76. Fabric Executor Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 77. MySQL Fabric executor Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ● Event driven – Events will trigger execution of procedures – Procedures can trigger events themselves – Each step of a procedure is called a job ● Procedures – Written in Python – Interacts with servers – Write state changes into backing store – Lock manager for conflict resolution ● Conservative two-phase locking strategy ● Avoid deadlocks Queue Backing Store Events
  • 78. Automatically adding a server to a group ● Register procedure for event – @on_event decorator – Accept event to register for ● Fetch the group the server belonged to ● Fetch a new server from the provider ● Add the server to the group @on_event(SERVER_LOST) def _add_server(group_id, server_uuid): group = Group.fetch(group_id) machines = PROVIDER.create_machines( parameters ) server = MySQLServer( server_uuid, address ) MySQLServer.add(server) group.add(server) _configure_as_slave(server) Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 79. MySQL Fabric procedure execution ● Before starting a job: – Acquire the necessary locks – Checkpoint execution state in backing store – Start a transaction on the backing store ● When executing job: – Make updates to backing store inside transaction – Interact with servers ● After executing a job: – Mark job completed in internal log – Commit transaction on backing store Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Queue Backing Store Events What about crashes?
  • 80. MySQL Fabric executor recovery ● Two types of jobs: – Idempotent: Restart the job – Not idempotent: Execute compensation ● Recovery procedure – Start the executor – Collect unfinished checkpoints – Execute compensation activity for each job associated with the checkpoint … if there is one – Re-schedule each job Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | Queue Backing Store Events
  • 81. Defining an compensation procedure ● Use the @undo decorator ● Compensating action – Search for the machine by UUID – Give it back to provider ● Compensating actions shall succeed @_add_server.undo def _undo_add_srv(group_id, server_uuid): meta_filters = { 'mysql­fabric­machine­group­uuid': server_uuid } machines = MANAGER.search_machines( {}, meta_filters ) for machine in machines: MANAGER.destroy_machine( machine.uuid ) Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 82. Going Forward Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 83. What do we have now? ● High-availability – Group Concept – Slave promotion Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ● Sharding – Range and hash sharding – Shard move and shard split ● Connector APIs – Transaction properties – “Virtual” connections ● Cloud integration – “Server providers” – OpenStack Nova ● Enhanced connectors – Connector/Python – Connector/PHP – Connector/J – Connector/NET ● Interfaces – Command-line – XML-RPC – MySQL-RPC ● Distributed failure detector – Connectors report failures – Custom failure detectors ● Credentials – RFC 2617 – SSL support
  • 84. Reading for the Interested ● MySQL Forum: Fabric, Sharding, HA, Utilities http://forums.mysql.com/list.php?144 ● MySQL Fabric Documentation http://dev.mysql.com/doc/mysql-utilities/1.4/en/fabric.html ● Migrating From an Unsharded to a Sharded Setup http://vnwrites.blogspot.com/2013/09/mysqlfabric-sharding-migration.html ● Configuring and running MySQL Fabric http://alfranio-distributed.blogspot.com/2014/03/mysqlfabric-installation.html Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 85. Want to contribute? Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. | ● Check it – … and send us use-case and feature suggestions ● Test it – … and send comments to the forum ● Break it – … and send in bugs to http://bugs.mysql.com
  • 86. Keeping in Touch Lars Thalmann Twitter: @larsthalmann http://larsthalmann.blogspot.com Mats Kindahl Twitter: @mkindahl http://mysqlmusings.blogspot.com Alfranio Correia Twitter: @alfranio http://alfranio-distributed.blogspot.com Narayanan Venkateswaran Twitter: @vn_tweets http://vnwrites.blogspot.com Geert Vanderkelen Twitter: @geertjanvdk http://geert.vanderkelen.org Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 87. MySQL Central Sessions ● Elastic Scalability in MySQL Fabric with OpenStack Thursday, Oct 2, 1:15 PM-2:00 PM Moscone South, 252 ● MySQL Fabric: High Availability at Different Levels Wednesday, Oct 1, 2:00 PM-2:45 PM Moscone South, 250 Copyright © 2014, Oracle and/or its affiliates. 2014-10-02 All rights reserved. |
  • 88. Safe Harbor Statement The preceding 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. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02