SlideShare uma empresa Scribd logo
1 de 141
Baixar para ler offline
MOVING DATA FOR THE MASSES


Giuseppe Maxia
QA Director
Continuent, Inc
                  @datacharmer
                                 This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License.
Friday, November 11, 11                                                                                                      1
Databases are the backbone of the web economy

                          www

                          $$$


Friday, November 11, 11                       2
Actually, database replication is the backbone of
                  the web economy




Friday, November 11, 11                               3
Actually, database replication is the backbone of
                  the web economy




                          WHY?
Friday, November 11, 11                               3
Why moving data?

              • Scaling reads (load balancing)
              • Scaling writes (sharding)
              • Parallelize computation (sharding+map/reduce)
              • High availability (replacing master on failure)
              • Creating information (feeding data warehouses)

Friday, November 11, 11                                           4
Scaling reads

                                   M



                          S               S

                                   S



Friday, November 11, 11                       5
Scaling writes
                            (sharding)
                     M1                        M3


                                  M2

            S             S                S        S


                              S        S
Friday, November 11, 11                                 6
High availability

                                    M



                          S                  S

                                     S



Friday, November 11, 11                           7
High availability



                          S
                                  ✘ M



                                             S

                                     S



Friday, November 11, 11                           7
High availability



                          S                  S

                                    M



Friday, November 11, 11                           8
Creating new
                               information

                                       S



                          M                  M

                                   M
Friday, November 11, 11                          9
Creating new
                               information
                          S                      S

                                   M S



                          M                  M

                                   M
Friday, November 11, 11                              9
More about data
                            replication


Friday, November 11, 11                     10
database server




                           r/w requests



                                            web server




                                                   clients
Friday, November 11, 11                                      11
database server




                           r/w requests




                                                   web servers

                                            load balancer


                                                 clients
Friday, November 11, 11                                          12
database load
                                       on a simple
                                           web
                                       application
                                  r
                                  e
                          write   a
                                  d




Friday, November 11, 11                           13
write   read

                                    database load on a
                                     successful web
                                        application
Friday, November 11, 11                                  14
database server




                ✘          r/w requests




                                                   web servers

                                            load balancer


                                                 clients

Friday, November 11, 11                                          15
read/write
                            master                               a web
                                                               application
                                                read/only
                                                  slaves
                                                              scheme with
                                                               replication
                                              load balancer
                          R/W


                                       R/O




                                               web servers

                                        load balancer


                                             clients

Friday, November 11, 11                                                      16
r
                                       e
                             write     a   read
                                       d



                          read/write
                            master

                                                  read/only
                                                    slaves



   database load
        with
     replication

Friday, November 11, 11                                       17
r
                                       e
                             write     a   read
                                       d



                          read/write
                            master

                                                  read/only
                                                    slaves


       scaling
   database load
        with
     replication
Friday, November 11, 11                                       18
•     If you want a successful
                          company




Friday, November 11, 11                              19
•     If you want a successful
                          company
                    •     in the 21st century




Friday, November 11, 11                              19
•     If you want a successful
                          company
                    •     in the 21st century
                    • you need to move data




Friday, November 11, 11                              19
•     If you want a successful
                          company
                    •     in the 21st century
                    • you need to move data
                    • fast


Friday, November 11, 11                              19
•     If you want a successful
                          company
                    •     in the 21st century
                    • you need to move data
                    • fast
                    • and often

Friday, November 11, 11                              19
MOVING DATA
                              FOR
                          THE MASSES




Friday, November 11, 11                 20
How do you move
                               data?




Friday, November 11, 11                     21
How do you move
                               data?
                    • Commodity hardware




Friday, November 11, 11                     21
How do you move
                               data?
                    • Commodity hardware
                    • Basic
                     • Commodity software (MySQL)
                     • MySQL native replication


Friday, November 11, 11                             21
How do you move
                               data?
                    • Commodity hardware
                    • Basic
                     • Commodity software (MySQL)
                     • MySQL native replication
                    • Advanced
                     • MySQL and other DBMS
                     • Powerful tools (Tungsten Replicator)
Friday, November 11, 11                                       21
Why Tungsten?




Friday, November 11, 11            22
transaction
                                                                              transaction
                                                             MySQL              transaction
                                                                            transaction
                                                                                  transaction
                                                             DBMS             transaction
                                                                                    transaction
                                                                                transaction
                                                                                      transaction
                                                                                  transaction
                                                                                    transaction
                                                                                      transaction



                                                      BINARY LOG




                              ns act act tio n
                          tra ansio ns sac ntio
                                ac ion ion n
                                               ac
                              nr tr tra aniton
                              tsa a n csio
                                       nts ct n
                                    rn a o
                                   taa scti
                                         r
                                  trnsa



                                       n
                                       n
                                                                     MySQL replication
                                   tio
                                  ct
                                tra

                          tra
                          REPLICATION
                                        transaction
                                        transaction
                                                                     is single threaded




                                    MySQL
                                    DBMS




Friday, November 11, 11                                                                             23
master                             master     master      master
                          MySQL                         MySQL     MySQL       MySQL
                          DBMS                          DBMS      DBMS        DBMS




        MySQL               MySQL   MySQL                           MySQL
        DBMS                DBMS    DBMS                            DBMS




     slave                  slave   slave                            slave


           single source                                   multi source (fan-in)

                                            multiple sources?
Friday, November 11, 11                                                               24
from this                        to this
                                                   MySQL             MySQL
                                                   DBMS              DBMS




                                                  master             master




                                                   MySQL             MySQL
                                                   DBMS              DBMS




                                                  master             master



                                      multiple masters?

Friday, November 11, 11                                                       25
INSERT                                         INSERT
        RECORD                                         RECORD
           A                                              A
                           MySQL              MySQL
                           DBMS               DBMS




                          master              master




                           MySQL              MySQL
                           DBMS               DBMS




        MODIFY            master              master   MODIFY
        RECORD                                         RECORD
           B                                              B
                              Avoiding conflicts?

Friday, November 11, 11                                          26
master
                                                    Seamless failover?
                    MySQL
                    DBMS

                                           master
                                            MySQL
                                            DBMS




                                                                         master
                                                                           MySQL
                                                                           DBMS




     MySQL            MySQL
     DBMS             DBMS




  slave                   slave    MySQL
                                   DBMS
                                              MySQL
                                              DBMS




                                  slave       slave
                                                                 MySQL     MySQL
                                                                 DBMS      DBMS




                                                                slave      slave
Friday, November 11, 11                                                            27
Replicating to something else?


                             mysql master
                                   MySQL
                                   DBMS




                           MySQL
                           DBMS




                          mysql postgresql oracle   mongodb


Friday, November 11, 11                                       28
All these examples tell
              us:

                      Nice dream, but
                      MySQL can’t do it
Friday, November 11, 11                   29
Enter Tungsten Replicator




Friday, November 11, 11                               30
http://code.google.com/p/tungsten-replicator




Friday, November 11, 11                                31
http://code.google.com/p/tungsten-replicator




                                      Open Source




