SlideShare una empresa de Scribd logo
1 de 62
Descargar para leer sin conexión
http://hiconsumption.com/2012/07/star-wars-recreations-of-iconic-photographs-by-david-eger/
<Insert Picture Here>
MySQL: Replication
Keith Larson
keith.larson@oracle.com
MySQL Community Manager
sqlhjalp.blogspot.com
sqlhjalp.com/pdf/ for presentations
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.
Safe Harbor Statement
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
http://jennysung.com/wp-content/uploads/2012/03/stormtroopers1.jpg
Who am I and who are you?
Who are you?
– DBAs?
– Developers?
• PHP
• Perl
• Python
• .net
– Admins?
keith.larson@oracle.com
MySQL Community Manager
http://www.sqlhjalp.com/
Started with MySQL during the dot.com days.
Primary real world work was with a MySQL InnoDB replicated chain environment that
easily held over 4 billion rows of user data.
Numerous other sites developed on LAMP stack over the last 13 years.
Copyright Oracle Corporation 2012 4
http://3.bp.blogspot.com/-IXu-9-s-8Fg/TvTs8JbgvdI/AAAAAAAAJpo/at-pjGsDlXg/s1600/Bat%2BStorm%2BTrooper%2BLego.jpg
Session Agenda

MySQL Replication Overview

Replication Configuration

Examples of a real world set up

MySQL 5.6 Replication Features

Monitoring – MySQL Enterprise Monitor
Copyright Oracle Corporation 2012
Overview Configuration Features Monitor
Copyright Oracle Corporation 2012 6
MySQL Replication Overview
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
http://farm3.static.flickr.com/2646/3678467304_66908d66d4.jpg
Copyright Oracle Corporation 2012 7
Duplicates database from a
“master” to a “slave”
Redundant copies of the data
provide foundation for High
Availability
Scale out by distributing queries
across the replication cluster
MySQL Replication Overview
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
http://thewondrous.com/wp-content/uploads/2010/04/Largest-display-of-Star-Wars-clone-troopers-built-with-interlocking-plastic-bricks.jpg
“In my opinion, MySQL is the only database
we would ever trust to power the Zappos.com
website.”
"On any given day we can sell close to
300,000 tickets on the Web site using
MySQL as the database to search for
events. It is amazing."
"craigslist infrastructure
could not have handled the
exponential growth in traffic
without MySQL.”
“We are one of the largest MySQL
web sites in production
Who Uses Replication ?
“As a leader in our field, we are committed
to providing the best service to our users,
and a web experience that meets members
expectations and that starts with IT”
“They have a master server for all writes and slave
servers for most Reads. The secret truth they claim
behind configuring the master and slave machines
is to make sure the slave machines are faster than
the masters”
Copyright Oracle Corporation 2012 8
Copyright Oracle Corporation 2012 9
Who Uses Replication ?
MySQL Replication Overview
Copyright Oracle Corporation 2012 10

Native in MySQL

Replicate within and across data centers

Failover is either scripted or provided by additional middleware

Supports Asynchronous (standard) and Semi-Synchronous replication

Each slave adds minimal load on master
http://www.betabeat.com/2011/09/02/clone-wars-rise-of-the-fast-follower-startups/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
Copyright Oracle Corporation 2012 11
Replication Topologies
MySQL Replication Overview
Copyright Oracle Corporation 2012 12

Used for Scalability and HA

Asynchronous as standard

Semi-Synchronous support added in MySQL 5.5

Each slave adds minimal load on master
Replication Threads

Binlog dump thread

Slave I/O thread

Slave SQL thread
Replication Files

relay log

master info log

relay log info log
MySQL Replication Overview
Copyright Oracle Corporation 2012 13
MySQL Replication Overview
Copyright Oracle Corporation 2012 14
MySQL Replication Overview
http://technabob.com/blog/2011/12/16/lego-stormtroope-american-beauty/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
Copyright Oracle Corporation 2012 15
http://technabob.com/blog/2011/12/16/lego-stormtroope-american-beauty/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL Replication Overview
Copyright Oracle Corporation 2012 16

Used for Scalability and HA

Asynchronous as standard

Semi-Synchronous support added in MySQL 5.5

Each slave adds minimal load on master
Replication Threads

Binlog dump thread

Slave I/O thread

Slave SQL thread
Replication Files

relay log

master info log

relay log info log
The master creates a thread to send the binary log contents to a
slave when the slave connects. This thread can be identified in the
output of SHOW PROCESSLIST on the master as the Binlog Dump
thread.

The binlog dump thread acquires a lock on the master's binary
log for reading each event that is to be sent to the slave. As soon
as the event has been read, the lock is released, even before the
event is sent to the slave.
*************************** 2. row ***************************
Id: 27
User: replication
Host: 192.168.0.11:47129
db: NULL
Command: Binlog Dump
Time: 499
State: Master has sent all binlog to slave; waiting for binlog to
be updated
Info: NULL
MySQL Replication Overview
Copyright Oracle Corporation 2012 17

Used for Scalability and HA

Asynchronous as standard

Semi-Synchronous support added in MySQL 5.5

Each slave adds minimal load on master
Replication Threads

Binlog dump thread

Slave I/O thread

Slave SQL thread
Replication Files

relay log

master info log

relay log info log
MySQL Replication Overview
When a START SLAVE statement is issued on a slave server, the
slave creates an I/O thread, which connects to the master and
asks it to send the updates recorded in its binary logs.
The slave I/O thread reads the updates that the master's Binlog
Dump thread sends and copies them to local files that comprise
the slave's relay log.
The state of this thread is shown as Slave_IO_running in the
output of SHOW SLAVE STATUS or as Slave_running in the
output of SHOW STATUS.
Slave_IO_Running: Yes
| Slave_running | ON |
Copyright Oracle Corporation 2012 18

Used for Scalability and HA

Asynchronous as standard

Semi-Synchronous support added in MySQL 5.5

Each slave adds minimal load on master
Replication Threads

Binlog dump thread

Slave I/O thread

Slave SQL thread
Replication Files

relay log

master info log

relay log info log
MySQL Replication Overview
The slave creates an SQL thread to read the relay log
that is written by the slave I/O thread and execute the
events contained therein.
Slave_SQL_Running: Yes
Copyright Oracle Corporation 2012 19

Used for Scalability and HA

Asynchronous as standard

Semi-Synchronous support added in MySQL 5.5

Each slave adds minimal load on master
Replication Threads

Binlog dump thread

Slave I/O thread

Slave SQL thread
Replication Files

relay log

master info log

relay log info log
MySQL Replication Overview
The relay log consists of the events read from the binary
log of the master and written by the slave I/O thread.
Events in the relay log are executed on the slave as part
of the SQL thread. caption text here.
Copyright Oracle Corporation 2012 20

Used for Scalability and HA

Asynchronous as standard

Semi-Synchronous support added in MySQL 5.5

Each slave adds minimal load on master
Replication Threads

Binlog dump thread

Slave I/O thread

Slave SQL thread
Replication Files

relay log

master info log

relay log info log
MySQL Replication Overview
The master info log contains status and current
configuration information for the slave's connection to
the master. This log holds information on the master
host name, login credentials, and coordinates indicating
how far the slave has read from the master's binary log.
Copyright Oracle Corporation 2012 21

Used for Scalability and HA

Asynchronous as standard

Semi-Synchronous support added in MySQL 5.5

Each slave adds minimal load on master
Replication Threads

Binlog dump thread

Slave I/O thread

Slave SQL thread
Replication Files

relay log

master info log

relay log info log
MySQL Replication Overview
The master info log contains status and current
configuration information for the slave's connection to
the master. This log holds information on the master
host name, login credentials, and coordinates indicating
how far the slave has read from the master's binary log.
Copyright Oracle Corporation 2012 22

