SlideShare une entreprise Scribd logo
1  sur  65
Télécharger pour lire hors ligne
Testing MySQL creatively in a
Sandbox

Giuseppe Maxia
QA Director, Continuent, Inc



  http://mysqlsandbox.net

                    This work is licensed under the Creative Commons
                    Attribution-Share Alike 3.0 Unported License. To view a
                    copy of this license, visit http://creativecommons.org/
                    licenses/by-sa/3.0/ or send a letter to Creative Commons,
                    171 Second Street, Suite 300, San Francisco, California,
                    94105, USA.
Tuesday, April 17, 12                                                           1
about me - Giuseppe Maxia
  •      a.k.a. The Data Charmer
  •      QA Director at Continuent, Inc
  •      Long time hacking with MySQL features
  •      Formerly, community manager,db consultant, designer,
         coder.
  •      A passion for QA and open source
  •      Blogger
  • http://datacharmer.blogspot.com


Tuesday, April 17, 12                                           2
MySQL Sandbox
                           lightning
                         presentation

Tuesday, April 17, 12                   3
I used to install a lot of
                         MySQL databases for
                                testing


                   MANUALLY
Tuesday, April 17, 12                                4
Then, I decided
                         to use Perl ...


Tuesday, April 17, 12                      5
DBA pop
                          quiz
Tuesday, April 17, 12             6
HOW MANY KEYSTROKES
                 to install a MySQL server?




Tuesday, April 17, 12                         7
HOW MANY KEYSTROKES
                 to install a MySQL server?


                       10
               sb 5.0.83
               1234567890
Tuesday, April 17, 12                         7
HOW MANY KEYSTROKES
                    to install 3 MySQL servers
                          in replication?




Tuesday, April 17, 12                            8
HOW MANY KEYSTROKES
                    to install 3 MySQL servers
                          in replication?

                 11
        sb r5.0.83
        12345678901
Tuesday, April 17, 12                            8
HOW LONG
                         does it take
                  to install a MySQL server?




Tuesday, April 17, 12                          9
HOW LONG
                         does it take
                  to install a MySQL server?


                          < 5 seconds
                        time sb 5.0.83
                           0m1.518s
Tuesday, April 17, 12                          9
HOW LONG
                              does it take
                    to install 3 MySQL servers in
                              replication?




Tuesday, April 17, 12                               10
HOW LONG
                              does it take
                    to install 3 MySQL servers in
                              replication?

                        < 10 seconds
                         sb 5.0.83
                          0m4.515s
Tuesday, April 17, 12                               10
MySQL Sandbox
                        http://mysqlsandbox.net
             • Free software (Perl under GPL)
             • One (unix) host
             • Many database servers
             • Single or multiple sandboxes
             • Customized scripts to use the servers
             • Standard or circular replication
             • Installs IN SECONDS
Tuesday, April 17, 12                                  11
overview

         MySQL                                        MySQL
         server                                       server
             Data       DB1                    Data       DB1




             DB2        DB3
                              DATA DIRECTORY   DB2        DB3




                                   PORT


                                   SOCKET

Tuesday, April 17, 12                                           12
overview

         MySQL                                              MySQL
         server                                             server
             Data       DB1
                                     SAME            Data       DB1




             DB2        DB3
                                     DATA            DB2        DB3

                                  DIRECTORY?
  /var/lib/mysql                               /var/lib/mysql




                              DATA CORRUPTION
Tuesday, April 17, 12                                                 13
overview

         MySQL                                      MySQL
         server                                     server

                                    SAME
                                   PORT or
                                   SOCKET?
                        3306                      3306


 /tmp/mysql.sock                             /tmp/mysql.sock

                               DOES NOT START
Tuesday, April 17, 12                                        14
The hard way




Tuesday, April 17, 12                  15
The hard way

   Read the manual




Tuesday, April 17, 12                  15
The hard way

                         try to figure out
   Read the manual
                         what to change




Tuesday, April 17, 12                       15
The hard way

                         try to figure out
   Read the manual                          Install
                         what to change




Tuesday, April 17, 12                                 15
The easy way

                         MySQL Sandbox


     $ make_sandbox 
         /path/to/mysql-5.1.54_linux.tar.gz

     # it should work always




Tuesday, April 17, 12                         16
The easier way

                        Prepare once        Install many times

  # some                               $ make_sandbox 5.1.54
  # preliminary
  # work




Tuesday, April 17, 12                                            17
The easiest way

                        Prepare once       Install many times

  # some
  # preliminary                        $ sb 5.1.54
  # work




Tuesday, April 17, 12                                           18
MySQL Sandbox
                                                      VERSION
                                             MySQL
                                             server
            Data        DB1




            DB2         DB3
                              $SANDBOX_HOME/msb_VERSION/data


                                                       VERSION


                                    /tmp/mysql_VERSION.sock

