SlideShare una empresa de Scribd logo
1 de 39
Descargar para leer sin conexión
Linas Virbalas
                    Continuent, Inc.



© Continuent 2010
/  Definition & Motivation
  /  Scoping the Challenge
  /  MySQL ->
           •  PostgreSQL
           •  Oracle
           •  MongoDB
  /  Demo 1
  /  PostgreSQL ->
           •  MySQL
  /  Demo 2
  /  Q&A



© Continuent 2010
© Continuent 2010
Heterogeneous Replication
                               
       Replication between different types of DBMS




© Continuent 2010
1.  Real-time integration of data between different DBMS
      types
  2.  Seamless migration out of one DBMS type to another
  3.  Data warehousing (real-time) from different DBMS
      types
  4.  Leveraging specific SQL power of other DBMS types




© Continuent 2010
/        Name: Linas Virbalas
  /        Country: Lithuania
  /        Implementing for Tungsten:
         •          MySQL -> PostgreSQL
         •          MySQL -> Greenplum
         •          MySQL -> Oracle
         •          PostgreSQL WAL
         •          PostgreSQL Streaming Replication
         •          PostgreSQL Logical Replication
                    via Slony logs


  /        Blog:
           http://flyingclusters.blogspot.com


© Continuent 2010
© Continuent 2010
1.  MySQL -> …
         •          Replicating from MySQL to PostgreSQL/Greenplum, Oracle,
                    MongoDB
  2.  PostgreSQL -> …
         •          Replicating from PostgreSQL to MySQL




© Continuent 2010
With Tungsten Replicator




© Continuent 2010
/        Open Source GPL v2
  /        JAVA
  /        Interfaces to implement new:
         •          Extractors
         •          Filters
         •          Appliers
  /        Multiple replication services per one process




© Continuent 2010
Technology: Replication Pipelines




© Continuent 2010
© Continuent 2010
/  Statement Based Replication




  /  Row Based Replication




© Continuent 2010
© Continuent 2010
Master         Slave
                    Replicator    Replicator

                    Transaction   Transaction
                    History Log   History Log
                      Filters       Filters
                     MySQL        PostgreSQL
                     Extractor      Applier




© Continuent 2010
/  Provisioning
  /  Data Type Differences
  /  Database vs. Schema
  /  Default (Implicitly Defined) Schema Selection
  /  SQL Dialect Differences
           •  Statement Replication vs. Row Replication
  /  Character Sets and Binary Data
  /  Old Versions of MySQL




© Continuent 2010
Provisioning

 /  Harder way: Dump data explicitly




 /  Easier way: Replicate a mysqldump backup



                          Replicator




© Continuent 2010
/  Note the type differences between MySQL and PG

                        MySQL                PostgreSQL
                    !   TINYINT              SMALLINT
                        SMALLINT             SMALLINT
                        INTEGER              INTEGER
                        BIGINT               BIGINT
                    !   CHAR(1)              CHAR(5) = {‘true’, ‘false’}
                        CHAR(x)              CHAR(x)
                        VARCHAR(x)           VARCHAR(x)
                        DATE                 DATE
                        TIMESTAMP            TIMESTAMP
                    !   TEXT (diff. sizes)   TEXT
                    !   BLOB                 BYTEA
                        …
© Continuent 2010
Database vs. Schema

  /  In MySQL these are the same:
    ! !CREATE DATABASE foo!
    ! !CREATE SCHEMA foo!
  /  In PostgreSQL these are very different:
                    CREATE DATABASE foo!
    ! !CREATE SCHEMA foo!
  /  Tungsten uses filters to rectify MySQL databases to
     PostgreSQL schemas




© Continuent 2010
/  MySQL: Trivial to use `USE`
  /  MySQL: Going without `USE` generates different
     events
                        MySQL Implicit            MySQL Explicit
                        CREATE SCHEMA s;          CREATE SCHEMA s;
                        USE s;
                    !   CREATE TABLE t (i int);   CREATE TABLE s.t (i int);
                    !   INSERT INTO t (1);        INSERT INTO s.t (1);


  /  PG: Extract the default schema from the event
  /  PG: Set it before applying
                    MySQL            PostgreSQL
                    USE s;       >   SET search_path TO s, "$user”;