Used for Scalability and HA

Asynchronous as standard

Semi-Synchronous support added in MySQL 5.5

Each slave adds minimal load on master
Replication Threads

Binlog dump thread

Slave I/O thread

Slave SQL thread
Replication Files

relay log

master info log

relay log info log
MySQL Replication Overview
The relay log info log holds status information about the
execution point within the slave's relay log
Copyright Oracle Corporation 2012 23
Replication Formats

Statement-based replication (SBR)
– Advantages
• Less data written to log files
• taking and restoring from backups are faster
– Disadvantages
• Some functions or queries are
nondeterministic and hard to replicate

Row-based replication (RBR)
– Advantages
• safest form of replication
• Fewer row locks are required on the slave
– Disadvantages
• generate more data that must be logged*
• Blob values take longer to replicate

Mixed-format
– statement-based logging is used by default
– automatically switches to row-based logging in
particular cases
MySQL Replication Overview
http://dev.mysql.com/doc/refman/5.5/en/replication-formats.html
http://dev.mysql.com/doc/refman/5.1/en/binary-log-setting.html
Copyright Oracle Corporation 2012 24
Asynchronous is standard

events are occurring independently

The master writes events to its binary log but does not know whether
or when a slave has retrieved and processed them

if the master crashes, transactions that it has committed might not
have been transmitted to any slave
Semi-Synchronous support added in MySQL 5.5
●
Original patch: Mark Callaghan and Wei Li, Google
Adoptions: Zhenxing He, Sun Microsystems
●
acknowledges receipt of a transaction's events only after the events
have been written to its relay log and flushed to disk
●
best for close servers communicating over fast networks
●
timeout occurs without any slave having acknowledged the
transaction, the master reverts to asynchronous replication. When at
least one semisynchronous slave catches up, the master returns to
semisynchronous replication.
MySQL Replication Overview
http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
Copyright Oracle Corporation 2012 25
http://hiconsumption.com/2012/07/star-wars-recreations-of-iconic-photographs-by-david-eger/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL Replication Configuration
Copyright Oracle Corporation 2012 26
Master Setup:
# vi /etc/my.cnf
[mysqld]
server-id=1
log-bin = /var/lib/mysql/yoda-bin
Start and Log into MySQL
master_yoda>show master statusG
*************************** 1. row ***************************
File: yoda-bin.000001
Position: 114
Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.00 sec)
# mysqldump -p --all-databases --master-data=2 > /tmp/replication_example.sql
THIS LOCKS THE DATABASE!
http://dev.mysql.com/doc/refman/5.5/en/replication-howto-masterbaseconfig.html
http://www.minifigures.co.uk/lego/star-wars/master-yoda/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL Replication Configuration
Copyright Oracle Corporation 2012 27
On Master :
mysql_yoda>CREATE USER 'replication'@'192.168.0.%' IDENTIFIED BY 'slavepass';
mysql_yoda>GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%';
mysql_yoda>flush privileges;
Adjust all firewall rules if required for MySQL Port. (3306)
http://dev.mysql.com/doc/refman/5.5/en/replication-howto-masterbaseconfig.html
http://www.minifigures.co.uk/lego/star-wars/master-yoda/http://www.minifigures.co.uk/lego/star-wars/master-yoda/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL Replication Configuration
Copyright Oracle Corporation 2012 28
Slave Setup:
vi /etc/my.cnf
[mysqld]
Server-id=2
relay-log=/var/lib/mysql/luke-relay-bin
# optional below
log-bin = /var/lib/mysql/luke-bin
luke>show master statusG
*************************** 1. row ***************************
File: luke-bin.000003
Position: 114
Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.00 sec)
LOAD DATA:
# mysql --user=root -p < /tmp/replication_example.sql
http://www.minifigures.co.uk/lego/star-wars/luke-skywalker-on-tatooine/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL Replication Configuration
Copyright Oracle Corporation 2012 29
On Slave :
mysql_luke> CHANGE MASTER TO
MASTER_HOST='yoda',
MASTER_USER='replication',
MASTER_PASSWORD='slavepass',
MASTER_PORT=3306,
MASTER_LOG_FILE='yoda-bin.000002',
MASTER_LOG_POS=83415,
MASTER_CONNECT_RETRY=10;
We gathered this info from the mysqldump file via the
“ --master-data=2 ” flag.
-- CHANGE MASTER TO
MASTER_LOG_FILE='yoda-bin.000002',
MASTER_LOG_POS=83415;
mysql_luke > start slave;
Query OK, 0 rows affected (0.00 sec)
http://www.minifigures.co.uk/lego/star-wars/luke-skywalker-on-tatooine/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL Replication Configuration
Copyright Oracle Corporation 2012 30
On Slave :
mysql_luke> show slave statusG
mysql_luke> show slave statusG
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: yoda
Master_User: replication
Master_Port: 3306
Connect_Retry: 10
Master_Log_File: yoda-bin.000003
Read_Master_Log_Pos: 323
Relay_Log_File: luke-relay-bin.000004
Relay_Log_Pos: 475
Relay_Master_Log_File: yoda-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Master_Server_Id: 1
Master_UUID: 75d407df-2be4-11e1-9668-b4be9bce39b0
Seconds_Behind_Master: 0
SQL_Remaining_Delay: NULL
http://www.minifigures.co.uk/lego/star-wars/luke-skywalker-on-tatooine/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL Replication Configuration
Copyright Oracle Corporation 2012 31
Master to Master
mysql> SET GLOBAL auto_increment_offset=2;
mysql> SET GLOBAL auto_increment_increment=2;
mysql_yoda>show global variables like '%auto_increment%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| auto_increment_increment | 2 |
| auto_increment_offset | 1 |
+--------------------------+-------+
mysql_luke>show global variables like '%auto_increment%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| auto_increment_increment | 2 |
| auto_increment_offset | 2 |
+--------------------------+-------+
mysql_luke>SHOW MASTER STATUSG
*************************** 1. row ***************************
File: luke-bin.000005
Position: 295
mysql_yoda>CHANGE MASTER TO
MASTER_HOST='luke',
MASTER_USER='replication2',
MASTER_PASSWORD='slavepass',
MASTER_PORT=3306,
MASTER_LOG_FILE='luke-bin.000005',
MASTER_LOG_POS=295,
MASTER_CONNECT_RETRY=10;
mysql_yoda> start slave;
http://www.minifigures.co.uk/lego/star-wars/master-yoda/
http://legostarwars.wikia.com/wiki/Luke_Skywalker_%28Jedi%29
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL Replication Configuration
Copyright Oracle Corporation 2012 32
Setting up replication with utilities
mysqlreplicate  --master=root@master.example.com 
--slave=root@slave.example.com  --rpl-user=repl:xyzzy
http://mysqlworkbench.org/utilities/man/mysqlreplicate.html
Require master and slave to be off-line!
https://github.com/greyrl/generaltools/blob/master/mysqlreplicate.py
http://www.minifigures.co.uk/lego/star-wars/master-yoda/
http://www.minifigures.co.uk/lego/star-wars/luke-skywalker-on-tatooine/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL 5.6: Replication Utilities (Python)
Copyright Oracle Corporation 2012 33
http://www.flickr.com/photos/kalexanderson/7719347704/in/set-72157628651430439/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL 5.6: Replication
New!
Copyright Oracle Corporation 2012 34

Global Transaction IDs

MySQL Utilities

Multi-Threaded Slaves

Binary Log Group Commit

Optimized Row Based Replication

Crash Safe Slaves

Replication Event Checksums

Time Delayed Replication
http://dev.mysql.com/doc/refman/5.6/en/replication-features.html
http://dev.mysql.com/downloads/mysql/#downloads Under Development Releases
MySQL 5.6: Replication
New!
Copyright Oracle Corporation 2012 35
MySQL 5.6: Replication
New! Global Transaction Ids
 Simple to track & compare replication across the cluster