Tuesday, April 17, 12                                            19
MySQL Sandbox
                                                     5.1.54
                                            MySQL
                                            server
            Data        DB1




            DB2         DB3
                              $SANDBOX_HOME/msb_5_1_54/data


                                                        5154


                                      /tmp/mysql_5154.sock

Tuesday, April 17, 12                                          20
MySQL Sandbox
                                                     5.5.9
                                            MySQL
                                            server
            Data        DB1




            DB2         DB3
                              $SANDBOX_HOME/msb_5_5_09/data


                                                       5509


                                      /tmp/mysql_5509.sock

Tuesday, April 17, 12                                         21
Single Sandbox
              MySQL         customized scripts
              server


     start
     stop
    restart
    status
     clear
   send_kill
      use

Tuesday, April 17, 12                            22
Multiple Sandbox
             MySQL           customized scripts
             server


      start_all
      stop_all
     restart_all m n1
     status_all s1 n2
      clear_all  s2 n3
     send_kill_a
         ll
       use_all
Tuesday, April 17, 12                             23
Where do you get it


        •from CPAN
              sudo su -
              cpan MySQL::Sandbox

        •from launchpad
              http://launchpad.net/mysql-sandbox




Tuesday, April 17, 12                              24
The easy replication way

                               MySQL Sandbox

 $ make_replication_sandbox 
     /path/to/mysql-5.1.54_linux.tar.gz


               Prepare once             Install many times

    # some                      $ make_replication_sandbox
    # preparation               5.1.54


Tuesday, April 17, 12                                        25
default architecture
                                          $HOME




                             /sandboxes            opt
                                                               expanded
                                                                tarballs
                        $SANDBOX_HOME
                                                  mysql


                                             $SANDBOX_BINARY
           installed
          sandboxes

Tuesday, April 17, 12                                                      26
default architecture
                                                  $HOME



                                     /sandboxes            opt



                        msb_5_0_91
                                                          mysql
                        msb_5_1_48
                                                                  5.0.91
                        rsandbox_5_1_48
                                                                  5.1.45
                               master
                                                                  5.1.48
                               node1
                                                                  5.5.4
                               node2
Tuesday, April 17, 12                                                      27
Tuesday, April 17, 12   28
creating a single sandbox
                  make_sandbox 
                     /path/to/mysql-X.X.XX-OS.tar.gz




Tuesday, April 17, 12                                  29
using a single sandbox
                  # after
                  # make_sandbox 
                  #   /path/to/mysql-X.X.XX-OS.tar.gz

                  $ cd $SANDBOX_HOME/msb_X_X_XX
                  $ ./use




Tuesday, April 17, 12                                   30
creating a single sandbox
                        with a specific options file

                  make_sandbox 
                     /path/to/mysql-X.X.XX-OS.tar.gz 
                     --my_file=/path/to/my.cnf




Tuesday, April 17, 12                                    31
easily create a sandbox after the first
                       one
                        The long way
 $ cd $HOME/opt/mysql   # $SANDBOX_BINARY
 $   gunzip -c 
   /path/to/mysql-5.1.34-osx10.5-x86.tar.gz 
    | tar -xf -
 $ mv mysql-5.1.34-osx10.5-x86 5.1.34
 $ make sandbox 5.1.34




Tuesday, April 17, 12                           32
easily create a sandbox after the first
                       one
                        The short way
 $ make_sandbox --export_binaries 
   path/to/mysql-5.1.34-osx10.5-x86.tar.gz




Tuesday, April 17, 12                         33
starting a single sandbox
                  $ cd $SANDBOX_HOME/msb_X_X_XX
                  $ ./start




Tuesday, April 17, 12                               34
starting a single sandbox
                        with temporary options
                  $ cd $SANDBOX_HOME/msb_X_X_XX
                  $ ./start --option=value


                  $ ./restart --option=value


                  $ ./start --key-buffer=20000000




Tuesday, April 17, 12                               35
creating a sandbox with custom port
                 and directory
                  $ make_sandbox 5.1.34 -- 
                     --sandbox_port=7800 
                     --sandbox_directory=mickeymouse




Tuesday, April 17, 12                                  36
creating a sandbox with automatic
                      port checking
                  $ make_sandbox 5.1.34 -- --check_port


                  # if 5.1.34 is free
                  #    port=5134
                  #    directory=msb_5_1_34
                  # else
                  #    port=5135 (or the first free)
                  #    directory=msb_5_1_34_a




Tuesday, April 17, 12                                     37
create a replication sandbox


 $ make_replication_sandbox 
   path/to/mysql-5.1.34-osx10.5-x86.tar.gz




Tuesday, April 17, 12                                  38
create a circular replication sandbox


 $ make_replication_sandbox 
   --circular=4 
   path/to/mysql-5.1.34-osx10.5-x86.tar.gz