© Continuent 2010
/  Differences between DDL and DML statement SQL
     dialects
  /  Row Replication resolves issues rising from
     differences in DML, but still leaves DDL to handle
  /  Tungsten Replicator Filters come to the rescue!
           •  Simple to develop Java or JavaScript extensions
           •  Event structure IN -> Filter -> Event structure OUT

          MySQL                          PostgreSQL
          CREATE TABLE complex (id       CREATE TABLE complex (id
          INTEGER AUTO_INCREMENT         SERIAL PRIMARY KEY, i INT);
          PRIMARY KEY, i INT);

          CREATE TABLE dt (i TINYINT);    CREATE TABLE dt (i SMALLINT);
          …


© Continuent 2010
/  Statement replication: MySQL syntax is “permissive”
      /  Embedded binary / alternate charsets
      /  Different charsets for different clients
  /  Row replication: database/table/column charsets
     may differ
  /  Answer: Stick with one character set throughout; use
     row replication to move binary data
          MySQL                           PostgreSQL
          INSERT INTO embedded_blob ARGH!!! (SQL statement fails)
          (key, data) VALUES (1, ‘?0^Es
          0^0’’)
          create table xlate(id int, d1   ARGH!!! (no way to translate to
          varchar(25) character set       common charset)
          latin1, d2 varchar(25)
          character set utf8);
© Continuent 2010
MySQL Versions

  /  Problem: Data stored on hard-to-replicate MySQL
     versions or configurations
           •  Row replication not enabled (5.1)
           •  No row replication support (5.0, 4.1)
           •  Tungsten cannot read binlog (4.1)
  /  Answer: MySQL blackhole replication
           •  (Blackhole = no store, just a binlog)
           •  Caveat: Check MySQL docs carefully


                                                      Replicator




© Continuent 2010
© Continuent 2010
Master         Slave
                    Replicator    Replicator

                    Transaction   Transaction
                    History Log   History Log
                      Filters       Filters
                     MySQL          Oracle
                     Extractor      Applier




© Continuent 2010
/  TEXT length limitation
           •  VARCHAR(4000) => CLOB
  /  Primary Keys and PrimaryKeyFilter
           •  Goal:

               UPDATE t SET

               c1 = x1, c2 = x2, c3 = x3

               WHERE

               p = p1


           •  NOT:

               UPDATE t SET

               c1 = x1, c2 = x2, c3 = x3

               WHERE

               p = p1 AND c1 = x1 AND c2 = x2 AND c3 = x3 AND …!


© Continuent 2010
© Continuent 2010
> use mydb

    switched to db mydb!
  > db.test.insert(

    {"test": "test value", "anumber" : 5 }

    )!
  > db.test.find()

    {

    "_id" : ObjectId("4dce9a4f3d6e186ffccdd4bb"),

    "test" : "test value", "anumber" : 5

    }!
  > exit!