- Unique identifier for each transaction written to the Binlog
 Automatically identify the most up-to-date slave for failover
 Deploy n-tier replication hierarchies
Master
GTID=123456
GTID=123456
GTID=123456 GTID=123456
Master
GTID=123456
GTID=123456
GTID=123456 GTID=123456
CHANGE MASTER TO??
Slave(s) can start from same GTID
●
reference a global transaction
identifier and not have to convert
binary log filenames and offsets
between different servers
Copyright Oracle Corporation 2012 36
MySQL 5.6: Replication
New! Global Transaction Ids
MySQL 5.6: Replication HA Utilities (Python)
 Enabling self-healing replication topologies
 Automated failover & recovery
- mysqlfailover Utility
 Switchover & administration
- mysqlrpladmin Utility
 Delivers HA within the core MySQL
distribution
- Eliminates the need for 3rd party solutions
- Allows extensibility to support variety of
HA mechanisms
https://launchpad.net/mysql-utilities/
Failed
Master
Promoted
Master
Slaves
Monitoring HA Utilities
• Database Operations
• mysqldbcompare – compare databases
• mysqldbcopy – copy databases between servers
• mysqldbexport – export metadata and data
• mysqldbimport – import metadata and data
• mysqldiff – compare object definitions
• General Utilities
• mysqldiskusage – show disk usage for databases
• mysqlindexcheck – check for redundant indexes
• mysqlmetagrep – search metadata
• mysqlprocgrep – search process information
• mysqluserclone – clone a user account
MySQL 5.6: Replication HA Utilities (Python)
• High Availability
• mysqlfailover – automatic failover for MySQL 5.6.5+
• mysqlreplicate – setup replication
• mysqlrpladmin – general replication 
administration
• switchover
• failover for MySQL 5.6.5 
• mysqlrplcheck – check replication configuration
• mysqlrplshow – display map of replication 
topology
• Server Operations
• mysqlserverclone – start a scratch server
• mysqlserverinfo – show server information
MySQL 5.6: Replication HA Utilities (Python)
How do I access the utilities?
Copyright Oracle Corporation 2012 41
MySQL 5.6: Replication
Multi-Threaded Slaves
 Increases slave throughput,
reducing lag
 All transactions received into
slave’s relay log
 Implements multiple SQL threads,
based on database
 Applies events to different
databases in parallel
 Great for systems which isolate
application data using databases
– e.g. multi-tenant
 5x performance gain
 SysBench, running across 10 x schemas
 Oracle Linux 6.1, Oracle Sun Fire x4150 m2 Server
0 5 10
0
50
100
150
200
250
300
Multi-Threaded Slave Performance
Worker Threads
QueriesperSecond
Copyright Oracle Corporation 2012 42
Throughput of slave increased by allowing multiple slave threads:
●
0 - functionality disabled
●
0 to 1024
Exec_Master_Log_Posn in SHOW SLAVE STATUS represents a
“low-water” mark, before which no uncommitted transactions remain.
Configure using:
●
slave-parallel-workers=4
On a per-database basis
●
can process successive transactions on a given database
without waiting for updates on other databases to complete
http://dev.mysql.com/doc/refman/5.6/en/replication-options-slave.html#sysvar_slave_parallel_workers
MySQL 5.6: Replication
Multi-Threaded Slaves
Copyright Oracle Corporation 2012 43
mysql_luke> show slave statusG
*************************** 1. row ***************************
....
Exec_Master_Log_Pos: 114
mysql> show global variables like '%workers%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| slave_parallel_workers | 0 |
+------------------------+-------+
1 row in set (0.00 sec)
mysql> SET GLOBAL slave_parallel_workers=4;
Query OK, 0 rows affected (0.00 sec)
mysql> show global variables like '%workers%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| slave_parallel_workers | 4 |
+------------------------+-------+
1 row in set (0.00 sec)
http://dev.mysql.com/doc/refman/5.6/en/replication-options-slave.html#sysvar_slave_parallel_workers
MySQL 5.6: Replication
Multi-Threaded Slaves
Copyright Oracle Corporation 2012 44
MySQL 5.6: Replication
Binary Log Group Commit
 Increases replication throughput by
increasing performance of the
master
 Commits multiple transactions as a
group to Binlog on disk
 Finer grained locking; reducing lock
wait times
Binary
Log
T4
Session
T1 T2
T3
Group
commit
T4
Master
Database
155% Performance Gain
Copyright Oracle Corporation 2012 45
MySQL 5.6: Replication
Optimized Row Base Replication
Primary Key Changed Columns
 New option: binlog-row-image=minimal
 Increases throughput for master and slave
- Reduces Binlog size, memory & network bandwidth
 Only replicates elements of the Row image that have changed
Copyright Oracle Corporation 2012 46
Problem: Slave thread commits and then updates
slave data.
what if it crashes in-between?
●
recovery issues - where to restart replication from?
●
file corruption vulnerability
●
administration hassle
Solution: store data in (transactional) tables:
●
slave's data is updated transactionally
●
engine agnostic
●
crash-safeness (requires transactional tables) frees
the DBA to manually recover transactions after a
crash
http://farm6.static.flickr.com/5024/5554971120_df447dd31c.jpg
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL 5.6: Crash safe Slaves, BinLog
Copyright Oracle Corporation 2012 47
MySQL 5.6: Crash safe Slaves, BinLog
• Automatic recovery of a slave and
Binlog after a failure
• Binlog and table data are transactionally
consistent
• Resumes replication without Dev/Op
intervention
• Automatically rolling back replication to
last committed event
• Eliminates risk of data loss or
corruption
Data
Position Info
CRASH!
Data
Position Info
Atomic
Atomic
Before:
– Transaction Data: in tables
– Replication Info: in files
MySQL 5.6
– Transaction Data: in tables
– Replication Info: in tables
Time
Time
Copyright Oracle Corporation 2012 48
●
System tables:
slave_master_info (mysql.slave_master_info)
--master-info-repository=TABLE
slave_relay_log_info (mysql.slave_relay_log_info)
--relay-log-info-repository=TABLE
mysql_slave> stop slave;
mysql_slave> SET GLOBAL master_info_repository = 'TABLE';
mysql_slave> SET GLOBAL relay_log_info_repository = 'TABLE';
mysql_slave> start slave;
Make sure you add to my.cnf
– master-info-repository =TABLE
●
relay-log-info-repository =TABLE
●
Transactional tables enables transactional slave positions
●
Automatic conversion between files and tables on startup
●
Long time awaited feature
http://dev.mysql.com/doc/refman/5.6/en/replication-options-binary-log.html
MySQL 5.6: Crash safe Slaves, BinLog
Copyright Oracle Corporation 2012 49
mysql_slave> select * from slave_master_info G
*************************** 1. row ***************************
Master_id: 2
Number_of_lines: 22
Master_log_name: yoda-bin.000003
Master_log_pos: 323
Host: yoda
User_name: replication
User_password: slavepass
Port: 3306
Connect_retry: 10
Enabled_ssl: 0
Ssl_ca:
Ssl_capath:
Ssl_cert:
Ssl_cipher:
Ssl_key:
Ssl_verify_server_cert: 0
Heartbeat: 1800
Bind:
Ignored_server_ids: 0
Uuid: 75d407df-2be4-11e1-9668-b4be9bce39b0
Retry_count: 86400
Ssl_crl:
Ssl_crlpath:
1 row in set (0.00 sec)
MySQL 5.6: Crash safe Slaves, BinLog
Copyright Oracle Corporation 2012 50
MySQL 5.6: Replication Event Checksums
 Ensures replicated data is correct,
consistent and accessible
 Detects corrupt replication events