Tuesday, April 17, 12                          39
changing port to an existing sandbox


 $ sbtool -o port 
     -s /path/to/source/sandbox 
     --new_port=XXXX




Tuesday, April 17, 12                        40
installing the innodb plugin


 $ sbtool -o plugin 
     --plugin=innodb 
     -s /path/to/source/sandbox




Tuesday, April 17, 12                                  41
creating a replication sandbox with
                     new base port

 $ make_replication_sandbox 
     --replication_directory=newwdir 
     --check_base_port 5.0.79

 #       Creates a replication directory under
 #       $SANDBOX_HOME/newdir
 #       The previous one is preserved.
 #       No conflicts happen

Tuesday, April 17, 12                            42
creating a stand-alone master
 $ make_sandbox 5.5.16 -- --master

 # Creates a sandbox with binary log and
 # server-id enabled




Tuesday, April 17, 12                                   43
creating a quick slave
 ~/sandboxes/rsandbox_5_5_16/m -e 'show
 variables like "port"'
 +---------------+-------+
 | Variable_name | Value |
 +---------------+-------+
 | port          | 19771 |
 +---------------+-------+

 $ make_sandbox 5.5.16 -- 
   --slaveof='master_port=19771'

 # adds a slave to an existing master


Tuesday, April 17, 12                            44
MySQL Sandbox cookbook


 $ perldoc MySQL::Sandbox::Recipes




Tuesday, April 17, 12                            45
testing MySQL creatively




Tuesday, April 17, 12                              46
Breaking replication
 make_replication_sandbox 5.5.16

 cd $HOME/sandboxes/rsandbox_5_5_16

 ./m -e 'create table t1 (i int not null primary key)'
 test
 ./s1 -e 'insert into t1 values (1)' test
 ./m -e 'insert into t1 values (1)' test
 ./s1 -e 'show slave statusG' | grep 'Error|Running'
             Slave_IO_Running: Yes
             Slave_SQL_Running: No
                    Last_Error: Error 'Duplicate entry '1' for   key
 'PRIMARY'' on query. Default database: 'test'. Query: 'insert   into t1
 values (1)'
                 Last_IO_Error:
                Last_SQL_Error: Error 'Duplicate entry '1' for   key
 'PRIMARY'' on query. Default database: 'test'. Query: 'insert   into t1
 values (1)'



Tuesday, April 17, 12                                                  47
Fixing replication
 ./s1 -e 'delete from t1 where i = 1' test
 ./s1 -e 'start slave'
 ./s1 -e 'show slave statusG' | grep 'Error|Running'
                         Slave_IO_Running: Yes
                        Slave_SQL_Running: Yes
                               Last_Error:
                            Last_IO_Error:
                           Last_SQL_Error:




Tuesday, April 17, 12                                    48
Making a slave lag
 ./s1 -e 'stop slave SQL_THREAD'
 ./s2 -e 'stop slave SQL_THREAD'

 ./m < heavy_load_commands.sql


 # 1 hour later

 ./s1 -e 'start slave SQL_THREAD'
 ./s2 -e 'start slave SQL_THREAD'




Tuesday, April 17, 12                        49
Options for replication nodes
     --master_options = name        Options passed to the master
     --slave_options = name         Options passed to each slave
     --node_options = name          Options passed to each node
     --one_slave_options = name     Options passed to a specific slave
                                     with the format "N:options"




Tuesday, April 17, 12                                                    50
customizing sandboxes during
                               installation (1)
     make_replication_sandbox 
       --node_options=--high_performance 
       --one_slave_options='1:-c read-only'
       5.1.57




Tuesday, April 17, 12                                  51
customizing sandboxes during
                               installation (2)
 ./use_all 'show variables like "%innodb%buffer%"'
 # master
 Variable_name Value
 innodb_buffer_pool_size 536870912
 innodb_log_buffer_size 52428800
 # server: 1:
 Variable_name Value
 innodb_buffer_pool_size 536870912
 innodb_log_buffer_size 52428800
 # server: 2:
 Variable_name Value
 innodb_buffer_pool_size 536870912
 innodb_log_buffer_size 52428800



Tuesday, April 17, 12                                  52
customizing sandboxes during
                               installation (3)
     ./use_all 'show variables like
     "%read_only%"'
     # master
     Variable_name Value
     read_only OFF
     # server: 1:
     Variable_name Value
     read_only ON
     # server: 2:
     Variable_name Value
     read_only OFF



Tuesday, April 17, 12                                  53
re-playing binary logs
     • 1) server become unusable for human error
     • 2) install a new server
     • 3) load the latest backup
     • 4) create a sandbox and copy the binary logs to its data
            directory

     • 5) make the new server a slave of the sandbox
     • 6) wait for completion
     • 7) reset slave
     • 8) remove the sandbox