Friday, November 11, 11                                31
http://code.google.com/p/tungsten-replicator




                                      Open Source
                                      100% GPL v2



Friday, November 11, 11                                31
What can it do?
                • Easy failover
                • Multiple masters
                • Multiple sources to a single slave
                • Conflict prevention
                • Parallel replication
                • Replicate to Oracle and PostgreSQL database
Friday, November 11, 11                                         32
MySQL to foreign services


                            MySQL setup
                              to run as
                            MySQL master


               Master DB
                               Data is applied to
                                 PostgreSQL or
                               Oracle or to NoSQL
                                     entities



                             Bin
                            Logs
                 (Binlogs
                 enabled)                           Slave DB

      © Continuent 2010


Friday, November 11, 11                                        33
Main components
                    • Transaction History Logs (THL)
                          •   roughly corresponding to MySQL relay logs

                          •   have a lot of metadata

                    • Service database
                          •   contains metadata for latest transactions

                          •   Metadata is committed together with data

                          •   Makes slaves crash proof


Friday, November 11, 11                                                   34
A failover scenario
              1: MySQL native replication




Friday, November 11, 11                     35
Defining the problem
                                                                       Slave 3

                          Master          Replication          Slave 2

                                                          Slave 1
                                    Binary log

                                   Transactions          Relay log         Binary log
                                      --------
                                      --------          Transactions      Transactions
                                      --------             --------       ========
                                      --------             --------       ========
                                                           --------       ========
                                                           --------       ========




Friday, November 11, 11                                                                  36
The master crashes
                                                                       Slave 3

                          Master          Replication          Slave 2

                                                          Slave 1
                                    Binary log

                                   Transactions          Relay log         Binary log
                                      --------
                                      --------          Transactions      Transactions
                                      --------             --------       ========
                                      --------             --------       ========
                                                           --------       ========
                                                           --------       ========




Friday, November 11, 11                                                                  37
Where do the slaves
                                stand?
          Slave 1               Slave 2        Slave 3




          Binary log            Binary log     Binary log

        Transactions           Transactions   Transactions
        ========               ========       ========
        ========               ========       ========
        ========               ========       ========
        ========               ========       ========




Friday, November 11, 11                                      38
Slave 3 becomes
                               master
                                             New master


          Slave 1              Slave 2
                                              Binary log

                                             Transactions
                                             ========
          Binary log           Binary log    ========
                                             ========
        Transactions          Transactions   ========
        ========              ========
        ========              ========
        ========              ========
        ========              ========




Friday, November 11, 11                                     39
Need to synch the
                          missing transactions
                                               New master


          Slave 1                Slave 2
                                                Binary log

                                               Transactions
                                               ========
          Binary log             Binary log    ========
                                               ========
        Transactions            Transactions   ========
        ========                ========
        ========                ========
        ========                ========
        ========                ========




Friday, November 11, 11                                       40
Transaction position in the new
         master binlog may not match
       positions in the old master binlog
                                                       New master


          Slave 1              Slave 2
                                                        Binary log

                                                       Transactions
                                                 ? ?   ========
          Binary log           Binary log              ========
                                                       ========
        Transactions          Transactions             ========
        ========              ========
        ========              ========
        ========          ?   ========       ?
        ========              ========

Friday, November 11, 11                                               41
A failover scenario
                          1: Tungsten Replicator




Friday, November 11, 11                            42
Slave 3

                             Master               Replication        Slave 2

                                                                Slave 1
                                               THL

                                           Transactions                             THL
                                              --------
                                              --------                         Transactions
                                              --------                         ========
                                              --------                         ========
                                                                               ========
                                                                               ========

                          Includes Global Transaction ID


Friday, November 11, 11                                                                       43
The master crashes
                                                                  Slave 3

                          Master          Replication        Slave 2

                                                        Slave 1
                                       THL

                                   Transactions                             THL
                                      --------
                                      --------                         Transactions
                                      --------                         ========
                                      --------                         ========
                                                                       ========
                                                                       ========




Friday, November 11, 11                                                               44
Where do the slaves
                                stand?
          Slave 1               Slave 2        Slave 3




                THL                THL            THL

        Transactions           Transactions   Transactions
        ========               ========       ========
        ========               ========       ========
        ========               ========       ========
        ========               ========       ========




Friday, November 11, 11                                      45
Slave 3 becomes
                               master
                                             New master


          Slave 1              Slave 2
                                                 THL

                                             Transactions
                                             ========
                THL               THL        ========
                                             ========
        Transactions          Transactions   ========
        ========              ========
        ========              ========
        ========              ========
        ========              ========




Friday, November 11, 11                                     46
Need to synch the
                          missing transactions
                                               New master


          Slave 1                Slave 2
                                                   THL

                                               Transactions
                                               ========
                THL                 THL        ========
                                               ========
        Transactions            Transactions   ========
        ========                ========
        ========                ========
        ========                ========
        ========                ========




Friday, November 11, 11                                       47
Transaction IDs in the new master
 THL are understood immediately by
             the slaves
                                                          New master


          Slave 1                     Slave 2
                                                            Binary log

                                                           Transactions
                                                           ========
          Binary log                       Binary log      ========
                                                           ========
        Transactions                     Transactions      ========
        ========                         ========
        ========                         ========
        ========           Give me       ========        Give me
        ========          seqno #51      ========       seqno #67

Friday, November 11, 11                                                   48
Parallel replication




Friday, November 11, 11                          49
parallel replication
                                     From here ...




Friday, November 11, 11                              50
parallel replication
                                       To here.




Friday, November 11, 11                           51
Parallel replication facts


                    ✓Sharded by database
                    ✓Good choice for slave lag problems
                    ❖Bad choice for single database projects


Friday, November 11, 11                                        52
Benchmarking parallel
                           replication


Friday, November 11, 11                       53
db0
                                                  preparation (1)
                           db1                                 sysbench



                                db2                             sysbench


                                 db3                              sysbench


                                      db4                           sysbench



                                       db5                            sysbench


                                            db6                           sysbench


                                             db7                           sysbench



                                                  db8                        sysbench



                                                   db9                         sysbench


                                                                                 sysbench




Friday, November 11, 11                                                                     54
before the test (2)

           STOPPED



                                                 binary logs

   MySQL slave

                             OFFLINE

          Tungsten slave          direct:
                                   alpha
                                  (slave)

                              replicator alpha




Friday, November 11, 11                                        55
starting the test

           STOPPED



                                                  binary logs

   MySQL slave                                   Concurrent sysbench
                                                   on 30 databases
                                                  running for 1 hour
                            OFFLINE
                                                 TOTAL DATA: 130 GB
          Tungsten slave         direct:
                                  alpha
                                                 RAM per server: 20GB
                                 (slave)

                             replicator alpha

                                                Slaves will have 1 hour lag
Friday, November 11, 11                                                       56
measuring results

               START



                                                 binary logs

   MySQL slave

                             ONLINE                             Recording
                                                               catch-up time
          Tungsten slave          direct:
                                   alpha
                                  (slave)

                              replicator alpha