before they’re applied
– Returns an error
 Protects entire replication path
– Memory
– Disk
– Network
– Bugs
Master Slave
Copyright Oracle Corporation 2012 51
Problem: Make replication slave to lag a specified amount of time behind
the master to:
●
To protect against user mistakes on the master.
●
To test how the system behaves when there is a lag.
●
To inspect what the database looked like long ago, without having
to reload a backup.
Solution: The slave waits until a given number of seconds elapses before
applying the changes:
●
Delays configured per slave: flexible deployment;
●
Are implemented in the SQL thread layer.
●
Rolling Database Backups with Relayed Replication
MySQL 5.6: Replication
Time Delayed Replication
Copyright Oracle Corporation 2012 52
User interface:
●
CHANGE MASTER TO MASTER_DELAY = <NUM_SECONDS>;
●
mysql> stop slave;
●
mysql> CHANGE MASTER TO MASTER_DELAY=86400; start slave;
●
SHOW SLAVE STATUS:
●
SQL_Delay: 86400
●
SQL_Remaining_Delay: 86395
●
Slave_SQL_Running_State: Waiting until MASTER_DELAY seconds after master
executed event
●
RESET SLAVE clears the configured delay;
Rolling forward delayed slaves until bad event:
START SLAVE [SQL_THREAD] UNTIL MASTER_LOG_FILE = 'log_name',
MASTER_LOG_POS = log_pos
http://dev.mysql.com/doc/refman/5.6/en/replication-delayed.html
http://dev.mysql.com/doc/refman/5.6/en/start-slave.html
MySQL 5.6: Replication
Time Delayed Replication
Copyright Oracle Corporation 2012 53
slave2> CHANGE MASTER TO
-> MASTER_HOST = 'localhost',
-> MASTER_PORT = 3306,
-> MASTER_USER = 'repl_user',
-> MASTER_PASSWORD = 'pw',
-> MASTER_DELAY = 86400;
slave2> START SLAVE;
MySQL 5.6: Replication
Time Delayed Replication
Copyright Oracle Corporation 2012 54
mysql_luke> STOP SLAVE;
mysql_luke>SHOW RELAYLOG EVENTS FROM 2337G
*************************** 4. row ***************************
Log_name: luke-relay-bin.000005
Pos: 2674
Event_type: Query
Server_id: 1
End_log_pos: 2623
Info: drop database tatooine
mysql_luke> START SLAVE UNTIL
-> MASTER_LOG_FILE='luke-relay-bin.000005',
-> MASTER_LOG_POS=2674;
http://www.minifigures.co.uk/lego/star-wars/darth-vader-minifig/
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
MySQL 5.6: Replication
Time Delayed Replication
Copyright Oracle Corporation 2012 55
●
Do you know when a slave is behind?
●
What type of topology do you have?
●
Alerted on Errors?
●
Slow Queries?
MySQL Enterprise Monitor
All the slaves paying attention?
http://www.stormgrounds.com/fullwallpaper/320/Storm-Trooper-Legos
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
Copyright Oracle Corporation 2012 56
●
Global view of MySQL environment
●
Automated, rules-based monitoring and
alerts (SMTP, SNMP enabled)
●
Query capture, monitoring, analysis
and tuning, correlated with Monitor
graphs
●
Visual monitoring of “hot” applications
and servers
●
Real-time Replication Monitor with
auto-discovery of master-slave
topologies
●
Integrated with MySQL Support
MySQL Enterprise Monitor
Copyright Oracle Corporation 2012 57
MySQL Enterprise Monitor
MySQL Replication Monitoring
Copyright Oracle Corporation 2012 58
MySQL User Groups
North America
●
Atlanta, GA
●
Austin, TX
●
Boise, ID
●
Boston, MA
●
Cleveland, OH
●
Denver, CO
●
Dallas, TX
●
Huntsville, AL
●
Los Angeles, CA
Japan and APAC
●
Taiwan
●
Indonesia
Europe
●
Helsinki
●
London
●
France
Middle East
●
Dubai
●
Turkey
Complete list of MySQL user groups
https://wikis.oracle.com/display/mysql/List+of+MySQL+User+
Groups
MySQL Community Managers
Dave Stokes (david.stokes@oracle.com)
Keith Larson (keith.larson@oracle.com)
South America
●
Brazil
●
Indonesia
Oceania
●
Sydney Australia
Middle East
●
Dubai
●
Turkey
●
Montreal, CAN
●
Minneapolis, MN
●
New York, NY
●
New Jersey, NJ
●
Philadelphia, PA
●
Raleigh, NC
●
San Francisco, CA
●
Seattle, WA
●
Toronto, CAN
Top Active MySQL User Groups
Copyright Oracle Corporation 2012 59
MySQL Available Now
Development Releases:
●
http://dev.mysql.com/downloads/mysql/#downloads
Evaluate the new features
●
Questions & Feedback: forums.mysql.com/list.php?26
●
Bugs: bugs.mysql.com/
Replication in MySQL 5.5
●
mysql.com/why-mysql/white-papers/mysql-wp-replication.php
Replication 5.6 documentation
●
dev.mysql.com/doc/refman/5.6/en/replication.html
Planet
●
Planet.mysql.com
MySQL High Availability
●
http://shop.oreilly.com/product/9780596807290.do
Learn more about HA Solutions for MySQL
●
mysql.com/why-mysql/white-papers/mysql_wp_ha_strategy_guide.php
http://www.stormgrounds.com/wallpaper/Miscellaneous/Stormtrooper-under-Keyboard
TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
Copyright Oracle Corporation 2012 60
keith.larson@oracle.com
@larsonkeith
http://www.flickr.com/photos/kalexanderson/7964300088/sizes/l/in/photostream/
<Insert Picture Here>
Thanks for attending!
keith.larson@oracle.com
sqlhjalp.blogspot.com
sqlhjalp.com/pdf/
2012 ohiolinuxfest replication

Más contenido relacionado

La actualidad más candente

Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best PracticesOracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Sven Sandberg
 

La actualidad más candente (20)

MySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA Tool
 
NoSQL and MySQL: News about JSON
NoSQL and MySQL: News about JSONNoSQL and MySQL: News about JSON
NoSQL and MySQL: News about JSON
 
MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015
 
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)
 
MySQL 5.7: Focus on InnoDB
MySQL 5.7: Focus on InnoDBMySQL 5.7: Focus on InnoDB
MySQL 5.7: Focus on InnoDB
 
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
 
What's New in MySQL 8.0 @ HKOSC 2017
What's New in MySQL 8.0 @ HKOSC 2017What's New in MySQL 8.0 @ HKOSC 2017
What's New in MySQL 8.0 @ HKOSC 2017
 
Making MySQL highly available using Oracle Grid Infrastructure
Making MySQL highly available using Oracle Grid InfrastructureMaking MySQL highly available using Oracle Grid Infrastructure
Making MySQL highly available using Oracle Grid Infrastructure
 
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best PracticesOracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
 
MySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB ClustersMySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB Clusters
 
How WebLogic 12c Can Boost Your Productivity
How WebLogic 12c Can Boost Your ProductivityHow WebLogic 12c Can Boost Your Productivity
How WebLogic 12c Can Boost Your Productivity
 
MySQL 5.7 Replication News
MySQL 5.7 Replication News MySQL 5.7 Replication News
MySQL 5.7 Replication News
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
 
MySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
MySQL InnoDB Cluster and Group Replication - OSI 2017 BangaloreMySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
MySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB ClusterMySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
 
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
 
MySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQLMySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQL
 
MySQL Tech Tour 2015 - 5.7 Whats new
MySQL Tech Tour 2015 - 5.7 Whats newMySQL Tech Tour 2015 - 5.7 Whats new
MySQL Tech Tour 2015 - 5.7 Whats new
 