Tuesday, April 17, 12                                             54
Testing Percona Server
     make_sandbox 
       --add_prefix=ps 
       --export_binaries 
       Percona-Server-5.5.21-osx10.7-.tar.gz

     # and later

     make_sandbox ps5.5.21




Tuesday, April 17, 12                            55
DEMO




Tuesday, April 17, 12          56
Participate!




Tuesday, April 17, 12                  57
THANKS

                         http://mysqlsandbox.net




  This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http://
  creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California,
  94105, USA.
Tuesday, April 17, 12                                                                                                                            58

Contenu connexe

Tendances

Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...Software Park Thailand
 
Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008Eduardo Castro
 
The Dolphins Leap Again
The Dolphins Leap AgainThe Dolphins Leap Again
The Dolphins Leap AgainIvan Zoratti
 
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware companyMySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware companyContinuent
 
Debugging and Configuration Best Practices for Oracle Linux
Debugging and Configuration Best Practices for Oracle LinuxDebugging and Configuration Best Practices for Oracle Linux
Debugging and Configuration Best Practices for Oracle LinuxTerry Wang
 
MySQL Cluster 8.0 tutorial text
MySQL Cluster 8.0 tutorial textMySQL Cluster 8.0 tutorial text
MySQL Cluster 8.0 tutorial textFrazer Clement
 
Getting started with my sql
Getting started with my sqlGetting started with my sql
Getting started with my sqlWeb Sky
 
The History and Future of the MySQL ecosystem
The History and Future of the MySQL ecosystemThe History and Future of the MySQL ecosystem
The History and Future of the MySQL ecosystemRonald Bradford
 
What's New in MySQL 5.6
What's New in MySQL 5.6What's New in MySQL 5.6
What's New in MySQL 5.6Santo Leto
 
"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
 
MySQL Backup and Recovery Essentials
MySQL Backup and Recovery EssentialsMySQL Backup and Recovery Essentials
MySQL Backup and Recovery EssentialsRonald Bradford
 
MySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD TourMySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD TourRonald Bradford
 
MySQL Scalability Mistakes - OTN
MySQL Scalability Mistakes - OTNMySQL Scalability Mistakes - OTN
MySQL Scalability Mistakes - OTNRonald Bradford
 
MySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryMySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryLouis liu
 
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql Cluster
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql ClusterSanto Leto - MySQL Connect 2012 - Getting Started with Mysql Cluster
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql ClusterSanto Leto
 

Tendances (18)

Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
 
Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008
 
The Dolphins Leap Again
The Dolphins Leap AgainThe Dolphins Leap Again
The Dolphins Leap Again
 
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware companyMySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
 
Debugging and Configuration Best Practices for Oracle Linux
Debugging and Configuration Best Practices for Oracle LinuxDebugging and Configuration Best Practices for Oracle Linux
Debugging and Configuration Best Practices for Oracle Linux
 
MySQL Cluster 8.0 tutorial text
MySQL Cluster 8.0 tutorial textMySQL Cluster 8.0 tutorial text
MySQL Cluster 8.0 tutorial text
 
Getting started with my sql
Getting started with my sqlGetting started with my sql
Getting started with my sql
 
The History and Future of the MySQL ecosystem
The History and Future of the MySQL ecosystemThe History and Future of the MySQL ecosystem
The History and Future of the MySQL ecosystem
 
Introduction Mysql
Introduction Mysql Introduction Mysql
Introduction Mysql
 
What's New in MySQL 5.6
What's New in MySQL 5.6What's New in MySQL 5.6
What's New in MySQL 5.6
 
"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
 
MySQL Backup and Recovery Essentials
MySQL Backup and Recovery EssentialsMySQL Backup and Recovery Essentials
MySQL Backup and Recovery Essentials
 
MySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD TourMySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD Tour
 
MySQL高可用
MySQL高可用MySQL高可用
MySQL高可用
 
MySQL Scalability Mistakes - OTN
MySQL Scalability Mistakes - OTNMySQL Scalability Mistakes - OTN
MySQL Scalability Mistakes - OTN
 
MySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryMySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summary
 
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql Cluster
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql ClusterSanto Leto - MySQL Connect 2012 - Getting Started with Mysql Cluster
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql Cluster
 
MySQL 开发
MySQL 开发MySQL 开发
MySQL 开发
 

Similaire à Testing mysql creatively in a sandbox

Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012Giuseppe Maxia
 
PyCon talk: Deploy Python apps in 5 min with a PaaS
PyCon talk: Deploy Python apps in 5 min with a PaaSPyCon talk: Deploy Python apps in 5 min with a PaaS
PyCon talk: Deploy Python apps in 5 min with a PaaSAppsembler
 
Spring Data NHJUG April 2012
Spring Data NHJUG April 2012Spring Data NHJUG April 2012
Spring Data NHJUG April 2012trisberg
 