Friday, November 11, 11                                                        57
MySQL native
                           replication


              slave catch up in 04:29:30



Friday, November 11, 11                    58
Tungsten parallel
                             replication


              slave catch up in 00:55:40



Friday, November 11, 11                       59
Parallel replication made simpler




                          FROM HERE ....
Friday, November 11, 11                              60
Parallel replication made simpler




                          TO HERE
Friday, November 11, 11                              61
Parallel replication made simpler




Friday, November 11, 11                              62
parallel replication
                           direct slave facts




Friday, November 11, 11                          63
parallel replication
                           direct slave facts
     ✓No need to install Tungsten on the master




Friday, November 11, 11                           63
parallel replication
                           direct slave facts
     ✓No need to install Tungsten on the master
     ✓Tungsten runs only on the slave




Friday, November 11, 11                           63
parallel replication
                           direct slave facts
     ✓No need to install Tungsten on the master
     ✓Tungsten runs only on the slave
     ✓Replication can revert to native slave with two
             commands (trepctl offline; start
             slave)




Friday, November 11, 11                                 63
parallel replication
                           direct slave facts
     ✓No need to install Tungsten on the master
     ✓Tungsten runs only on the slave
     ✓Replication can revert to native slave with two
             commands (trepctl offline; start
             slave)

     ✓Native replication can continue on other slaves

Friday, November 11, 11                                 63
parallel replication
                           direct slave facts
     ✓No need to install Tungsten on the master
     ✓Tungsten runs only on the slave
     ✓Replication can revert to native slave with two
             commands (trepctl offline; start
             slave)

     ✓Native replication can continue on other slaves
     ❖Failover (either native or Tungsten) becomes a
             manual task
Friday, November 11, 11                                 63
Multiple masters




Friday, November 11, 11                      64
multiple masters


                    • Tungsten Replicator recipe: use more
                          services




Friday, November 11, 11                                      65
Bi-directional replication




Friday, November 11, 11                                66
Bi-directional replication with slaves




Friday, November 11, 11                         67
Multiple sources




Friday, November 11, 11                      68
multiple sources


                    • Tungsten Replicator recipe is still valid:
                          use more services




Friday, November 11, 11                                            69
Multiple source replication




Friday, November 11, 11                                 70
Multiple masters replication: 3 nodes




Friday, November 11, 11                      71
Multiple masters replication: 4 nodes




Friday, November 11, 11                      72
4 nodes multiple masters simplified




Friday, November 11, 11                      73
star topologies




Friday, November 11, 11                     74
Conflict prevention




Friday, November 11, 11                         75
Conflict prevention
                                facts




Friday, November 11, 11                        76
Conflict prevention
                                facts
                    • Sharded by database




Friday, November 11, 11                        76
Conflict prevention
                                facts
                    • Sharded by database
                    • Defined dynamically




Friday, November 11, 11                        76
Conflict prevention
                                facts
                    • Sharded by database
                    • Defined dynamically
                    • Applied either at the master or at the
                          slave




Friday, November 11, 11                                        76
Conflict prevention
                                facts
                    • Sharded by database
                    • Defined dynamically
                    • Applied either at the master or at the
                          slave
                    • methods:


Friday, November 11, 11                                        76
Conflict prevention
                                facts
                    • Sharded by database
                    • Defined dynamically
                    • Applied either at the master or at the
                          slave
                    • methods:
                          •   make replication fail




Friday, November 11, 11                                        76
Conflict prevention
                                facts
                    • Sharded by database
                    • Defined dynamically
                    • Applied either at the master or at the
                          slave
                    • methods:
                          •   make replication fail

                          •   drop silently


Friday, November 11, 11                                        76
Conflict prevention
                                facts
                    • Sharded by database
                    • Defined dynamically
                    • Applied either at the master or at the
                          slave
                    • methods:
                          •   make replication fail

                          •   drop silently

                          •   drop with warning
Friday, November 11, 11                                        76
Tungsten Conflict prevention points
                          host1
                                                               host3



                          M       S
                                                          S



                          host2                                host4
                              master

                          S       M                        S

Friday, November 11, 11                                                77
Tungsten Conflict prevention points
                          host1
                                                               host3



                          M       S
                                                          S



                          host2                                host4
                              master

                          S       M                        S

Friday, November 11, 11                                                77
Tungsten Conflict prevention points
                          host1
                                                               host3



                          M       S
                                                          S



                          host2                                host4
                              master

                          S       M                        S

Friday, November 11, 11                                                77
Prevention methods: Fail on master
                          host1
                                                               host3



                          M       S
                                                          S



                          host2                                host4
                              master

                          S       M                        S

Friday, November 11, 11                                                78
INSERT A
        x,y
                              Prevention methods: Fail on master
                          host1
                                                               host3



                          M       S
                                                          S



                          host2                                host4
                              master

                          S       M                        S
                                       INSERT A
                                          x,z
Friday, November 11, 11                                                78
INSERT A
        x,y
                              Prevention methods: Fail on master
                          host1
                                                               host3



                          M       S
                                                          S



                          host2                                host4
                              master

                          S       M                        S
                                       INSERT A
                                          x,z
Friday, November 11, 11                                                78
Prevention methods: Fail on slave
                          host1
                                                                host3



                          M       S
                                                           S



                          host2                                 host4
                              master

                          S       M                         S

Friday, November 11, 11                                                 79
INSERT A
        x,y
                               Prevention methods: Fail on slave
                          host1
                                                                host3



                          M       S
                                                           S



                          host2                                 host4
                              master

                          S       M                         S
                                        INSERT A
                                           x,z
Friday, November 11, 11                                                 79
INSERT A
        x,y
                               Prevention methods: Fail on slave
                          host1
                                                                host3



                          M       S
                                                           S



                          host2                                 host4
                              master

                          S       M                         S
                                        INSERT A
                                           x,z
Friday, November 11, 11                                                 79
Prevention methods: Fail on slave
                          host1
                                         (Multiple sources)



                          M




                          host2                               host3
                              master

                          M                               S

Friday, November 11, 11                                               80
INSERT A
        x,y
                             Prevention methods: Fail on slave
                          host1
                                         (Multiple sources)



                          M




                          host2                               host3
                              master

                          M                               S
                                       INSERT A
                                          x,z
Friday, November 11, 11                                               80
INSERT A
        x,y
                             Prevention methods: Fail on slave
                          host1
                                         (Multiple sources)



                          M




                          host2                               host3
                              master

                          M                               S
                                       INSERT A
                                          x,z
Friday, November 11, 11                                               80
Prevention methods: DROP on master
                          host1
                                                          host3



                          M       S
                                                     S



                          host2                           host4
                              master

                          S       M                   S

Friday, November 11, 11                                           81
INSERT A
        x,y
                          Prevention methods: DROP on master
                          host1
                                                          host3



                          M       S
                                                     S



                          host2                           host4
                              master

                          S       M                   S