© Continuent 2010
/  MySQL binary log doesn’t hold column names

           •  mysql> INSERT INTO foo (id, data) VALUES

              (1, 'hello from MySQL!');

         •          If nothing done becomes:

                    >   db.foo.find();

                    {   "_id" : ObjectId("4dc55e45ad90a25b9b57909d"),

                    "   " : "1”,

                    "   " : "hello from MySQL!”}


         •          Solution: to fill in column names on master side. Then:

                    > db.foo.find();

                    { "_id" : ObjectId("4dc55e45ad90a25b9b57909d"),

                    ” " : "1”,

                    “    " : "hello from MySQL!”}

© Continuent 2010
MySQL -> MongoDB: The Pipeline




© Continuent 2010
© Continuent 2010
© Continuent 2010
Logical   Physical
                           MySQL Statement Based           x
                                 MySQL Row Based           x
                                      MySQL Mixed          x
                         PostgreSQL WAL Shipping                     x
                PostgreSQL Streaming Replication                     x
               Filters (data transformation) possible     +          -
                    Different data/structure on slave     +          -
                                             possible

  /  A transaction is not accessible to the replicator under
     physical replication
  /  Tungsten Replicator manages WAL/Streaming
     Replication

© Continuent 2010
Logical   Physical
                           MySQL Statement Based           x
                                 MySQL Row Based           x
                                      MySQL Mixed          x
                         PostgreSQL WAL Shipping                     x
                PostgreSQL Streaming Replication                     x
                           Tungsten Replicator w/          x
                        PostgreSQLSlonyExtractor
               Filters (data transformation) possible     +          -
                    Different data/structure on slave     +          -
                                             possible

  /  With PostgreSQLSlonyExtractor transaction goes
     through the Replicator pipeline


© Continuent 2010
Master           Slave
 Replicator      Replicator

 Transaction     Transaction
 History Log     History Log
   Filters          Filters
 PostgreSQL      MySQLApplier
SlonyExtractor
© Continuent 2010
/  We’ve reviewed an open source heterogeneous
     replicator (professional services available upon request)
  /  Tungsten Replicator encapsulates the complexity and
     corner cases of the subject
  /  Replicating:
           •  out of MySQL – now;
           •  out of PostgreSQL – prototype;
           •  out of Oracle – designs ready, awaiting sponsorship.




© Continuent 2010
© Continuent 2010
Open Source                      Commercial
   http://tungsten-replicator.org   sales@continuent.com
   #tungsten @ irc.freenode.net

   My Blog:
   http://flyingclusters.blogspot.com



                       Continuent Web Site:
                    http://www.continuent.com


© Continuent 2010

Más contenido relacionado

La actualidad más candente

Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Dave Stokes
 
Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational databaseDave Stokes
 
BITS: Introduction to relational databases and MySQL - Schema design
BITS: Introduction to relational databases and MySQL - Schema designBITS: Introduction to relational databases and MySQL - Schema design
BITS: Introduction to relational databases and MySQL - Schema designBITS
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDave Stokes
 
Discover the Power of the NoSQL + SQL with MySQL
Discover the Power of the NoSQL + SQL with MySQLDiscover the Power of the NoSQL + SQL with MySQL
Discover the Power of the NoSQL + SQL with MySQLDave Stokes
 
Open Source World June '21 -- JSON Within a Relational Database
Open Source World June '21 -- JSON Within a Relational DatabaseOpen Source World June '21 -- JSON Within a Relational Database
Open Source World June '21 -- JSON Within a Relational DatabaseDave Stokes
 
NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010Ben Scofield
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationDave Stokes
 
Developing for Node.JS with MySQL and NoSQL
Developing for Node.JS with MySQL and NoSQLDeveloping for Node.JS with MySQL and NoSQL
Developing for Node.JS with MySQL and NoSQLJohn David Duncan
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialJean-François Gagné
 
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Dave Stokes
 
Replication Tips & Tricks
Replication Tips & TricksReplication Tips & Tricks
Replication Tips & TricksMats Kindahl
 
MySQL as a Document Store
MySQL as a Document StoreMySQL as a Document Store
MySQL as a Document StoreDave Stokes
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Dave Stokes
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationDave Stokes
 
Replication Tips & Trick for SMUG
Replication Tips & Trick for SMUGReplication Tips & Trick for SMUG
Replication Tips & Trick for SMUGMats Kindahl
 

La actualidad más candente (20)

Postgresql
PostgresqlPostgresql
Postgresql
 
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
 
MySQL JSON Functions
MySQL JSON FunctionsMySQL JSON Functions
MySQL JSON Functions
 
Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational database
 
BITS: Introduction to relational databases and MySQL - Schema design
BITS: Introduction to relational databases and MySQL - Schema designBITS: Introduction to relational databases and MySQL - Schema design
BITS: Introduction to relational databases and MySQL - Schema design
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
 
Java7 normandyjug
Java7 normandyjugJava7 normandyjug
Java7 normandyjug
 
Discover the Power of the NoSQL + SQL with MySQL
Discover the Power of the NoSQL + SQL with MySQLDiscover the Power of the NoSQL + SQL with MySQL
Discover the Power of the NoSQL + SQL with MySQL
 
Open Source World June '21 -- JSON Within a Relational Database
Open Source World June '21 -- JSON Within a Relational DatabaseOpen Source World June '21 -- JSON Within a Relational Database
Open Source World June '21 -- JSON Within a Relational Database
 
NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentation
 
Developing for Node.JS with MySQL and NoSQL
Developing for Node.JS with MySQL and NoSQLDeveloping for Node.JS with MySQL and NoSQL
Developing for Node.JS with MySQL and NoSQL
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
 
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
 
Replication Tips & Tricks
Replication Tips & TricksReplication Tips & Tricks
Replication Tips & Tricks
 
MySQL as a Document Store
MySQL as a Document StoreMySQL as a Document Store
MySQL as a Document Store
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my!
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentation
 
Replication Tips & Trick for SMUG
Replication Tips & Trick for SMUGReplication Tips & Trick for SMUG
Replication Tips & Trick for SMUG
 
Cassandra 3.0
Cassandra 3.0Cassandra 3.0
Cassandra 3.0
 

Destacado

Destacado (20)

RDBMS
RDBMSRDBMS
RDBMS
 
Dbms anomalies
Dbms anomaliesDbms anomalies
Dbms anomalies
 
DBMS information in detail || Dbms (lab) ppt
DBMS information in detail || Dbms (lab) pptDBMS information in detail || Dbms (lab) ppt
DBMS information in detail || Dbms (lab) ppt
 
Diffrence between dbms and rdbms
Diffrence between dbms and rdbmsDiffrence between dbms and rdbms
Diffrence between dbms and rdbms
 
Rdbms
RdbmsRdbms
Rdbms
 
physical and logical data independence
physical and logical data independencephysical and logical data independence
physical and logical data independence
 
Relational database management system (rdbms) i
Relational database management system (rdbms) iRelational database management system (rdbms) i
Relational database management system (rdbms) i
 
NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)
NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)
NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)
 