What can we learn from NoSQL technologies?
What can we learn from NoSQL technologies?What can we learn from NoSQL technologies?
What can we learn from NoSQL technologies?Ivan Zoratti
 
Practicing Continuous Deployment
Practicing Continuous DeploymentPracticing Continuous Deployment
Practicing Continuous Deploymentzeeg
 
Mysql 2007 Tech At Digg V3
Mysql 2007 Tech At Digg V3Mysql 2007 Tech At Digg V3
Mysql 2007 Tech At Digg V3epee
 
Complex Made Simple: Sleep Better With TorqueBox
Complex Made Simple: Sleep Better With TorqueBoxComplex Made Simple: Sleep Better With TorqueBox
Complex Made Simple: Sleep Better With TorqueBoxLance Ball
 
Austin OpenStack Meetup: Chef and OpenStack
Austin OpenStack Meetup: Chef and OpenStackAustin OpenStack Meetup: Chef and OpenStack
Austin OpenStack Meetup: Chef and OpenStackMatt Ray
 
Solr, Lucene and Hadoop @ Etsy
Solr, Lucene and Hadoop @ EtsySolr, Lucene and Hadoop @ Etsy
Solr, Lucene and Hadoop @ Etsylucenerevolution
 
MySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and DevelopersMySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and DevelopersRonald Bradford
 
2013 - Matías Paterlini: Escalando PHP con sharding y Amazon Web Services
2013 - Matías Paterlini: Escalando PHP con sharding y Amazon Web Services 2013 - Matías Paterlini: Escalando PHP con sharding y Amazon Web Services
2013 - Matías Paterlini: Escalando PHP con sharding y Amazon Web Services PHP Conference Argentina
 
Escalando una PHP App con DB sharding - PHP Conference
Escalando una PHP App con DB sharding - PHP ConferenceEscalando una PHP App con DB sharding - PHP Conference
Escalando una PHP App con DB sharding - PHP ConferenceMatias Paterlini
 
UPHPU Meeting, February 17, 2012
UPHPU Meeting, February 17, 2012UPHPU Meeting, February 17, 2012
UPHPU Meeting, February 17, 2012andersonjohnd
 
Software Libraries And Numbers
Software Libraries And NumbersSoftware Libraries And Numbers
Software Libraries And NumbersRobert Reiz
 
MySQL Cluster no PayPal
MySQL Cluster no PayPalMySQL Cluster no PayPal
MySQL Cluster no PayPalMySQL Brasil
 
CloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heavenCloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heavenPatrick Chanezon
 
Pinterest arch summit august 2012 - scaling pinterest
Pinterest arch summit   august 2012 - scaling pinterestPinterest arch summit   august 2012 - scaling pinterest
Pinterest arch summit august 2012 - scaling pinterestdrewz lin
 
JS-Everywhere - SSE Hands-on
JS-Everywhere - SSE Hands-onJS-Everywhere - SSE Hands-on
JS-Everywhere - SSE Hands-onBrice Argenson
 
Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyBlazing Cloud
 

Similaire à Testing mysql creatively in a sandbox (20)

Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012
 
PyCon talk: Deploy Python apps in 5 min with a PaaS
PyCon talk: Deploy Python apps in 5 min with a PaaSPyCon talk: Deploy Python apps in 5 min with a PaaS
PyCon talk: Deploy Python apps in 5 min with a PaaS
 
Spring Data NHJUG April 2012
Spring Data NHJUG April 2012Spring Data NHJUG April 2012
Spring Data NHJUG April 2012
 
What can we learn from NoSQL technologies?
What can we learn from NoSQL technologies?What can we learn from NoSQL technologies?
What can we learn from NoSQL technologies?
 
Practicing Continuous Deployment
Practicing Continuous DeploymentPracticing Continuous Deployment
Practicing Continuous Deployment
 
Mysql 2007 Tech At Digg V3
Mysql 2007 Tech At Digg V3Mysql 2007 Tech At Digg V3
Mysql 2007 Tech At Digg V3
 
Complex Made Simple: Sleep Better With TorqueBox
Complex Made Simple: Sleep Better With TorqueBoxComplex Made Simple: Sleep Better With TorqueBox
Complex Made Simple: Sleep Better With TorqueBox
 
Austin OpenStack Meetup: Chef and OpenStack
Austin OpenStack Meetup: Chef and OpenStackAustin OpenStack Meetup: Chef and OpenStack
Austin OpenStack Meetup: Chef and OpenStack
 
Solr, Lucene and Hadoop @ Etsy
Solr, Lucene and Hadoop @ EtsySolr, Lucene and Hadoop @ Etsy
Solr, Lucene and Hadoop @ Etsy
 
MySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and DevelopersMySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and Developers
 