Friday, November 11, 11                                           81
INSERT A
        x,y
                          Prevention methods: DROP on master
                          host1
                                                          host3



                          M       S
                                                     S



                          host2                           host4
                              master

                          S       M                   S
                                       INSERT A
                                          x,z
Friday, November 11, 11                                           81
Prevention methods: DROP on master
                          host1
                                                          host3



                          M       S
                                                     S



                          host2                           host4
                              master

                          S       M                   S
                                       INSERT A
                                          x,z
Friday, November 11, 11                                           81
Prevention methods: DROP on slave
                          host1
                                         (Multiple sources)



                          M




                          host2                            host3
                              master

                          M                            S

Friday, November 11, 11                                            82
INSERT A
        x,y
                           Prevention methods: DROP on slave
                          host1
                                         (Multiple sources)



                          M




                          host2                            host3
                              master

                          M                            S
                                       INSERT A
                                          x,z
Friday, November 11, 11                                            82
Prevention methods: DROP on slave
                          host1
                                         (Multiple sources)



                          M




                          host2          INSERT A          host3
                                            x,y
                              master
                                          INSERT A
                          M                  x,z       S

Friday, November 11, 11                                            83
Prevention methods: DROP on slave
                          host1
                                         (Multiple sources)



                          M




                          host2                            host3
                              master
                                          INSERT A
                          M                  x,z       S

Friday, November 11, 11                                            83
Tungsten in practice
                              Installation




Friday, November 11, 11                          84
Installation

                    • Check the requirements
                    • Get the binaries
                    • Expand the tarball
                    • Run ./tools/tungsten-installer

Friday, November 11, 11                                85
REQUIREMENTS

   • Java JRE or JDK (Sun/Oracle or Open-jdk)
   • Ruby 1.8 (only during installation)
   • ssh access to the same user in all nodes
   • MySQL user with all privileges

Friday, November 11, 11                         86
Installation types


                    • master / slave
                    • slave - direct


Friday, November 11, 11                        87
master/slave
                                                    host2
                      host1

                          master                        slave


                                                  THL
              binlog                THL

                                                    host3

                                                        slave


                                                  THL


Friday, November 11, 11                                         88
slave direct
                                                 host2
                      host1
                                                           slave
                          master
                                         relay log

                                                     THL
           binlog
                                                 host3

                                                           slave

                                         relay log

                                                     THL


Friday, November 11, 11                                            89
sample installation
                    • 4 servers
                          •   qa.r1.continuent.com r1

                          •   qa.r2.continuent.com r2

                          •   qa.r3.continuent.com r3

                          •   qa.r4.continuent.com r4

                    • MySQL 5.1
                    • tungsten-replicator-2.0.4
Friday, November 11, 11                                 90
Installation (1)
      # starting at node 4, but any would do

      for N in 1 2 3 4
      do
           ssh r$N mkdir tinstall
      done

      cd tinstall
      tar -xzf /path/to/tungsten-replicator-2.0.4.tar.gz
      cd tungsten-replicator-2.0.4




Friday, November 11, 11                                    91
Installation (2)
                export TUNGSTEN_BASE=$HOME/tinstall

         1 ./tools/tungsten-installer 
         2     --master-slave 
         3     --master-host=r1 
         4     --datasource-user=tungsten 
         5     --datasource-password=secret 
         6     --service-name=dragon 
         7     --home-directory=$TUNGSTEN_BASE 
         8     --cluster-hosts=r1,r2,r3,r4 
         9     --start




Friday, November 11, 11                               92
Installation (2)
  export TUNGSTEN_BASE=$HOME/tinstall

  ./tools/tungsten-installer 
     --master-slave  # installation mode
     --master-host=r1  # who’s the master
     --datasource-user=tungsten  # mysql username
     --datasource-password=secret  # mysql password
     --service-name=dragon    # name of the service
     --home-directory=$TUNGSTEN_BASE  # where we install
     --cluster-hosts=r1,r2,r3,r4  # hosts in cluster
     --start # start replicator after installing




Friday, November 11, 11                                 93
What does the
                            installation do
                 1: Validate all servers

               host4              host1           host2       host3

         ✔                    ✔               ✔           ✔
         ✗                    ✗               ✗           ✗
         ✔                    ✔               ✔           ✔
         ✔                    ✔               ✔           ✔

                          Report all errors
Friday, November 11, 11                                               94
What does the
                          installation do
                   1 (again): Validate all servers

               host4             host1        host2   host3

         ✔                   ✔            ✔           ✔
         ✔                   ✔            ✔           ✔
         ✔                   ✔            ✔           ✔
         ✔                   ✔            ✔           ✔



Friday, November 11, 11                                       95
What does the
                          installation do
               2: install Tungsten in all servers
                                              host4
                             $HOME/             host1
                               tinstall/         host2
                                config/             host3
                                releases/
                                relay/
                                logs/
                                tungsten/




Friday, November 11, 11                                     96
example
      ssh r2 chmod 444 $HOME/tinstall
      ./tools/tungsten-installer 
          --master-slave --master-host=r1 
          --datasource-user=tungsten 
          --datasource-password=secret 
          --service-name=dragon 
          --home-directory=$HOME/tinstall 
          --thl-directory=$HOME/tinstall/logs 
          --relay-directory=$HOME/tinstall/relay 
          --cluster-hosts=r1,r2,r3,r4 --start

      ERROR >> qa.r2.continuent.com >> /home/tungsten/
      tinstall is not writeable


Friday, November 11, 11                                  97
example
      ssh r2 chmod 755 $HOME/tinstall
      ./tools/tungsten-installer 
          --master-slave --master-host=r1 
          --datasource-user=tungsten 
          --datasource-password=secret 
          --service-name=dragon 
          --home-directory=$HOME/tinstall 
          --thl-directory=$HOME/tinstall/logs 
          --relay-directory=$HOME/tinstall/relay 
          --cluster-hosts=r1,r2,r3,r4 --start

      # no errors



Friday, November 11, 11                              98
Installation - direct
      ./tools/tungsten-installer 
          --direct 
          --master-host=r1 
          --slave-host=r4 
          --master-user=tungsten 
          --slave-user=tungsten 
          --master-password=secret 
          --slave-password=secret 
          --service-name=Castor 
          --channels=1 
          --home-directory=$TUNGSTEN_BASE 
          --start-and-report



Friday, November 11, 11                           99
http://bit.ly/tr20_cookbook




Friday, November 11, 11                100
Tungsten Replicator vs. Enterprise

  Feature                             Replicator   Enterprise
  Simple admin with trepctl               X            X
  MySQL Row/Statement 5.0/5.1/5.5         X            X
  Multi-master replication                X            X
  Parallel apply (2.0)                    X            X
  Distributed management with cctrl                    X
  Automated failover and recovery                      X
  Zero-downtime upgrade                                X
  SQL routing and load-balancing                       X
  Floating IP support                                  X

     © Continuent 2011


Friday, November 11, 11                                         101
Conclusion and Q&A