Mobile dbms
Mobile dbmsMobile dbms
Mobile dbms
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
 
Dbms
DbmsDbms
Dbms
 
Types dbms
Types dbmsTypes dbms
Types dbms
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
 
Data base management system
Data base management systemData base management system
Data base management system
 
Dbms models
Dbms modelsDbms models
Dbms models
 
Types of databases
Types of databasesTypes of databases
Types of databases
 
Data Base Management System
Data Base Management SystemData Base Management System
Data Base Management System
 
Database management system
Database management systemDatabase management system
Database management system
 
Dbms slides
Dbms slidesDbms slides
Dbms slides
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 

Similar a Breaking the-database-type-barrier-replicating-across-different-dbms

Tungsten Use Case: How Gittigidiyor (a subsidiary of eBay) Replicates Data In...
Tungsten Use Case: How Gittigidiyor (a subsidiary of eBay) Replicates Data In...Tungsten Use Case: How Gittigidiyor (a subsidiary of eBay) Replicates Data In...
Tungsten Use Case: How Gittigidiyor (a subsidiary of eBay) Replicates Data In...Continuent
 
Replicate Oracle to Oracle, Oracle to MySQL, and Oracle to Analytics
Replicate Oracle to Oracle, Oracle to MySQL, and Oracle to AnalyticsReplicate Oracle to Oracle, Oracle to MySQL, and Oracle to Analytics
Replicate Oracle to Oracle, Oracle to MySQL, and Oracle to AnalyticsLinas Virbalas
 
Replicate from Oracle to Oracle, Oracle to MySQL, and Oracle to Analytics
Replicate from Oracle to Oracle, Oracle to MySQL, and Oracle to AnalyticsReplicate from Oracle to Oracle, Oracle to MySQL, and Oracle to Analytics
Replicate from Oracle to Oracle, Oracle to MySQL, and Oracle to AnalyticsContinuent
 
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007eLiberatica
 
Squeak DBX
Squeak DBXSqueak DBX
Squeak DBXESUG
 
Tungsten University: Replicate Between MySQL And Oracle
Tungsten University: Replicate Between MySQL And OracleTungsten University: Replicate Between MySQL And Oracle
Tungsten University: Replicate Between MySQL And OracleContinuent
 
Denver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierDenver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierKellyn Pot'Vin-Gorman
 
Real-Time Data Loading from MySQL to Hadoop with New Tungsten Replicator 3.0
Real-Time Data Loading from MySQL to Hadoop with New Tungsten Replicator 3.0Real-Time Data Loading from MySQL to Hadoop with New Tungsten Replicator 3.0
Real-Time Data Loading from MySQL to Hadoop with New Tungsten Replicator 3.0Continuent
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)Jean-François Gagné
 