Conference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningConference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance Tuning
 
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
 

Similar a 2012 ohiolinuxfest replication

Similar a 2012 ohiolinuxfest replication (20)

Keith Larson Replication
Keith Larson ReplicationKeith Larson Replication
Keith Larson Replication
 
State of The Dolphin - May 2021
State of The Dolphin - May 2021State of The Dolphin - May 2021
State of The Dolphin - May 2021
 
MySQL For Oracle Developers
MySQL For Oracle DevelopersMySQL For Oracle Developers
MySQL For Oracle Developers
 
MySQL Replication
MySQL ReplicationMySQL Replication
MySQL Replication
 
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 Shell for DBAs
MySQL Shell for DBAsMySQL Shell for DBAs
MySQL Shell for DBAs
 
State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20
State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20
State of the Dolphin 2020 - 25th Anniversary of MySQL with 8.0.20
 
MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
 
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015MySQL's NoSQL  -- Texas Linuxfest August 22nd 2015
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
 
Sunshine php my sql 8.0 v2
Sunshine php my sql 8.0 v2Sunshine php my sql 8.0 v2
Sunshine php my sql 8.0 v2
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
 
MySQL Database Architectures - 2020-10
MySQL Database Architectures -  2020-10MySQL Database Architectures -  2020-10
MySQL Database Architectures - 2020-10
 
MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016
 
Marcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL WorkbenchMarcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL Workbench
 
20200613 my sql-ha-deployment
20200613 my sql-ha-deployment20200613 my sql-ha-deployment
20200613 my sql-ha-deployment
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Ohio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQLOhio Linux Fest -- MySQL's NoSQL
Ohio Linux Fest -- MySQL's NoSQL
 
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
MySQL 8.0 InnoDB Cluster - Easiest TutorialMySQL 8.0 InnoDB Cluster - Easiest Tutorial
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
 
ConFoo MySQL Replication Evolution : From Simple to Group Replication
ConFoo  MySQL Replication Evolution : From Simple to Group ReplicationConFoo  MySQL Replication Evolution : From Simple to Group Replication
ConFoo MySQL Replication Evolution : From Simple to Group Replication
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