Friday, November 11, 11                        102
Contact Information


       Worldwide
       560 S. Winchester Blvd., Suite 500
       San Jose, CA 95128                              @datacharmer
       Tel (866) 998-3642
       Fax (408) 668-1009                              @continuent
       e-mail: sales@continuent.com




                                     Continuent Web Site:
                                 http://www.continuent.com
                                       Tungsten Project
                              http://tungsten-replicator.org
                          Getting started with Tungsten Replicator:
                              http://datacharmer.blogspot.com
     © Continuent 2011

Friday, November 11, 11                                               103
Friday, November 11, 11   104

Mais conteúdo relacionado

Destaque (10)

Nursing colleges
Nursing collegesNursing colleges
Nursing colleges
 
Uma história em correspondência
Uma história em correspondênciaUma história em correspondência
Uma história em correspondência
 
Banda desenhada Maria Castanha
Banda desenhada Maria CastanhaBanda desenhada Maria Castanha
Banda desenhada Maria Castanha
 
Plan de mejora lectores 1°
Plan de mejora lectores 1°Plan de mejora lectores 1°
Plan de mejora lectores 1°
 
What is income insurance
What is income insuranceWhat is income insurance
What is income insurance
 
Mainha,
Mainha,Mainha,
Mainha,
 
Pract1
Pract1Pract1
Pract1
 
Introdução
IntroduçãoIntrodução
Introdução
 
Exámenes diciembre 2011
Exámenes diciembre 2011Exámenes diciembre 2011
Exámenes diciembre 2011
 
Tutorial bytworld volume iii
Tutorial bytworld   volume iiiTutorial bytworld   volume iii
Tutorial bytworld volume iii
 

Mais de Giuseppe Maxia

MySQL NDB 8.0 clusters in your laptop with dbdeployer
MySQL NDB 8.0 clusters in your laptop with dbdeployerMySQL NDB 8.0 clusters in your laptop with dbdeployer
MySQL NDB 8.0 clusters in your laptop with dbdeployerGiuseppe Maxia
 
Dbdeployer, the universal installer
Dbdeployer, the universal installerDbdeployer, the universal installer
Dbdeployer, the universal installerGiuseppe Maxia
 
Test complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployerTest complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployerGiuseppe Maxia
 
A quick tour of Mysql 8 roles
A quick tour of Mysql 8 rolesA quick tour of Mysql 8 roles
A quick tour of Mysql 8 rolesGiuseppe Maxia
 
Synchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDBSynchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDBGiuseppe Maxia
 
Juggle your data with Tungsten Replicator
Juggle your data with Tungsten ReplicatorJuggle your data with Tungsten Replicator
Juggle your data with Tungsten ReplicatorGiuseppe Maxia
 
Tungsten Replicator tutorial
Tungsten Replicator tutorialTungsten Replicator tutorial
Tungsten Replicator tutorialGiuseppe Maxia
 
Preventing multi master conflicts with tungsten
Preventing multi master conflicts with tungstenPreventing multi master conflicts with tungsten
Preventing multi master conflicts with tungstenGiuseppe Maxia
 
MySQL high availability power and usability
MySQL high availability power and usabilityMySQL high availability power and usability
MySQL high availability power and usabilityGiuseppe Maxia
 
Solving MySQL replication problems with Tungsten
Solving MySQL replication problems with TungstenSolving MySQL replication problems with Tungsten
Solving MySQL replication problems with TungstenGiuseppe Maxia
 
State of the art of MySQL replication and clustering
State of the art of MySQL replication and clusteringState of the art of MySQL replication and clustering
State of the art of MySQL replication and clusteringGiuseppe Maxia
 
Testing mysql creatively in a sandbox
Testing mysql creatively in a sandboxTesting mysql creatively in a sandbox
Testing mysql creatively in a sandboxGiuseppe Maxia
 
Mysql 5.5 and 5.6 replication
Mysql 5.5 and 5.6 replicationMysql 5.5 and 5.6 replication
Mysql 5.5 and 5.6 replicationGiuseppe Maxia
 

Mais de Giuseppe Maxia (20)

MySQL NDB 8.0 clusters in your laptop with dbdeployer
MySQL NDB 8.0 clusters in your laptop with dbdeployerMySQL NDB 8.0 clusters in your laptop with dbdeployer
MySQL NDB 8.0 clusters in your laptop with dbdeployer
 
Test like a_boss
Test like a_bossTest like a_boss
Test like a_boss
 
Dbdeployer, the universal installer
Dbdeployer, the universal installerDbdeployer, the universal installer
Dbdeployer, the universal installer
 
Test complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployerTest complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployer
 
Dbdeployer
DbdeployerDbdeployer
Dbdeployer
 
Dbdeployer
DbdeployerDbdeployer
Dbdeployer
 
A quick tour of Mysql 8 roles
A quick tour of Mysql 8 rolesA quick tour of Mysql 8 roles
A quick tour of Mysql 8 roles
 
MySQL document_store
MySQL document_storeMySQL document_store
MySQL document_store
 
Replication skeptic
Replication skepticReplication skeptic
Replication skeptic
 
Synchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDBSynchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDB
 
Juggle your data with Tungsten Replicator
Juggle your data with Tungsten ReplicatorJuggle your data with Tungsten Replicator
Juggle your data with Tungsten Replicator
 
MySQL in your laptop
MySQL in your laptopMySQL in your laptop
MySQL in your laptop
 
Script it
Script itScript it
Script it
 
Tungsten Replicator tutorial
Tungsten Replicator tutorialTungsten Replicator tutorial
Tungsten Replicator tutorial
 
Preventing multi master conflicts with tungsten
Preventing multi master conflicts with tungstenPreventing multi master conflicts with tungsten
Preventing multi master conflicts with tungsten
 
MySQL high availability power and usability
MySQL high availability power and usabilityMySQL high availability power and usability
MySQL high availability power and usability
 
Solving MySQL replication problems with Tungsten
Solving MySQL replication problems with TungstenSolving MySQL replication problems with Tungsten
Solving MySQL replication problems with Tungsten
 
State of the art of MySQL replication and clustering
State of the art of MySQL replication and clusteringState of the art of MySQL replication and clustering
State of the art of MySQL replication and clustering
 
Testing mysql creatively in a sandbox
Testing mysql creatively in a sandboxTesting mysql creatively in a sandbox
Testing mysql creatively in a sandbox
 
Mysql 5.5 and 5.6 replication
Mysql 5.5 and 5.6 replicationMysql 5.5 and 5.6 replication
Mysql 5.5 and 5.6 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.pptxEarley Information Science
 
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 MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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 WorkerThousandEyes
 
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 organizationRadu Cotescu
 

Ú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
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
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
 