Postgres Plus Advanced Server 9.2新機能ご紹介
Postgres Plus Advanced Server 9.2新機能ご紹介Postgres Plus Advanced Server 9.2新機能ご紹介
Postgres Plus Advanced Server 9.2新機能ご紹介Yuji Fujita
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Michael Renner
 
Vote NO for MySQL
Vote NO for MySQLVote NO for MySQL
Vote NO for MySQLUlf Wendel
 
No SQL, No problem - using MongoDB in Ruby
No SQL, No problem - using MongoDB in RubyNo SQL, No problem - using MongoDB in Ruby
No SQL, No problem - using MongoDB in Rubysbeam
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentationIlya Bogunov
 
MySQL overview
MySQL overviewMySQL overview
MySQL overviewMarco Tusa
 
NOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
NOSQL Meets Relational - The MySQL Ecosystem Gains More FlexibilityNOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
NOSQL Meets Relational - The MySQL Ecosystem Gains More FlexibilityIvan Zoratti
 

Similar a Breaking the-database-type-barrier-replicating-across-different-dbms (20)

Tungsten Use Case: How Gittigidiyor (a subsidiary of eBay) Replicates Data In...
Tungsten Use Case: How Gittigidiyor (a subsidiary of eBay) Replicates Data In...Tungsten Use Case: How Gittigidiyor (a subsidiary of eBay) Replicates Data In...
Tungsten Use Case: How Gittigidiyor (a subsidiary of eBay) Replicates Data In...
 
Replicate Oracle to Oracle, Oracle to MySQL, and Oracle to Analytics
Replicate Oracle to Oracle, Oracle to MySQL, and Oracle to AnalyticsReplicate Oracle to Oracle, Oracle to MySQL, and Oracle to Analytics
Replicate Oracle to Oracle, Oracle to MySQL, and Oracle to Analytics
 
Replicate from Oracle to Oracle, Oracle to MySQL, and Oracle to Analytics
Replicate from Oracle to Oracle, Oracle to MySQL, and Oracle to AnalyticsReplicate from Oracle to Oracle, Oracle to MySQL, and Oracle to Analytics
Replicate from Oracle to Oracle, Oracle to MySQL, and Oracle to Analytics
 
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
 
Squeak DBX
Squeak DBXSqueak DBX
Squeak DBX
 
MySQL8.0 in COSCUP2017
MySQL8.0 in COSCUP2017MySQL8.0 in COSCUP2017
MySQL8.0 in COSCUP2017
 
Tungsten University: Replicate Between MySQL And Oracle
Tungsten University: Replicate Between MySQL And OracleTungsten University: Replicate Between MySQL And Oracle
Tungsten University: Replicate Between MySQL And Oracle
 
Mysql database
Mysql databaseMysql database
Mysql database
 
NoSQL with MySQL
NoSQL with MySQLNoSQL with MySQL
NoSQL with MySQL
 
Denver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierDenver SQL Saturday The Next Frontier
Denver SQL Saturday The Next Frontier
 
Real-Time Data Loading from MySQL to Hadoop with New Tungsten Replicator 3.0
Real-Time Data Loading from MySQL to Hadoop with New Tungsten Replicator 3.0Real-Time Data Loading from MySQL to Hadoop with New Tungsten Replicator 3.0
Real-Time Data Loading from MySQL to Hadoop with New Tungsten Replicator 3.0
 
Copy Data Management for the DBA
Copy Data Management for the DBACopy Data Management for the DBA
Copy Data Management for the DBA
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
 
Postgres Plus Advanced Server 9.2新機能ご紹介
Postgres Plus Advanced Server 9.2新機能ご紹介Postgres Plus Advanced Server 9.2新機能ご紹介
Postgres Plus Advanced Server 9.2新機能ご紹介
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
Vote NO for MySQL
Vote NO for MySQLVote NO for MySQL
Vote NO for MySQL
 
No SQL, No problem - using MongoDB in Ruby
No SQL, No problem - using MongoDB in RubyNo SQL, No problem - using MongoDB in Ruby
No SQL, No problem - using MongoDB in Ruby
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentation
 
MySQL overview
MySQL overviewMySQL overview
MySQL overview
 
NOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
NOSQL Meets Relational - The MySQL Ecosystem Gains More FlexibilityNOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
NOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
 