2012 ohiolinuxfest replication

  • 2. <Insert Picture Here> MySQL: Replication Keith Larson keith.larson@oracle.com MySQL Community Manager sqlhjalp.blogspot.com sqlhjalp.com/pdf/ for presentations
  • 3. 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. Safe Harbor Statement TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. http://jennysung.com/wp-content/uploads/2012/03/stormtroopers1.jpg
  • 4. Who am I and who are you? Who are you? – DBAs? – Developers? • PHP • Perl • Python • .net – Admins? keith.larson@oracle.com MySQL Community Manager http://www.sqlhjalp.com/ Started with MySQL during the dot.com days. Primary real world work was with a MySQL InnoDB replicated chain environment that easily held over 4 billion rows of user data. Numerous other sites developed on LAMP stack over the last 13 years. Copyright Oracle Corporation 2012 4 http://3.bp.blogspot.com/-IXu-9-s-8Fg/TvTs8JbgvdI/AAAAAAAAJpo/at-pjGsDlXg/s1600/Bat%2BStorm%2BTrooper%2BLego.jpg
  • 5. Session Agenda  MySQL Replication Overview  Replication Configuration  Examples of a real world set up  MySQL 5.6 Replication Features  Monitoring – MySQL Enterprise Monitor Copyright Oracle Corporation 2012 Overview Configuration Features Monitor
  • 6. Copyright Oracle Corporation 2012 6 MySQL Replication Overview TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. http://farm3.static.flickr.com/2646/3678467304_66908d66d4.jpg
  • 7. Copyright Oracle Corporation 2012 7 Duplicates database from a “master” to a “slave” Redundant copies of the data provide foundation for High Availability Scale out by distributing queries across the replication cluster MySQL Replication Overview TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. http://thewondrous.com/wp-content/uploads/2010/04/Largest-display-of-Star-Wars-clone-troopers-built-with-interlocking-plastic-bricks.jpg
  • 8. “In my opinion, MySQL is the only database we would ever trust to power the Zappos.com website.” "On any given day we can sell close to 300,000 tickets on the Web site using MySQL as the database to search for events. It is amazing." "craigslist infrastructure could not have handled the exponential growth in traffic without MySQL.” “We are one of the largest MySQL web sites in production Who Uses Replication ? “As a leader in our field, we are committed to providing the best service to our users, and a web experience that meets members expectations and that starts with IT” “They have a master server for all writes and slave servers for most Reads. The secret truth they claim behind configuring the master and slave machines is to make sure the slave machines are faster than the masters” Copyright Oracle Corporation 2012 8
  • 9. Copyright Oracle Corporation 2012 9 Who Uses Replication ?
  • 10. MySQL Replication Overview Copyright Oracle Corporation 2012 10  Native in MySQL  Replicate within and across data centers  Failover is either scripted or provided by additional middleware  Supports Asynchronous (standard) and Semi-Synchronous replication  Each slave adds minimal load on master http://www.betabeat.com/2011/09/02/clone-wars-rise-of-the-fast-follower-startups/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
  • 11. Copyright Oracle Corporation 2012 11 Replication Topologies MySQL Replication Overview
  • 12. Copyright Oracle Corporation 2012 12  Used for Scalability and HA  Asynchronous as standard  Semi-Synchronous support added in MySQL 5.5  Each slave adds minimal load on master Replication Threads  Binlog dump thread  Slave I/O thread  Slave SQL thread Replication Files  relay log  master info log  relay log info log MySQL Replication Overview
  • 13. Copyright Oracle Corporation 2012 13 MySQL Replication Overview
  • 14. Copyright Oracle Corporation 2012 14 MySQL Replication Overview http://technabob.com/blog/2011/12/16/lego-stormtroope-american-beauty/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
  • 15. Copyright Oracle Corporation 2012 15 http://technabob.com/blog/2011/12/16/lego-stormtroope-american-beauty/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL Replication Overview
  • 16. Copyright Oracle Corporation 2012 16  Used for Scalability and HA  Asynchronous as standard  Semi-Synchronous support added in MySQL 5.5  Each slave adds minimal load on master Replication Threads  Binlog dump thread  Slave I/O thread  Slave SQL thread Replication Files  relay log  master info log  relay log info log The master creates a thread to send the binary log contents to a slave when the slave connects. This thread can be identified in the output of SHOW PROCESSLIST on the master as the Binlog Dump thread.  The binlog dump thread acquires a lock on the master's binary log for reading each event that is to be sent to the slave. As soon as the event has been read, the lock is released, even before the event is sent to the slave. *************************** 2. row *************************** Id: 27 User: replication Host: 192.168.0.11:47129 db: NULL Command: Binlog Dump Time: 499 State: Master has sent all binlog to slave; waiting for binlog to be updated Info: NULL MySQL Replication Overview
  • 17. Copyright Oracle Corporation 2012 17  Used for Scalability and HA  Asynchronous as standard  Semi-Synchronous support added in MySQL 5.5  Each slave adds minimal load on master Replication Threads  Binlog dump thread  Slave I/O thread  Slave SQL thread Replication Files  relay log  master info log  relay log info log MySQL Replication Overview When a START SLAVE statement is issued on a slave server, the slave creates an I/O thread, which connects to the master and asks it to send the updates recorded in its binary logs. The slave I/O thread reads the updates that the master's Binlog Dump thread sends and copies them to local files that comprise the slave's relay log. The state of this thread is shown as Slave_IO_running in the output of SHOW SLAVE STATUS or as Slave_running in the output of SHOW STATUS. Slave_IO_Running: Yes | Slave_running | ON |
  • 18. Copyright Oracle Corporation 2012 18  Used for Scalability and HA  Asynchronous as standard  Semi-Synchronous support added in MySQL 5.5  Each slave adds minimal load on master Replication Threads  Binlog dump thread  Slave I/O thread  Slave SQL thread Replication Files  relay log  master info log  relay log info log MySQL Replication Overview The slave creates an SQL thread to read the relay log that is written by the slave I/O thread and execute the events contained therein. Slave_SQL_Running: Yes
  • 19. Copyright Oracle Corporation 2012 19  Used for Scalability and HA  Asynchronous as standard  Semi-Synchronous support added in MySQL 5.5  Each slave adds minimal load on master Replication Threads  Binlog dump thread  Slave I/O thread  Slave SQL thread Replication Files  relay log  master info log  relay log info log MySQL Replication Overview The relay log consists of the events read from the binary log of the master and written by the slave I/O thread. Events in the relay log are executed on the slave as part of the SQL thread. caption text here.
  • 20. Copyright Oracle Corporation 2012 20  Used for Scalability and HA  Asynchronous as standard  Semi-Synchronous support added in MySQL 5.5  Each slave adds minimal load on master Replication Threads  Binlog dump thread  Slave I/O thread  Slave SQL thread Replication Files  relay log  master info log  relay log info log MySQL Replication Overview The master info log contains status and current configuration information for the slave's connection to the master. This log holds information on the master host name, login credentials, and coordinates indicating how far the slave has read from the master's binary log.
  • 21. Copyright Oracle Corporation 2012 21  Used for Scalability and HA  Asynchronous as standard  Semi-Synchronous support added in MySQL 5.5  Each slave adds minimal load on master Replication Threads  Binlog dump thread  Slave I/O thread  Slave SQL thread Replication Files  relay log  master info log  relay log info log MySQL Replication Overview The master info log contains status and current configuration information for the slave's connection to the master. This log holds information on the master host name, login credentials, and coordinates indicating how far the slave has read from the master's binary log.
  • 22. Copyright Oracle Corporation 2012 22  Used for Scalability and HA  Asynchronous as standard  Semi-Synchronous support added in MySQL 5.5  Each slave adds minimal load on master Replication Threads  Binlog dump thread  Slave I/O thread  Slave SQL thread Replication Files  relay log  master info log  relay log info log MySQL Replication Overview The relay log info log holds status information about the execution point within the slave's relay log
  • 23. Copyright Oracle Corporation 2012 23 Replication Formats  Statement-based replication (SBR) – Advantages • Less data written to log files • taking and restoring from backups are faster – Disadvantages • Some functions or queries are nondeterministic and hard to replicate  Row-based replication (RBR) – Advantages • safest form of replication • Fewer row locks are required on the slave – Disadvantages • generate more data that must be logged* • Blob values take longer to replicate  Mixed-format – statement-based logging is used by default – automatically switches to row-based logging in particular cases MySQL Replication Overview http://dev.mysql.com/doc/refman/5.5/en/replication-formats.html http://dev.mysql.com/doc/refman/5.1/en/binary-log-setting.html
  • 24. Copyright Oracle Corporation 2012 24 Asynchronous is standard  events are occurring independently  The master writes events to its binary log but does not know whether or when a slave has retrieved and processed them  if the master crashes, transactions that it has committed might not have been transmitted to any slave Semi-Synchronous support added in MySQL 5.5 ● Original patch: Mark Callaghan and Wei Li, Google Adoptions: Zhenxing He, Sun Microsystems ● acknowledges receipt of a transaction's events only after the events have been written to its relay log and flushed to disk ● best for close servers communicating over fast networks ● timeout occurs without any slave having acknowledged the transaction, the master reverts to asynchronous replication. When at least one semisynchronous slave catches up, the master returns to semisynchronous replication. MySQL Replication Overview http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
  • 25. Copyright Oracle Corporation 2012 25 http://hiconsumption.com/2012/07/star-wars-recreations-of-iconic-photographs-by-david-eger/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL Replication Configuration
  • 26. Copyright Oracle Corporation 2012 26 Master Setup: # vi /etc/my.cnf [mysqld] server-id=1 log-bin = /var/lib/mysql/yoda-bin Start and Log into MySQL master_yoda>show master statusG *************************** 1. row *************************** File: yoda-bin.000001 Position: 114 Binlog_Do_DB: Binlog_Ignore_DB: 1 row in set (0.00 sec) # mysqldump -p --all-databases --master-data=2 > /tmp/replication_example.sql THIS LOCKS THE DATABASE! http://dev.mysql.com/doc/refman/5.5/en/replication-howto-masterbaseconfig.html http://www.minifigures.co.uk/lego/star-wars/master-yoda/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL Replication Configuration
  • 27. Copyright Oracle Corporation 2012 27 On Master : mysql_yoda>CREATE USER 'replication'@'192.168.0.%' IDENTIFIED BY 'slavepass'; mysql_yoda>GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%'; mysql_yoda>flush privileges; Adjust all firewall rules if required for MySQL Port. (3306) http://dev.mysql.com/doc/refman/5.5/en/replication-howto-masterbaseconfig.html http://www.minifigures.co.uk/lego/star-wars/master-yoda/http://www.minifigures.co.uk/lego/star-wars/master-yoda/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL Replication Configuration
  • 28. Copyright Oracle Corporation 2012 28 Slave Setup: vi /etc/my.cnf [mysqld] Server-id=2 relay-log=/var/lib/mysql/luke-relay-bin # optional below log-bin = /var/lib/mysql/luke-bin luke>show master statusG *************************** 1. row *************************** File: luke-bin.000003 Position: 114 Binlog_Do_DB: Binlog_Ignore_DB: 1 row in set (0.00 sec) LOAD DATA: # mysql --user=root -p < /tmp/replication_example.sql http://www.minifigures.co.uk/lego/star-wars/luke-skywalker-on-tatooine/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL Replication Configuration
  • 29. Copyright Oracle Corporation 2012 29 On Slave : mysql_luke> CHANGE MASTER TO MASTER_HOST='yoda', MASTER_USER='replication', MASTER_PASSWORD='slavepass', MASTER_PORT=3306, MASTER_LOG_FILE='yoda-bin.000002', MASTER_LOG_POS=83415, MASTER_CONNECT_RETRY=10; We gathered this info from the mysqldump file via the “ --master-data=2 ” flag. -- CHANGE MASTER TO MASTER_LOG_FILE='yoda-bin.000002', MASTER_LOG_POS=83415; mysql_luke > start slave; Query OK, 0 rows affected (0.00 sec) http://www.minifigures.co.uk/lego/star-wars/luke-skywalker-on-tatooine/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL Replication Configuration
  • 30. Copyright Oracle Corporation 2012 30 On Slave : mysql_luke> show slave statusG mysql_luke> show slave statusG *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: yoda Master_User: replication Master_Port: 3306 Connect_Retry: 10 Master_Log_File: yoda-bin.000003 Read_Master_Log_Pos: 323 Relay_Log_File: luke-relay-bin.000004 Relay_Log_Pos: 475 Relay_Master_Log_File: yoda-bin.000003 Slave_IO_Running: Yes Slave_SQL_Running: Yes Master_Server_Id: 1 Master_UUID: 75d407df-2be4-11e1-9668-b4be9bce39b0 Seconds_Behind_Master: 0 SQL_Remaining_Delay: NULL http://www.minifigures.co.uk/lego/star-wars/luke-skywalker-on-tatooine/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL Replication Configuration
  • 31. Copyright Oracle Corporation 2012 31 Master to Master mysql> SET GLOBAL auto_increment_offset=2; mysql> SET GLOBAL auto_increment_increment=2; mysql_yoda>show global variables like '%auto_increment%'; +--------------------------+-------+ | Variable_name | Value | +--------------------------+-------+ | auto_increment_increment | 2 | | auto_increment_offset | 1 | +--------------------------+-------+ mysql_luke>show global variables like '%auto_increment%'; +--------------------------+-------+ | Variable_name | Value | +--------------------------+-------+ | auto_increment_increment | 2 | | auto_increment_offset | 2 | +--------------------------+-------+ mysql_luke>SHOW MASTER STATUSG *************************** 1. row *************************** File: luke-bin.000005 Position: 295 mysql_yoda>CHANGE MASTER TO MASTER_HOST='luke', MASTER_USER='replication2', MASTER_PASSWORD='slavepass', MASTER_PORT=3306, MASTER_LOG_FILE='luke-bin.000005', MASTER_LOG_POS=295, MASTER_CONNECT_RETRY=10; mysql_yoda> start slave; http://www.minifigures.co.uk/lego/star-wars/master-yoda/ http://legostarwars.wikia.com/wiki/Luke_Skywalker_%28Jedi%29 TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL Replication Configuration
  • 32. Copyright Oracle Corporation 2012 32 Setting up replication with utilities mysqlreplicate --master=root@master.example.com --slave=root@slave.example.com --rpl-user=repl:xyzzy http://mysqlworkbench.org/utilities/man/mysqlreplicate.html Require master and slave to be off-line! https://github.com/greyrl/generaltools/blob/master/mysqlreplicate.py http://www.minifigures.co.uk/lego/star-wars/master-yoda/ http://www.minifigures.co.uk/lego/star-wars/luke-skywalker-on-tatooine/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL 5.6: Replication Utilities (Python)
  • 33. Copyright Oracle Corporation 2012 33 http://www.flickr.com/photos/kalexanderson/7719347704/in/set-72157628651430439/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL 5.6: Replication New!
  • 34. Copyright Oracle Corporation 2012 34  Global Transaction IDs  MySQL Utilities  Multi-Threaded Slaves  Binary Log Group Commit  Optimized Row Based Replication  Crash Safe Slaves  Replication Event Checksums  Time Delayed Replication http://dev.mysql.com/doc/refman/5.6/en/replication-features.html http://dev.mysql.com/downloads/mysql/#downloads Under Development Releases MySQL 5.6: Replication New!
  • 35. Copyright Oracle Corporation 2012 35 MySQL 5.6: Replication New! Global Transaction Ids  Simple to track & compare replication across the cluster - Unique identifier for each transaction written to the Binlog  Automatically identify the most up-to-date slave for failover  Deploy n-tier replication hierarchies Master GTID=123456 GTID=123456 GTID=123456 GTID=123456
  • 36. Master GTID=123456 GTID=123456 GTID=123456 GTID=123456 CHANGE MASTER TO?? Slave(s) can start from same GTID ● reference a global transaction identifier and not have to convert binary log filenames and offsets between different servers Copyright Oracle Corporation 2012 36 MySQL 5.6: Replication New! Global Transaction Ids
  • 37. MySQL 5.6: Replication HA Utilities (Python)  Enabling self-healing replication topologies  Automated failover & recovery - mysqlfailover Utility  Switchover & administration - mysqlrpladmin Utility  Delivers HA within the core MySQL distribution - Eliminates the need for 3rd party solutions - Allows extensibility to support variety of HA mechanisms https://launchpad.net/mysql-utilities/ Failed Master Promoted Master Slaves Monitoring HA Utilities
  • 38. • Database Operations • mysqldbcompare – compare databases • mysqldbcopy – copy databases between servers • mysqldbexport – export metadata and data • mysqldbimport – import metadata and data • mysqldiff – compare object definitions • General Utilities • mysqldiskusage – show disk usage for databases • mysqlindexcheck – check for redundant indexes • mysqlmetagrep – search metadata • mysqlprocgrep – search process information • mysqluserclone – clone a user account MySQL 5.6: Replication HA Utilities (Python)
  • 39. • High Availability • mysqlfailover – automatic failover for MySQL 5.6.5+ • mysqlreplicate – setup replication • mysqlrpladmin – general replication  administration • switchover • failover for MySQL 5.6.5  • mysqlrplcheck – check replication configuration • mysqlrplshow – display map of replication  topology • Server Operations • mysqlserverclone – start a scratch server • mysqlserverinfo – show server information MySQL 5.6: Replication HA Utilities (Python)
  • 40. How do I access the utilities?
  • 41. Copyright Oracle Corporation 2012 41 MySQL 5.6: Replication Multi-Threaded Slaves  Increases slave throughput, reducing lag  All transactions received into slave’s relay log  Implements multiple SQL threads, based on database  Applies events to different databases in parallel  Great for systems which isolate application data using databases – e.g. multi-tenant  5x performance gain  SysBench, running across 10 x schemas  Oracle Linux 6.1, Oracle Sun Fire x4150 m2 Server 0 5 10 0 50 100 150 200 250 300 Multi-Threaded Slave Performance Worker Threads QueriesperSecond
  • 42. Copyright Oracle Corporation 2012 42 Throughput of slave increased by allowing multiple slave threads: ● 0 - functionality disabled ● 0 to 1024 Exec_Master_Log_Posn in SHOW SLAVE STATUS represents a “low-water” mark, before which no uncommitted transactions remain. Configure using: ● slave-parallel-workers=4 On a per-database basis ● can process successive transactions on a given database without waiting for updates on other databases to complete http://dev.mysql.com/doc/refman/5.6/en/replication-options-slave.html#sysvar_slave_parallel_workers MySQL 5.6: Replication Multi-Threaded Slaves
  • 43. Copyright Oracle Corporation 2012 43 mysql_luke> show slave statusG *************************** 1. row *************************** .... Exec_Master_Log_Pos: 114 mysql> show global variables like '%workers%'; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | slave_parallel_workers | 0 | +------------------------+-------+ 1 row in set (0.00 sec) mysql> SET GLOBAL slave_parallel_workers=4; Query OK, 0 rows affected (0.00 sec) mysql> show global variables like '%workers%'; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | slave_parallel_workers | 4 | +------------------------+-------+ 1 row in set (0.00 sec) http://dev.mysql.com/doc/refman/5.6/en/replication-options-slave.html#sysvar_slave_parallel_workers MySQL 5.6: Replication Multi-Threaded Slaves
  • 44. Copyright Oracle Corporation 2012 44 MySQL 5.6: Replication Binary Log Group Commit  Increases replication throughput by increasing performance of the master  Commits multiple transactions as a group to Binlog on disk  Finer grained locking; reducing lock wait times Binary Log T4 Session T1 T2 T3 Group commit T4 Master Database 155% Performance Gain
  • 45. Copyright Oracle Corporation 2012 45 MySQL 5.6: Replication Optimized Row Base Replication Primary Key Changed Columns  New option: binlog-row-image=minimal  Increases throughput for master and slave - Reduces Binlog size, memory & network bandwidth  Only replicates elements of the Row image that have changed
  • 46. Copyright Oracle Corporation 2012 46 Problem: Slave thread commits and then updates slave data. what if it crashes in-between? ● recovery issues - where to restart replication from? ● file corruption vulnerability ● administration hassle Solution: store data in (transactional) tables: ● slave's data is updated transactionally ● engine agnostic ● crash-safeness (requires transactional tables) frees the DBA to manually recover transactions after a crash http://farm6.static.flickr.com/5024/5554971120_df447dd31c.jpg TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL 5.6: Crash safe Slaves, BinLog
  • 47. Copyright Oracle Corporation 2012 47 MySQL 5.6: Crash safe Slaves, BinLog • Automatic recovery of a slave and Binlog after a failure • Binlog and table data are transactionally consistent • Resumes replication without Dev/Op intervention • Automatically rolling back replication to last committed event • Eliminates risk of data loss or corruption Data Position Info CRASH! Data Position Info Atomic Atomic Before: – Transaction Data: in tables – Replication Info: in files MySQL 5.6 – Transaction Data: in tables – Replication Info: in tables Time Time
  • 48. Copyright Oracle Corporation 2012 48 ● System tables: slave_master_info (mysql.slave_master_info) --master-info-repository=TABLE slave_relay_log_info (mysql.slave_relay_log_info) --relay-log-info-repository=TABLE mysql_slave> stop slave; mysql_slave> SET GLOBAL master_info_repository = 'TABLE'; mysql_slave> SET GLOBAL relay_log_info_repository = 'TABLE'; mysql_slave> start slave; Make sure you add to my.cnf – master-info-repository =TABLE ● relay-log-info-repository =TABLE ● Transactional tables enables transactional slave positions ● Automatic conversion between files and tables on startup ● Long time awaited feature http://dev.mysql.com/doc/refman/5.6/en/replication-options-binary-log.html MySQL 5.6: Crash safe Slaves, BinLog
  • 49. Copyright Oracle Corporation 2012 49 mysql_slave> select * from slave_master_info G *************************** 1. row *************************** Master_id: 2 Number_of_lines: 22 Master_log_name: yoda-bin.000003 Master_log_pos: 323 Host: yoda User_name: replication User_password: slavepass Port: 3306 Connect_retry: 10 Enabled_ssl: 0 Ssl_ca: Ssl_capath: Ssl_cert: Ssl_cipher: Ssl_key: Ssl_verify_server_cert: 0 Heartbeat: 1800 Bind: Ignored_server_ids: 0 Uuid: 75d407df-2be4-11e1-9668-b4be9bce39b0 Retry_count: 86400 Ssl_crl: Ssl_crlpath: 1 row in set (0.00 sec) MySQL 5.6: Crash safe Slaves, BinLog
  • 50. Copyright Oracle Corporation 2012 50 MySQL 5.6: Replication Event Checksums  Ensures replicated data is correct, consistent and accessible  Detects corrupt replication events before they’re applied – Returns an error  Protects entire replication path – Memory – Disk – Network – Bugs Master Slave
  • 51. Copyright Oracle Corporation 2012 51 Problem: Make replication slave to lag a specified amount of time behind the master to: ● To protect against user mistakes on the master. ● To test how the system behaves when there is a lag. ● To inspect what the database looked like long ago, without having to reload a backup. Solution: The slave waits until a given number of seconds elapses before applying the changes: ● Delays configured per slave: flexible deployment; ● Are implemented in the SQL thread layer. ● Rolling Database Backups with Relayed Replication MySQL 5.6: Replication Time Delayed Replication
  • 52. Copyright Oracle Corporation 2012 52 User interface: ● CHANGE MASTER TO MASTER_DELAY = <NUM_SECONDS>; ● mysql> stop slave; ● mysql> CHANGE MASTER TO MASTER_DELAY=86400; start slave; ● SHOW SLAVE STATUS: ● SQL_Delay: 86400 ● SQL_Remaining_Delay: 86395 ● Slave_SQL_Running_State: Waiting until MASTER_DELAY seconds after master executed event ● RESET SLAVE clears the configured delay; Rolling forward delayed slaves until bad event: START SLAVE [SQL_THREAD] UNTIL MASTER_LOG_FILE = 'log_name', MASTER_LOG_POS = log_pos http://dev.mysql.com/doc/refman/5.6/en/replication-delayed.html http://dev.mysql.com/doc/refman/5.6/en/start-slave.html MySQL 5.6: Replication Time Delayed Replication
  • 53. Copyright Oracle Corporation 2012 53 slave2> CHANGE MASTER TO -> MASTER_HOST = 'localhost', -> MASTER_PORT = 3306, -> MASTER_USER = 'repl_user', -> MASTER_PASSWORD = 'pw', -> MASTER_DELAY = 86400; slave2> START SLAVE; MySQL 5.6: Replication Time Delayed Replication
  • 54. Copyright Oracle Corporation 2012 54 mysql_luke> STOP SLAVE; mysql_luke>SHOW RELAYLOG EVENTS FROM 2337G *************************** 4. row *************************** Log_name: luke-relay-bin.000005 Pos: 2674 Event_type: Query Server_id: 1 End_log_pos: 2623 Info: drop database tatooine mysql_luke> START SLAVE UNTIL -> MASTER_LOG_FILE='luke-relay-bin.000005', -> MASTER_LOG_POS=2674; http://www.minifigures.co.uk/lego/star-wars/darth-vader-minifig/ TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved. MySQL 5.6: Replication Time Delayed Replication
  • 55. Copyright Oracle Corporation 2012 55 ● Do you know when a slave is behind? ● What type of topology do you have? ● Alerted on Errors? ● Slow Queries? MySQL Enterprise Monitor All the slaves paying attention? http://www.stormgrounds.com/fullwallpaper/320/Storm-Trooper-Legos TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
  • 56. Copyright Oracle Corporation 2012 56 ● Global view of MySQL environment ● Automated, rules-based monitoring and alerts (SMTP, SNMP enabled) ● Query capture, monitoring, analysis and tuning, correlated with Monitor graphs ● Visual monitoring of “hot” applications and servers ● Real-time Replication Monitor with auto-discovery of master-slave topologies ● Integrated with MySQL Support MySQL Enterprise Monitor
  • 57. Copyright Oracle Corporation 2012 57 MySQL Enterprise Monitor MySQL Replication Monitoring
  • 58. Copyright Oracle Corporation 2012 58 MySQL User Groups North America ● Atlanta, GA ● Austin, TX ● Boise, ID ● Boston, MA ● Cleveland, OH ● Denver, CO ● Dallas, TX ● Huntsville, AL ● Los Angeles, CA Japan and APAC ● Taiwan ● Indonesia Europe ● Helsinki ● London ● France Middle East ● Dubai ● Turkey Complete list of MySQL user groups https://wikis.oracle.com/display/mysql/List+of+MySQL+User+ Groups MySQL Community Managers Dave Stokes (david.stokes@oracle.com) Keith Larson (keith.larson@oracle.com) South America ● Brazil ● Indonesia Oceania ● Sydney Australia Middle East ● Dubai ● Turkey ● Montreal, CAN ● Minneapolis, MN ● New York, NY ● New Jersey, NJ ● Philadelphia, PA ● Raleigh, NC ● San Francisco, CA ● Seattle, WA ● Toronto, CAN Top Active MySQL User Groups
  • 59. Copyright Oracle Corporation 2012 59 MySQL Available Now Development Releases: ● http://dev.mysql.com/downloads/mysql/#downloads Evaluate the new features ● Questions & Feedback: forums.mysql.com/list.php?26 ● Bugs: bugs.mysql.com/ Replication in MySQL 5.5 ● mysql.com/why-mysql/white-papers/mysql-wp-replication.php Replication 5.6 documentation ● dev.mysql.com/doc/refman/5.6/en/replication.html Planet ● Planet.mysql.com MySQL High Availability ● http://shop.oreilly.com/product/9780596807290.do Learn more about HA Solutions for MySQL ● mysql.com/why-mysql/white-papers/mysql_wp_ha_strategy_guide.php http://www.stormgrounds.com/wallpaper/Miscellaneous/Stormtrooper-under-Keyboard TM & © 2012 Lucasfilm Ltd. All rights reserved. ©2012 The LEGO Group. All rights reserved.
  • 60. Copyright Oracle Corporation 2012 60 keith.larson@oracle.com @larsonkeith http://www.flickr.com/photos/kalexanderson/7964300088/sizes/l/in/photostream/
  • 61. <Insert Picture Here> Thanks for attending! keith.larson@oracle.com sqlhjalp.blogspot.com sqlhjalp.com/pdf/