Moving Data is Key to Web Success

  • 1. MOVING DATA FOR THE MASSES Giuseppe Maxia QA Director Continuent, Inc @datacharmer This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. Friday, November 11, 11 1
  • 2. Databases are the backbone of the web economy www $$$ Friday, November 11, 11 2
  • 3. Actually, database replication is the backbone of the web economy Friday, November 11, 11 3
  • 4. Actually, database replication is the backbone of the web economy WHY? Friday, November 11, 11 3
  • 5. Why moving data? • Scaling reads (load balancing) • Scaling writes (sharding) • Parallelize computation (sharding+map/reduce) • High availability (replacing master on failure) • Creating information (feeding data warehouses) Friday, November 11, 11 4
  • 6. Scaling reads M S S S Friday, November 11, 11 5
  • 7. Scaling writes (sharding) M1 M3 M2 S S S S S S Friday, November 11, 11 6
  • 8. High availability M S S S Friday, November 11, 11 7
  • 9. High availability S ✘ M S S Friday, November 11, 11 7
  • 10. High availability S S M Friday, November 11, 11 8
  • 11. Creating new information S M M M Friday, November 11, 11 9
  • 12. Creating new information S S M S M M M Friday, November 11, 11 9
  • 13. More about data replication Friday, November 11, 11 10
  • 14. database server r/w requests web server clients Friday, November 11, 11 11
  • 15. database server r/w requests web servers load balancer clients Friday, November 11, 11 12
  • 16. database load on a simple web application r e write a d Friday, November 11, 11 13
  • 17. write read database load on a successful web application Friday, November 11, 11 14
  • 18. database server ✘ r/w requests web servers load balancer clients Friday, November 11, 11 15
  • 19. read/write master a web application read/only slaves scheme with replication load balancer R/W R/O web servers load balancer clients Friday, November 11, 11 16
  • 20. r e write a read d read/write master read/only slaves database load with replication Friday, November 11, 11 17
  • 21. r e write a read d read/write master read/only slaves scaling database load with replication Friday, November 11, 11 18
  • 22. If you want a successful company Friday, November 11, 11 19
  • 23. If you want a successful company • in the 21st century Friday, November 11, 11 19
  • 24. If you want a successful company • in the 21st century • you need to move data Friday, November 11, 11 19
  • 25. If you want a successful company • in the 21st century • you need to move data • fast Friday, November 11, 11 19
  • 26. If you want a successful company • in the 21st century • you need to move data • fast • and often Friday, November 11, 11 19
  • 27. MOVING DATA FOR THE MASSES Friday, November 11, 11 20
  • 28. How do you move data? Friday, November 11, 11 21
  • 29. How do you move data? • Commodity hardware Friday, November 11, 11 21
  • 30. How do you move data? • Commodity hardware • Basic • Commodity software (MySQL) • MySQL native replication Friday, November 11, 11 21
  • 31. How do you move data? • Commodity hardware • Basic • Commodity software (MySQL) • MySQL native replication • Advanced • MySQL and other DBMS • Powerful tools (Tungsten Replicator) Friday, November 11, 11 21
  • 33. transaction transaction MySQL transaction transaction transaction DBMS transaction transaction transaction transaction transaction transaction transaction BINARY LOG ns act act tio n tra ansio ns sac ntio ac ion ion n ac nr tr tra aniton tsa a n csio nts ct n rn a o taa scti r trnsa n n MySQL replication tio ct tra tra REPLICATION transaction transaction is single threaded MySQL DBMS Friday, November 11, 11 23
  • 34. master master master master MySQL MySQL MySQL MySQL DBMS DBMS DBMS DBMS MySQL MySQL MySQL MySQL DBMS DBMS DBMS DBMS slave slave slave slave single source multi source (fan-in) multiple sources? Friday, November 11, 11 24
  • 35. from this to this MySQL MySQL DBMS DBMS master master MySQL MySQL DBMS DBMS master master multiple masters? Friday, November 11, 11 25
  • 36. INSERT INSERT RECORD RECORD A A MySQL MySQL DBMS DBMS master master MySQL MySQL DBMS DBMS MODIFY master master MODIFY RECORD RECORD B B Avoiding conflicts? Friday, November 11, 11 26
  • 37. master Seamless failover? MySQL DBMS master MySQL DBMS master MySQL DBMS MySQL MySQL DBMS DBMS slave slave MySQL DBMS MySQL DBMS slave slave MySQL MySQL DBMS DBMS slave slave Friday, November 11, 11 27
  • 38. Replicating to something else? mysql master MySQL DBMS MySQL DBMS mysql postgresql oracle mongodb Friday, November 11, 11 28
  • 39. All these examples tell us: Nice dream, but MySQL can’t do it Friday, November 11, 11 29
  • 40. Enter Tungsten Replicator Friday, November 11, 11 30
  • 42. http://code.google.com/p/tungsten-replicator Open Source Friday, November 11, 11 31
  • 43. http://code.google.com/p/tungsten-replicator Open Source 100% GPL v2 Friday, November 11, 11 31
  • 44. What can it do? • Easy failover • Multiple masters • Multiple sources to a single slave • Conflict prevention • Parallel replication • Replicate to Oracle and PostgreSQL database Friday, November 11, 11 32
  • 45. MySQL to foreign services MySQL setup to run as MySQL master Master DB Data is applied to PostgreSQL or Oracle or to NoSQL entities Bin Logs (Binlogs enabled) Slave DB © Continuent 2010 Friday, November 11, 11 33
  • 46. Main components • Transaction History Logs (THL) • roughly corresponding to MySQL relay logs • have a lot of metadata • Service database • contains metadata for latest transactions • Metadata is committed together with data • Makes slaves crash proof Friday, November 11, 11 34
  • 47. A failover scenario 1: MySQL native replication Friday, November 11, 11 35
  • 48. Defining the problem Slave 3 Master Replication Slave 2 Slave 1 Binary log Transactions Relay log Binary log -------- -------- Transactions Transactions -------- -------- ======== -------- -------- ======== -------- ======== -------- ======== Friday, November 11, 11 36
  • 49. The master crashes Slave 3 Master Replication Slave 2 Slave 1 Binary log Transactions Relay log Binary log -------- -------- Transactions Transactions -------- -------- ======== -------- -------- ======== -------- ======== -------- ======== Friday, November 11, 11 37
  • 50. Where do the slaves stand? Slave 1 Slave 2 Slave 3 Binary log Binary log Binary log Transactions Transactions Transactions ======== ======== ======== ======== ======== ======== ======== ======== ======== ======== ======== ======== Friday, November 11, 11 38
  • 51. Slave 3 becomes master New master Slave 1 Slave 2 Binary log Transactions ======== Binary log Binary log ======== ======== Transactions Transactions ======== ======== ======== ======== ======== ======== ======== ======== ======== Friday, November 11, 11 39
  • 52. Need to synch the missing transactions New master Slave 1 Slave 2 Binary log Transactions ======== Binary log Binary log ======== ======== Transactions Transactions ======== ======== ======== ======== ======== ======== ======== ======== ======== Friday, November 11, 11 40
  • 53. Transaction position in the new master binlog may not match positions in the old master binlog New master Slave 1 Slave 2 Binary log Transactions ? ? ======== Binary log Binary log ======== ======== Transactions Transactions ======== ======== ======== ======== ======== ======== ? ======== ? ======== ======== Friday, November 11, 11 41
  • 54. A failover scenario 1: Tungsten Replicator Friday, November 11, 11 42
  • 55. Slave 3 Master Replication Slave 2 Slave 1 THL Transactions THL -------- -------- Transactions -------- ======== -------- ======== ======== ======== Includes Global Transaction ID Friday, November 11, 11 43
  • 56. The master crashes Slave 3 Master Replication Slave 2 Slave 1 THL Transactions THL -------- -------- Transactions -------- ======== -------- ======== ======== ======== Friday, November 11, 11 44
  • 57. Where do the slaves stand? Slave 1 Slave 2 Slave 3 THL THL THL Transactions Transactions Transactions ======== ======== ======== ======== ======== ======== ======== ======== ======== ======== ======== ======== Friday, November 11, 11 45
  • 58. Slave 3 becomes master New master Slave 1 Slave 2 THL Transactions ======== THL THL ======== ======== Transactions Transactions ======== ======== ======== ======== ======== ======== ======== ======== ======== Friday, November 11, 11 46
  • 59. Need to synch the missing transactions New master Slave 1 Slave 2 THL Transactions ======== THL THL ======== ======== Transactions Transactions ======== ======== ======== ======== ======== ======== ======== ======== ======== Friday, November 11, 11 47
  • 60. Transaction IDs in the new master THL are understood immediately by the slaves New master Slave 1 Slave 2 Binary log Transactions ======== Binary log Binary log ======== ======== Transactions Transactions ======== ======== ======== ======== ======== ======== Give me ======== Give me ======== seqno #51 ======== seqno #67 Friday, November 11, 11 48
  • 62. parallel replication From here ... Friday, November 11, 11 50
  • 63. parallel replication To here. Friday, November 11, 11 51
  • 64. Parallel replication facts ✓Sharded by database ✓Good choice for slave lag problems ❖Bad choice for single database projects Friday, November 11, 11 52
  • 65. Benchmarking parallel replication Friday, November 11, 11 53
  • 66. db0 preparation (1) db1 sysbench db2 sysbench db3 sysbench db4 sysbench db5 sysbench db6 sysbench db7 sysbench db8 sysbench db9 sysbench sysbench Friday, November 11, 11 54
  • 67. before the test (2) STOPPED binary logs MySQL slave OFFLINE Tungsten slave direct: alpha (slave) replicator alpha Friday, November 11, 11 55
  • 68. starting the test STOPPED binary logs MySQL slave Concurrent sysbench on 30 databases running for 1 hour OFFLINE TOTAL DATA: 130 GB Tungsten slave direct: alpha RAM per server: 20GB (slave) replicator alpha Slaves will have 1 hour lag Friday, November 11, 11 56
  • 69. measuring results START binary logs MySQL slave ONLINE Recording catch-up time Tungsten slave direct: alpha (slave) replicator alpha Friday, November 11, 11 57
  • 70. MySQL native replication slave catch up in 04:29:30 Friday, November 11, 11 58
  • 71. Tungsten parallel replication slave catch up in 00:55:40 Friday, November 11, 11 59
  • 72. Parallel replication made simpler FROM HERE .... Friday, November 11, 11 60
  • 73. Parallel replication made simpler TO HERE Friday, November 11, 11 61
  • 74. Parallel replication made simpler Friday, November 11, 11 62
  • 75. parallel replication direct slave facts Friday, November 11, 11 63
  • 76. parallel replication direct slave facts ✓No need to install Tungsten on the master Friday, November 11, 11 63
  • 77. parallel replication direct slave facts ✓No need to install Tungsten on the master ✓Tungsten runs only on the slave Friday, November 11, 11 63
  • 78. parallel replication direct slave facts ✓No need to install Tungsten on the master ✓Tungsten runs only on the slave ✓Replication can revert to native slave with two commands (trepctl offline; start slave) Friday, November 11, 11 63
  • 79. parallel replication direct slave facts ✓No need to install Tungsten on the master ✓Tungsten runs only on the slave ✓Replication can revert to native slave with two commands (trepctl offline; start slave) ✓Native replication can continue on other slaves Friday, November 11, 11 63
  • 80. parallel replication direct slave facts ✓No need to install Tungsten on the master ✓Tungsten runs only on the slave ✓Replication can revert to native slave with two commands (trepctl offline; start slave) ✓Native replication can continue on other slaves ❖Failover (either native or Tungsten) becomes a manual task Friday, November 11, 11 63
  • 82. multiple masters • Tungsten Replicator recipe: use more services Friday, November 11, 11 65
  • 84. Bi-directional replication with slaves Friday, November 11, 11 67
  • 86. multiple sources • Tungsten Replicator recipe is still valid: use more services Friday, November 11, 11 69
  • 88. Multiple masters replication: 3 nodes Friday, November 11, 11 71
  • 89. Multiple masters replication: 4 nodes Friday, November 11, 11 72
  • 90. 4 nodes multiple masters simplified Friday, November 11, 11 73
  • 93. Conflict prevention facts Friday, November 11, 11 76
  • 94. Conflict prevention facts • Sharded by database Friday, November 11, 11 76
  • 95. Conflict prevention facts • Sharded by database • Defined dynamically Friday, November 11, 11 76
  • 96. Conflict prevention facts • Sharded by database • Defined dynamically • Applied either at the master or at the slave Friday, November 11, 11 76
  • 97. Conflict prevention facts • Sharded by database • Defined dynamically • Applied either at the master or at the slave • methods: Friday, November 11, 11 76
  • 98. Conflict prevention facts • Sharded by database • Defined dynamically • Applied either at the master or at the slave • methods: • make replication fail Friday, November 11, 11 76
  • 99. Conflict prevention facts • Sharded by database • Defined dynamically • Applied either at the master or at the slave • methods: • make replication fail • drop silently Friday, November 11, 11 76
  • 100. Conflict prevention facts • Sharded by database • Defined dynamically • Applied either at the master or at the slave • methods: • make replication fail • drop silently • drop with warning Friday, November 11, 11 76
  • 101. Tungsten Conflict prevention points host1 host3 M S S host2 host4 master S M S Friday, November 11, 11 77
  • 102. Tungsten Conflict prevention points host1 host3 M S S host2 host4 master S M S Friday, November 11, 11 77
  • 103. Tungsten Conflict prevention points host1 host3 M S S host2 host4 master S M S Friday, November 11, 11 77
  • 104. Prevention methods: Fail on master host1 host3 M S S host2 host4 master S M S Friday, November 11, 11 78
  • 105. INSERT A x,y Prevention methods: Fail on master host1 host3 M S S host2 host4 master S M S INSERT A x,z Friday, November 11, 11 78
  • 106. INSERT A x,y Prevention methods: Fail on master host1 host3 M S S host2 host4 master S M S INSERT A x,z Friday, November 11, 11 78
  • 107. Prevention methods: Fail on slave host1 host3 M S S host2 host4 master S M S Friday, November 11, 11 79
  • 108. INSERT A x,y Prevention methods: Fail on slave host1 host3 M S S host2 host4 master S M S INSERT A x,z Friday, November 11, 11 79
  • 109. INSERT A x,y Prevention methods: Fail on slave host1 host3 M S S host2 host4 master S M S INSERT A x,z Friday, November 11, 11 79
  • 110. Prevention methods: Fail on slave host1 (Multiple sources) M host2 host3 master M S Friday, November 11, 11 80
  • 111. INSERT A x,y Prevention methods: Fail on slave host1 (Multiple sources) M host2 host3 master M S INSERT A x,z Friday, November 11, 11 80
  • 112. INSERT A x,y Prevention methods: Fail on slave host1 (Multiple sources) M host2 host3 master M S INSERT A x,z Friday, November 11, 11 80
  • 113. Prevention methods: DROP on master host1 host3 M S S host2 host4 master S M S Friday, November 11, 11 81
  • 114. INSERT A x,y Prevention methods: DROP on master host1 host3 M S S host2 host4 master S M S Friday, November 11, 11 81
  • 115. INSERT A x,y Prevention methods: DROP on master host1 host3 M S S host2 host4 master S M S INSERT A x,z Friday, November 11, 11 81
  • 116. Prevention methods: DROP on master host1 host3 M S S host2 host4 master S M S INSERT A x,z Friday, November 11, 11 81
  • 117. Prevention methods: DROP on slave host1 (Multiple sources) M host2 host3 master M S Friday, November 11, 11 82
  • 118. INSERT A x,y Prevention methods: DROP on slave host1 (Multiple sources) M host2 host3 master M S INSERT A x,z Friday, November 11, 11 82
  • 119. Prevention methods: DROP on slave host1 (Multiple sources) M host2 INSERT A host3 x,y master INSERT A M x,z S Friday, November 11, 11 83
  • 120. Prevention methods: DROP on slave host1 (Multiple sources) M host2 host3 master INSERT A M x,z S Friday, November 11, 11 83
  • 121. Tungsten in practice Installation Friday, November 11, 11 84
  • 122. Installation • Check the requirements • Get the binaries • Expand the tarball • Run ./tools/tungsten-installer Friday, November 11, 11 85
  • 123. REQUIREMENTS • Java JRE or JDK (Sun/Oracle or Open-jdk) • Ruby 1.8 (only during installation) • ssh access to the same user in all nodes • MySQL user with all privileges Friday, November 11, 11 86
  • 124. Installation types • master / slave • slave - direct Friday, November 11, 11 87
  • 125. master/slave host2 host1 master slave THL binlog THL host3 slave THL Friday, November 11, 11 88
  • 126. slave direct host2 host1 slave master relay log THL binlog host3 slave relay log THL Friday, November 11, 11 89
  • 127. sample installation • 4 servers • qa.r1.continuent.com r1 • qa.r2.continuent.com r2 • qa.r3.continuent.com r3 • qa.r4.continuent.com r4 • MySQL 5.1 • tungsten-replicator-2.0.4 Friday, November 11, 11 90
  • 128. Installation (1) # starting at node 4, but any would do for N in 1 2 3 4 do ssh r$N mkdir tinstall done cd tinstall tar -xzf /path/to/tungsten-replicator-2.0.4.tar.gz cd tungsten-replicator-2.0.4 Friday, November 11, 11 91
  • 129. Installation (2) export TUNGSTEN_BASE=$HOME/tinstall 1 ./tools/tungsten-installer 2 --master-slave 3 --master-host=r1 4 --datasource-user=tungsten 5 --datasource-password=secret 6 --service-name=dragon 7 --home-directory=$TUNGSTEN_BASE 8 --cluster-hosts=r1,r2,r3,r4 9 --start Friday, November 11, 11 92
  • 130. Installation (2) export TUNGSTEN_BASE=$HOME/tinstall ./tools/tungsten-installer --master-slave # installation mode --master-host=r1 # who’s the master --datasource-user=tungsten # mysql username --datasource-password=secret # mysql password --service-name=dragon # name of the service --home-directory=$TUNGSTEN_BASE # where we install --cluster-hosts=r1,r2,r3,r4 # hosts in cluster --start # start replicator after installing Friday, November 11, 11 93
  • 131. What does the installation do 1: Validate all servers host4 host1 host2 host3 ✔ ✔ ✔ ✔ ✗ ✗ ✗ ✗ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ Report all errors Friday, November 11, 11 94
  • 132. What does the installation do 1 (again): Validate all servers host4 host1 host2 host3 ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ Friday, November 11, 11 95
  • 133. What does the installation do 2: install Tungsten in all servers host4 $HOME/ host1 tinstall/ host2 config/ host3 releases/ relay/ logs/ tungsten/ Friday, November 11, 11 96
  • 134. example ssh r2 chmod 444 $HOME/tinstall ./tools/tungsten-installer --master-slave --master-host=r1 --datasource-user=tungsten --datasource-password=secret --service-name=dragon --home-directory=$HOME/tinstall --thl-directory=$HOME/tinstall/logs --relay-directory=$HOME/tinstall/relay --cluster-hosts=r1,r2,r3,r4 --start ERROR >> qa.r2.continuent.com >> /home/tungsten/ tinstall is not writeable Friday, November 11, 11 97
  • 135. example ssh r2 chmod 755 $HOME/tinstall ./tools/tungsten-installer --master-slave --master-host=r1 --datasource-user=tungsten --datasource-password=secret --service-name=dragon --home-directory=$HOME/tinstall --thl-directory=$HOME/tinstall/logs --relay-directory=$HOME/tinstall/relay --cluster-hosts=r1,r2,r3,r4 --start # no errors Friday, November 11, 11 98
  • 136. Installation - direct ./tools/tungsten-installer --direct --master-host=r1 --slave-host=r4 --master-user=tungsten --slave-user=tungsten --master-password=secret --slave-password=secret --service-name=Castor --channels=1 --home-directory=$TUNGSTEN_BASE --start-and-report Friday, November 11, 11 99
  • 138. Tungsten Replicator vs. Enterprise Feature Replicator Enterprise Simple admin with trepctl X X MySQL Row/Statement 5.0/5.1/5.5 X X Multi-master replication X X Parallel apply (2.0) X X Distributed management with cctrl X Automated failover and recovery X Zero-downtime upgrade X SQL routing and load-balancing X Floating IP support X © Continuent 2011 Friday, November 11, 11 101
  • 139. Conclusion and Q&A Friday, November 11, 11 102
  • 140. Contact Information Worldwide 560 S. Winchester Blvd., Suite 500 San Jose, CA 95128 @datacharmer Tel (866) 998-3642 Fax (408) 668-1009 @continuent e-mail: sales@continuent.com Continuent Web Site: http://www.continuent.com Tungsten Project http://tungsten-replicator.org Getting started with Tungsten Replicator: http://datacharmer.blogspot.com © Continuent 2011 Friday, November 11, 11 103