Último

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Último (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

Breaking the-database-type-barrier-replicating-across-different-dbms

  • 1. Linas Virbalas Continuent, Inc. © Continuent 2010
  • 2. /  Definition & Motivation /  Scoping the Challenge /  MySQL -> •  PostgreSQL •  Oracle •  MongoDB /  Demo 1 /  PostgreSQL -> •  MySQL /  Demo 2 /  Q&A © Continuent 2010
  • 4. Heterogeneous Replication  Replication between different types of DBMS © Continuent 2010
  • 5. 1.  Real-time integration of data between different DBMS types 2.  Seamless migration out of one DBMS type to another 3.  Data warehousing (real-time) from different DBMS types 4.  Leveraging specific SQL power of other DBMS types © Continuent 2010
  • 6. /  Name: Linas Virbalas /  Country: Lithuania /  Implementing for Tungsten: •  MySQL -> PostgreSQL •  MySQL -> Greenplum •  MySQL -> Oracle •  PostgreSQL WAL •  PostgreSQL Streaming Replication •  PostgreSQL Logical Replication via Slony logs /  Blog: http://flyingclusters.blogspot.com © Continuent 2010
  • 8. 1.  MySQL -> … •  Replicating from MySQL to PostgreSQL/Greenplum, Oracle, MongoDB 2.  PostgreSQL -> … •  Replicating from PostgreSQL to MySQL © Continuent 2010
  • 9. With Tungsten Replicator © Continuent 2010
  • 10. /  Open Source GPL v2 /  JAVA /  Interfaces to implement new: •  Extractors •  Filters •  Appliers /  Multiple replication services per one process © Continuent 2010
  • 13. /  Statement Based Replication /  Row Based Replication © Continuent 2010
  • 15. Master Slave Replicator Replicator Transaction Transaction History Log History Log Filters Filters MySQL PostgreSQL Extractor Applier © Continuent 2010
  • 16. /  Provisioning /  Data Type Differences /  Database vs. Schema /  Default (Implicitly Defined) Schema Selection /  SQL Dialect Differences •  Statement Replication vs. Row Replication /  Character Sets and Binary Data /  Old Versions of MySQL © Continuent 2010
  • 17. Provisioning /  Harder way: Dump data explicitly /  Easier way: Replicate a mysqldump backup Replicator © Continuent 2010
  • 18. /  Note the type differences between MySQL and PG MySQL PostgreSQL ! TINYINT SMALLINT SMALLINT SMALLINT INTEGER INTEGER BIGINT BIGINT ! CHAR(1) CHAR(5) = {‘true’, ‘false’} CHAR(x) CHAR(x) VARCHAR(x) VARCHAR(x) DATE DATE TIMESTAMP TIMESTAMP ! TEXT (diff. sizes) TEXT ! BLOB BYTEA … © Continuent 2010
  • 19. Database vs. Schema /  In MySQL these are the same: ! !CREATE DATABASE foo! ! !CREATE SCHEMA foo! /  In PostgreSQL these are very different: CREATE DATABASE foo! ! !CREATE SCHEMA foo! /  Tungsten uses filters to rectify MySQL databases to PostgreSQL schemas © Continuent 2010
  • 20. /  MySQL: Trivial to use `USE` /  MySQL: Going without `USE` generates different events MySQL Implicit MySQL Explicit CREATE SCHEMA s; CREATE SCHEMA s; USE s; ! CREATE TABLE t (i int); CREATE TABLE s.t (i int); ! INSERT INTO t (1); INSERT INTO s.t (1); /  PG: Extract the default schema from the event /  PG: Set it before applying MySQL PostgreSQL USE s; > SET search_path TO s, "$user”; © Continuent 2010
  • 21. /  Differences between DDL and DML statement SQL dialects /  Row Replication resolves issues rising from differences in DML, but still leaves DDL to handle /  Tungsten Replicator Filters come to the rescue! •  Simple to develop Java or JavaScript extensions •  Event structure IN -> Filter -> Event structure OUT MySQL PostgreSQL CREATE TABLE complex (id CREATE TABLE complex (id INTEGER AUTO_INCREMENT SERIAL PRIMARY KEY, i INT); PRIMARY KEY, i INT); CREATE TABLE dt (i TINYINT); CREATE TABLE dt (i SMALLINT); … © Continuent 2010
  • 22. /  Statement replication: MySQL syntax is “permissive” /  Embedded binary / alternate charsets /  Different charsets for different clients /  Row replication: database/table/column charsets may differ /  Answer: Stick with one character set throughout; use row replication to move binary data MySQL PostgreSQL INSERT INTO embedded_blob ARGH!!! (SQL statement fails) (key, data) VALUES (1, ‘?0^Es 0^0’’) create table xlate(id int, d1 ARGH!!! (no way to translate to varchar(25) character set common charset) latin1, d2 varchar(25) character set utf8); © Continuent 2010
  • 23. MySQL Versions /  Problem: Data stored on hard-to-replicate MySQL versions or configurations •  Row replication not enabled (5.1) •  No row replication support (5.0, 4.1) •  Tungsten cannot read binlog (4.1) /  Answer: MySQL blackhole replication •  (Blackhole = no store, just a binlog) •  Caveat: Check MySQL docs carefully Replicator © Continuent 2010
  • 25. Master Slave Replicator Replicator Transaction Transaction History Log History Log Filters Filters MySQL Oracle Extractor Applier © Continuent 2010
  • 26. /  TEXT length limitation •  VARCHAR(4000) => CLOB /  Primary Keys and PrimaryKeyFilter •  Goal: UPDATE t SET
 c1 = x1, c2 = x2, c3 = x3
 WHERE
 p = p1
 •  NOT: UPDATE t SET
 c1 = x1, c2 = x2, c3 = x3
 WHERE
 p = p1 AND c1 = x1 AND c2 = x2 AND c3 = x3 AND …! © Continuent 2010
  • 28. > use mydb
 switched to db mydb! > db.test.insert(
 {"test": "test value", "anumber" : 5 }
 )! > db.test.find()
 {
 "_id" : ObjectId("4dce9a4f3d6e186ffccdd4bb"),
 "test" : "test value", "anumber" : 5
 }! > exit! © Continuent 2010
  • 29. /  MySQL binary log doesn’t hold column names •  mysql> INSERT INTO foo (id, data) VALUES
 (1, 'hello from MySQL!'); •  If nothing done becomes: > db.foo.find();
 { "_id" : ObjectId("4dc55e45ad90a25b9b57909d"),
 " " : "1”,
 " " : "hello from MySQL!”}
 •  Solution: to fill in column names on master side. Then: > db.foo.find();
 { "_id" : ObjectId("4dc55e45ad90a25b9b57909d"),
 ” " : "1”,
 “ " : "hello from MySQL!”} © Continuent 2010
  • 30. MySQL -> MongoDB: The Pipeline © Continuent 2010
  • 33. Logical Physical MySQL Statement Based x MySQL Row Based x MySQL Mixed x PostgreSQL WAL Shipping x PostgreSQL Streaming Replication x Filters (data transformation) possible + - Different data/structure on slave + - possible /  A transaction is not accessible to the replicator under physical replication /  Tungsten Replicator manages WAL/Streaming Replication © Continuent 2010
  • 34. Logical Physical MySQL Statement Based x MySQL Row Based x MySQL Mixed x PostgreSQL WAL Shipping x PostgreSQL Streaming Replication x Tungsten Replicator w/ x PostgreSQLSlonyExtractor Filters (data transformation) possible + - Different data/structure on slave + - possible /  With PostgreSQLSlonyExtractor transaction goes through the Replicator pipeline © Continuent 2010
  • 35. Master Slave Replicator Replicator Transaction Transaction History Log History Log Filters Filters PostgreSQL MySQLApplier SlonyExtractor
  • 37. /  We’ve reviewed an open source heterogeneous replicator (professional services available upon request) /  Tungsten Replicator encapsulates the complexity and corner cases of the subject /  Replicating: •  out of MySQL – now; •  out of PostgreSQL – prototype; •  out of Oracle – designs ready, awaiting sponsorship. © Continuent 2010
  • 39. Open Source Commercial http://tungsten-replicator.org sales@continuent.com #tungsten @ irc.freenode.net My Blog: http://flyingclusters.blogspot.com Continuent Web Site: http://www.continuent.com © Continuent 2010