2013 - Matías Paterlini: Escalando PHP con sharding y Amazon Web Services
2013 - Matías Paterlini: Escalando PHP con sharding y Amazon Web Services 2013 - Matías Paterlini: Escalando PHP con sharding y Amazon Web Services
2013 - Matías Paterlini: Escalando PHP con sharding y Amazon Web Services
 
Escalando una PHP App con DB sharding - PHP Conference
Escalando una PHP App con DB sharding - PHP ConferenceEscalando una PHP App con DB sharding - PHP Conference
Escalando una PHP App con DB sharding - PHP Conference
 
UPHPU Meeting, February 17, 2012
UPHPU Meeting, February 17, 2012UPHPU Meeting, February 17, 2012
UPHPU Meeting, February 17, 2012
 
Software Libraries And Numbers
Software Libraries And NumbersSoftware Libraries And Numbers
Software Libraries And Numbers
 
MySQL Cluster no PayPal
MySQL Cluster no PayPalMySQL Cluster no PayPal
MySQL Cluster no PayPal
 
CloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heavenCloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heaven
 
Pinterest arch summit august 2012 - scaling pinterest
Pinterest arch summit   august 2012 - scaling pinterestPinterest arch summit   august 2012 - scaling pinterest
Pinterest arch summit august 2012 - scaling pinterest
 
Mysql tutorial
Mysql tutorialMysql tutorial
Mysql tutorial
 
JS-Everywhere - SSE Hands-on
JS-Everywhere - SSE Hands-onJS-Everywhere - SSE Hands-on
JS-Everywhere - SSE Hands-on
 
Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_many
 

Plus 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
 
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
 
Building simple and complex clusters with tungsten replicator
Building simple and complex clusters with tungsten replicatorBuilding simple and complex clusters with tungsten replicator
Building simple and complex clusters with tungsten replicatorGiuseppe Maxia
 

Plus 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
 
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
 
Building simple and complex clusters with tungsten replicator
Building simple and complex clusters with tungsten replicatorBuilding simple and complex clusters with tungsten replicator
Building simple and complex clusters with tungsten replicator
 

Dernier

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
 
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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Dernier (20)

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
 
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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
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 ...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Testing mysql creatively in a sandbox

  • 1. Testing MySQL creatively in a Sandbox Giuseppe Maxia QA Director, Continuent, Inc http://mysqlsandbox.net This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/ licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. Tuesday, April 17, 12 1
  • 2. about me - Giuseppe Maxia • a.k.a. The Data Charmer • QA Director at Continuent, Inc • Long time hacking with MySQL features • Formerly, community manager,db consultant, designer, coder. • A passion for QA and open source • Blogger • http://datacharmer.blogspot.com Tuesday, April 17, 12 2
  • 3. MySQL Sandbox lightning presentation Tuesday, April 17, 12 3
  • 4. I used to install a lot of MySQL databases for testing MANUALLY Tuesday, April 17, 12 4
  • 5. Then, I decided to use Perl ... Tuesday, April 17, 12 5
  • 6. DBA pop quiz Tuesday, April 17, 12 6
  • 7. HOW MANY KEYSTROKES to install a MySQL server? Tuesday, April 17, 12 7
  • 8. HOW MANY KEYSTROKES to install a MySQL server? 10 sb 5.0.83 1234567890 Tuesday, April 17, 12 7
  • 9. HOW MANY KEYSTROKES to install 3 MySQL servers in replication? Tuesday, April 17, 12 8
  • 10. HOW MANY KEYSTROKES to install 3 MySQL servers in replication? 11 sb r5.0.83 12345678901 Tuesday, April 17, 12 8
  • 11. HOW LONG does it take to install a MySQL server? Tuesday, April 17, 12 9
  • 12. HOW LONG does it take to install a MySQL server? < 5 seconds time sb 5.0.83 0m1.518s Tuesday, April 17, 12 9
  • 13. HOW LONG does it take to install 3 MySQL servers in replication? Tuesday, April 17, 12 10
  • 14. HOW LONG does it take to install 3 MySQL servers in replication? < 10 seconds sb 5.0.83 0m4.515s Tuesday, April 17, 12 10
  • 15. MySQL Sandbox http://mysqlsandbox.net • Free software (Perl under GPL) • One (unix) host • Many database servers • Single or multiple sandboxes • Customized scripts to use the servers • Standard or circular replication • Installs IN SECONDS Tuesday, April 17, 12 11
  • 16. overview MySQL MySQL server server Data DB1 Data DB1 DB2 DB3 DATA DIRECTORY DB2 DB3 PORT SOCKET Tuesday, April 17, 12 12
  • 17. overview MySQL MySQL server server Data DB1 SAME Data DB1 DB2 DB3 DATA DB2 DB3 DIRECTORY? /var/lib/mysql /var/lib/mysql DATA CORRUPTION Tuesday, April 17, 12 13
  • 18. overview MySQL MySQL server server SAME PORT or SOCKET? 3306 3306 /tmp/mysql.sock /tmp/mysql.sock DOES NOT START Tuesday, April 17, 12 14
  • 19. The hard way Tuesday, April 17, 12 15
  • 20. The hard way Read the manual Tuesday, April 17, 12 15
  • 21. The hard way try to figure out Read the manual what to change Tuesday, April 17, 12 15
  • 22. The hard way try to figure out Read the manual Install what to change Tuesday, April 17, 12 15
  • 23. The easy way MySQL Sandbox $ make_sandbox /path/to/mysql-5.1.54_linux.tar.gz # it should work always Tuesday, April 17, 12 16
  • 24. The easier way Prepare once Install many times # some $ make_sandbox 5.1.54 # preliminary # work Tuesday, April 17, 12 17
  • 25. The easiest way Prepare once Install many times # some # preliminary $ sb 5.1.54 # work Tuesday, April 17, 12 18
  • 26. MySQL Sandbox VERSION MySQL server Data DB1 DB2 DB3 $SANDBOX_HOME/msb_VERSION/data VERSION /tmp/mysql_VERSION.sock Tuesday, April 17, 12 19
  • 27. MySQL Sandbox 5.1.54 MySQL server Data DB1 DB2 DB3 $SANDBOX_HOME/msb_5_1_54/data 5154 /tmp/mysql_5154.sock Tuesday, April 17, 12 20
  • 28. MySQL Sandbox 5.5.9 MySQL server Data DB1 DB2 DB3 $SANDBOX_HOME/msb_5_5_09/data 5509 /tmp/mysql_5509.sock Tuesday, April 17, 12 21
  • 29. Single Sandbox MySQL customized scripts server start stop restart status clear send_kill use Tuesday, April 17, 12 22
  • 30. Multiple Sandbox MySQL customized scripts server start_all stop_all restart_all m n1 status_all s1 n2 clear_all s2 n3 send_kill_a ll use_all Tuesday, April 17, 12 23
  • 31. Where do you get it •from CPAN sudo su - cpan MySQL::Sandbox •from launchpad http://launchpad.net/mysql-sandbox Tuesday, April 17, 12 24
  • 32. The easy replication way MySQL Sandbox $ make_replication_sandbox /path/to/mysql-5.1.54_linux.tar.gz Prepare once Install many times # some $ make_replication_sandbox # preparation 5.1.54 Tuesday, April 17, 12 25
  • 33. default architecture $HOME /sandboxes opt expanded tarballs $SANDBOX_HOME mysql $SANDBOX_BINARY installed sandboxes Tuesday, April 17, 12 26
  • 34. default architecture $HOME /sandboxes opt msb_5_0_91 mysql msb_5_1_48 5.0.91 rsandbox_5_1_48 5.1.45 master 5.1.48 node1 5.5.4 node2 Tuesday, April 17, 12 27
  • 36. creating a single sandbox make_sandbox /path/to/mysql-X.X.XX-OS.tar.gz Tuesday, April 17, 12 29
  • 37. using a single sandbox # after # make_sandbox # /path/to/mysql-X.X.XX-OS.tar.gz $ cd $SANDBOX_HOME/msb_X_X_XX $ ./use Tuesday, April 17, 12 30
  • 38. creating a single sandbox with a specific options file make_sandbox /path/to/mysql-X.X.XX-OS.tar.gz --my_file=/path/to/my.cnf Tuesday, April 17, 12 31
  • 39. easily create a sandbox after the first one The long way $ cd $HOME/opt/mysql # $SANDBOX_BINARY $ gunzip -c /path/to/mysql-5.1.34-osx10.5-x86.tar.gz | tar -xf - $ mv mysql-5.1.34-osx10.5-x86 5.1.34 $ make sandbox 5.1.34 Tuesday, April 17, 12 32
  • 40. easily create a sandbox after the first one The short way $ make_sandbox --export_binaries path/to/mysql-5.1.34-osx10.5-x86.tar.gz Tuesday, April 17, 12 33
  • 41. starting a single sandbox $ cd $SANDBOX_HOME/msb_X_X_XX $ ./start Tuesday, April 17, 12 34
  • 42. starting a single sandbox with temporary options $ cd $SANDBOX_HOME/msb_X_X_XX $ ./start --option=value $ ./restart --option=value $ ./start --key-buffer=20000000 Tuesday, April 17, 12 35
  • 43. creating a sandbox with custom port and directory $ make_sandbox 5.1.34 -- --sandbox_port=7800 --sandbox_directory=mickeymouse Tuesday, April 17, 12 36
  • 44. creating a sandbox with automatic port checking $ make_sandbox 5.1.34 -- --check_port # if 5.1.34 is free # port=5134 # directory=msb_5_1_34 # else # port=5135 (or the first free) # directory=msb_5_1_34_a Tuesday, April 17, 12 37
  • 45. create a replication sandbox $ make_replication_sandbox path/to/mysql-5.1.34-osx10.5-x86.tar.gz Tuesday, April 17, 12 38
  • 46. create a circular replication sandbox $ make_replication_sandbox --circular=4 path/to/mysql-5.1.34-osx10.5-x86.tar.gz Tuesday, April 17, 12 39
  • 47. changing port to an existing sandbox $ sbtool -o port -s /path/to/source/sandbox --new_port=XXXX Tuesday, April 17, 12 40
  • 48. installing the innodb plugin $ sbtool -o plugin --plugin=innodb -s /path/to/source/sandbox Tuesday, April 17, 12 41
  • 49. creating a replication sandbox with new base port $ make_replication_sandbox --replication_directory=newwdir --check_base_port 5.0.79 # Creates a replication directory under # $SANDBOX_HOME/newdir # The previous one is preserved. # No conflicts happen Tuesday, April 17, 12 42
  • 50. creating a stand-alone master $ make_sandbox 5.5.16 -- --master # Creates a sandbox with binary log and # server-id enabled Tuesday, April 17, 12 43
  • 51. creating a quick slave ~/sandboxes/rsandbox_5_5_16/m -e 'show variables like "port"' +---------------+-------+ | Variable_name | Value | +---------------+-------+ | port | 19771 | +---------------+-------+ $ make_sandbox 5.5.16 -- --slaveof='master_port=19771' # adds a slave to an existing master Tuesday, April 17, 12 44
  • 52. MySQL Sandbox cookbook $ perldoc MySQL::Sandbox::Recipes Tuesday, April 17, 12 45
  • 54. Breaking replication make_replication_sandbox 5.5.16 cd $HOME/sandboxes/rsandbox_5_5_16 ./m -e 'create table t1 (i int not null primary key)' test ./s1 -e 'insert into t1 values (1)' test ./m -e 'insert into t1 values (1)' test ./s1 -e 'show slave statusG' | grep 'Error|Running' Slave_IO_Running: Yes Slave_SQL_Running: No Last_Error: Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'insert into t1 values (1)' Last_IO_Error: Last_SQL_Error: Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'insert into t1 values (1)' Tuesday, April 17, 12 47
  • 55. Fixing replication ./s1 -e 'delete from t1 where i = 1' test ./s1 -e 'start slave' ./s1 -e 'show slave statusG' | grep 'Error|Running' Slave_IO_Running: Yes Slave_SQL_Running: Yes Last_Error: Last_IO_Error: Last_SQL_Error: Tuesday, April 17, 12 48
  • 56. Making a slave lag ./s1 -e 'stop slave SQL_THREAD' ./s2 -e 'stop slave SQL_THREAD' ./m < heavy_load_commands.sql # 1 hour later ./s1 -e 'start slave SQL_THREAD' ./s2 -e 'start slave SQL_THREAD' Tuesday, April 17, 12 49
  • 57. Options for replication nodes --master_options = name Options passed to the master --slave_options = name Options passed to each slave --node_options = name Options passed to each node --one_slave_options = name Options passed to a specific slave with the format "N:options" Tuesday, April 17, 12 50
  • 58. customizing sandboxes during installation (1) make_replication_sandbox --node_options=--high_performance --one_slave_options='1:-c read-only' 5.1.57 Tuesday, April 17, 12 51
  • 59. customizing sandboxes during installation (2) ./use_all 'show variables like "%innodb%buffer%"' # master Variable_name Value innodb_buffer_pool_size 536870912 innodb_log_buffer_size 52428800 # server: 1: Variable_name Value innodb_buffer_pool_size 536870912 innodb_log_buffer_size 52428800 # server: 2: Variable_name Value innodb_buffer_pool_size 536870912 innodb_log_buffer_size 52428800 Tuesday, April 17, 12 52
  • 60. customizing sandboxes during installation (3) ./use_all 'show variables like "%read_only%"' # master Variable_name Value read_only OFF # server: 1: Variable_name Value read_only ON # server: 2: Variable_name Value read_only OFF Tuesday, April 17, 12 53
  • 61. re-playing binary logs • 1) server become unusable for human error • 2) install a new server • 3) load the latest backup • 4) create a sandbox and copy the binary logs to its data directory • 5) make the new server a slave of the sandbox • 6) wait for completion • 7) reset slave • 8) remove the sandbox Tuesday, April 17, 12 54
  • 62. Testing Percona Server make_sandbox --add_prefix=ps --export_binaries Percona-Server-5.5.21-osx10.7-.tar.gz # and later make_sandbox ps5.5.21 Tuesday, April 17, 12 55
  • 65. THANKS http://mysqlsandbox.net This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http:// creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. Tuesday, April 17, 12 58