SlideShare una empresa de Scribd logo
1 de 46
Descargar para leer sin conexión
Testing MySQL
Creatively in a sandbox
Giuseppe Maxia
QA Director, Continuent, Inc




                   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, February 7, 12                                                        1
Laziness
         Laziness is a disinclination to
         activity or exertion despite
         having the ability to do so.



         http://en.wikipedia.org/wiki/Laziness
Tuesday, February 7, 12                          2
I have the ability

                     • but I don't feel inclined to do repetitive
                          work
                     • I ADMIT IT: I AM LAZY



Tuesday, February 7, 12                                             3
I have the ability

                     • but I don't feel inclined to do repetitive
                          work
                     • I ADMIT IT: I AM LAZY



Tuesday, February 7, 12                                             3
A lazy developer ®


        Someone who writes 12,000
        lines of code to spare himself (*)
        the trouble of typing 15 lines
        on a terminal.
(*) And another 1,000,000 people
Tuesday, February 7, 12                        4
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
             • Supports MySQL, Percona, MariaDB servers
             • Installs IN SECONDS
Tuesday, February 7, 12                                   5
overview

         MySQL                                          MySQL
         server                                         server
            Data          DB1                    Data       DB1




            DB2           DB3
                                DATA DIRECTORY   DB2        DB3




                                     PORT


                                     SOCKET

Tuesday, February 7, 12                                           6
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, February 7, 12                                                 7
overview

         MySQL                                        MySQL
         server                                       server

                                      SAME
                                     PORT or
                                     SOCKET?
                          3306                      3306


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

                                 DOES NOT START
Tuesday, February 7, 12                                        8
The easy way
     $ make_sandbox 
                     /path/to/mysql-5.1.54_linux.tar.gz


     $ make_sandbox 
                     Percona-Server-5.1.54_linux.tar.gz


     # it should work always




Tuesday, February 7, 12                                   9
The easier way
     $ make_sandbox 5.1.54




     # Needs some preliminary work




Tuesday, February 7, 12                    10
The easiest way
     $ sb 5.1.54




     # Needs the same preliminary work




Tuesday, February 7, 12                     11
MySQL Sandbox
                                                        VERSION
                                               MySQL
                                               server
            Data          DB1




            DB2           DB3
                                $SANDBOX_HOME/msb_VERSION/data


                                                         VERSION


                                      /tmp/mysql_VERSION.sock

Tuesday, February 7, 12                                            12
MySQL Sandbox
                                                       5.1.54
                                              MySQL
                                              server
            Data          DB1




            DB2           DB3
                                $SANDBOX_HOME/msb_5_1_54/data


                                                          5154


                                        /tmp/mysql_5154.sock

Tuesday, February 7, 12                                          13
MySQL Sandbox
                                                       5.5.9
                                              MySQL
                                              server
            Data          DB1




            DB2           DB3
                                $SANDBOX_HOME/msb_5_5_09/data


                                                         5509


                                        /tmp/mysql_5509.sock

Tuesday, February 7, 12                                         14
Single Sandbox
             MySQL            customized scripts
             server


     start
     stop
    restart
    status
     clear
   send_kill
      use

Tuesday, February 7, 12                            15
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, February 7, 12                             16
Where do you get it


        •from CPAN
              $ sudo su -
              # cpan MySQL::Sandbox

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




Tuesday, February 7, 12                            17
The easy replication way
     $ make_replication_sandbox 
                     /path/to/mysql-5.1.54_linux.tar.gz


     # or, after some preparation


     $ make_replication_sandbox 5.1.54




Tuesday, February 7, 12                                   18
default architecture
                                            $HOME




                               /sandboxes            opt
                                                                 expanded
                                                                  tarballs
                          $SANDBOX_HOME
                                                    mysql


                                               $SANDBOX_BINARY
          installed
         sandboxes

Tuesday, February 7, 12                                                      19
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, February 7, 12                                                      20
Tuesday, February 7, 12   21
creating a single sandbox
                 make_sandbox 
                    /path/to/mysql-X.X.XX-OS.tar.gz




Tuesday, February 7, 12                               22
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, February 7, 12                                23
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, February 7, 12                                 24
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, February 7, 12                         25
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, February 7, 12                       26
starting a single sandbox
                 $ cd $SANDBOX_HOME/msb_X_X_XX
                 $ ./start




Tuesday, February 7, 12                               27
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, February 7, 12                               28
creating a sandbox with custom port
                 and directory
                 $ make_sandbox 5.1.34 -- 
                    --sandbox_port=7800 
                    --sandbox_directory=mickeymouse




Tuesday, February 7, 12                               29
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, February 7, 12                                  30
create a replication sandbox


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




Tuesday, February 7, 12                                  31
changing port to an existing sandbox


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




Tuesday, February 7, 12                      32
more recipes


 $ perldoc MySQL::Sandbox::Recipes




Tuesday, February 7, 12                  33
MySQL Sandbox evolution




Tuesday, February 7, 12                             34
More flexible


                     • make_sandbox
                      • --high_performance
                      • --master (creates a standalone master)
                      • --slaveof (makes a quick slave of an
                          existing server, even of different versions)



Tuesday, February 7, 12                                                  35
create a customized replication
                              system

 $ make_sandbox 5.1.57 -- --master

 $ make_sandbox 5.5.18 
   -- --slaveof='master_port=5157'

 $ make_sandbox 5.6.3 
   -- --slaveof='master_port=5157'


Tuesday, February 7, 12                             36
Easier to integrate in other
                                    systems
                     • make_multiple_sandbox,
                          make_replication_sandbox
                          • --node_options='options'
                          • --one_slave_option='N:options'
                          • --one_node_option='N:options'
                          • --master_options='options'
                          • --slave_options='options'
Tuesday, February 7, 12                                      37
Tungsten
                          Sandbox




Tuesday, February 7, 12              38
replicator
                                            1



                                        replicator
                          TSB               2



                                        replicator
                                            3

                                                     database
              HOME                                       1




                                                     database
                           sandboxes   base_dir          2




                                                     database
                                                         3




Tuesday, February 7, 12                                         39
tungsten sandbox help
     Tungsten Tools, version 2.0.07
     Tungsten Sandbox - Cluster builder
      (C) 2011 Giuseppe Maxia, Continuent, Inc
 Syntax: /home/tungsten/bin/tungsten-sandbox [options] operation
     -n --nodes = number                 How many nodes to install
     -m --mysql-version = name           which MySQL version to use
     -t --tungsten-base = name           Where to install the sandbox
     -i --installation-directory = name Where the Tungsten tarball has been expanded
     -d --group-dir = name               sandbox group directory name
     --topology = name                   Which topology to deploy
     --hub = number                      Which node is a hub
     -s --service = name                 How the service is named
     -x --tsb-prefix = name              Tungsten Sandbox prefix
     -p --base-port = number             Base port for MySQL Sandbox nodes
     -l --thl-port = number              Port for the THL service
     -r --rmi-port = number              Port for the RMI service
     -v --version                        Show Tungsten sandbox version and exit
     --show-options                      Show Tungsten sandbox collected options and exit
     --ignore-manifest                   Ignore build values in .manifest when determining if
 the Tungsten package
                                         can be used with this sandbox
     --verbose                           Show more information during installation and help
     --man|manual                        display the program manual
     --install-options = name            Options to be passed to the underlying installer,
 with the format
                                         {TR|MSB}:ROLE:options
                                         Where TR is Tungsten Replicator, MSB is MySQL
 Sandbox, and ROLE can be
                                         one of MASTER, SLAVE, DIRECT, NODE, HUB, ENDPOINT,
 GLOBAL
     -h --help                           display this help

Tuesday, February 7, 12                                                                     40
tungsten sandbox
 $ tungsten-sandbox -m 5.5.10 
    --topology=master-slave

 $ tungsten-sandbox -m 5.1.60 
   --topology=star 
   --nodes=5 --hub=2

 $ tungsten-sandbox -m 5.5.18 
   --topology=direct 
   --nodes=2

 $ tungsten-sandbox -m 5.1.60 
   --topology=all-masters 
   --nodes=8


Tuesday, February 7, 12                      41
tungsten sandbox
 ls ~/tsb2
 clear_tsandbox db2 db_clear_all     db_send_kill_all db_status_all
 db_use_all      n1 n3              restart_tsandbox test_topology
 tungsten_sandbox.info
 db1             db3 db_restart_all db_start_all       db_stop_all
 erase_tsandbox n2 replicator_all services_all        trepctl_all




Tuesday, February 7, 12                                               42
Participate!




Tuesday, February 7, 12                  43
Participate!




Tuesday, February 7, 12                  44
THANKS
                                                                                 Let's talk!




 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, February 7, 12                                                                                                                         45

Más contenido relacionado

La actualidad más candente

My sql storage engines
My sql storage enginesMy sql storage engines
My sql storage engines
Vasudeva Rao
 
Cloud, Cache, and Configs
Cloud, Cache, and ConfigsCloud, Cache, and Configs
Cloud, Cache, and Configs
Scott Taylor
 

La actualidad más candente (12)

MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
 
MySQL For Oracle Developers
MySQL For Oracle DevelopersMySQL For Oracle Developers
MySQL For Oracle Developers
 
MySQL Cluster 8.0 tutorial text
MySQL Cluster 8.0 tutorial textMySQL Cluster 8.0 tutorial text
MySQL Cluster 8.0 tutorial text
 
My sql storage engines
My sql storage enginesMy sql storage engines
My sql storage engines
 
What makes JBoss AS7 tick?
What makes JBoss AS7 tick?What makes JBoss AS7 tick?
What makes JBoss AS7 tick?
 
The Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL DatabasesThe Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL Databases
 
MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)
 
Extending Spring for Custom Usage
Extending Spring for Custom UsageExtending Spring for Custom Usage
Extending Spring for Custom Usage
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
 
Cloud, Cache, and Configs
Cloud, Cache, and ConfigsCloud, Cache, and Configs
Cloud, Cache, and Configs
 
BITS: Introduction to MySQL - Introduction and Installation
BITS: Introduction to MySQL - Introduction and InstallationBITS: Introduction to MySQL - Introduction and Installation
BITS: Introduction to MySQL - Introduction and Installation
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
 

Destacado

Destacado (8)

Innodb plugin in MySQL 5.1
Innodb plugin in MySQL 5.1Innodb plugin in MySQL 5.1
Innodb plugin in MySQL 5.1
 
Database Basics with PHP -- Connect JS Conference October 17th, 2015
Database Basics with PHP -- Connect JS Conference October 17th, 2015Database Basics with PHP -- Connect JS Conference October 17th, 2015
Database Basics with PHP -- Connect JS Conference October 17th, 2015
 
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
 
MySQL in your laptop
MySQL in your laptopMySQL in your laptop
MySQL in your laptop
 
Boosting performance with Mysql partitions
Boosting performance with Mysql partitionsBoosting performance with Mysql partitions
Boosting performance with Mysql partitions
 
Scaling your web app with MySQL replication
Scaling your web app with MySQL replicationScaling your web app with MySQL replication
Scaling your web app with MySQL replication
 
Advanced mysql replication techniques
Advanced mysql replication techniquesAdvanced mysql replication techniques
Advanced mysql replication techniques
 
Java project titles for mca @dreamweb techno solutions trichy
Java   project titles for  mca @dreamweb techno solutions trichyJava   project titles for  mca @dreamweb techno solutions trichy
Java project titles for mca @dreamweb techno solutions trichy
 

Similar a Testing mysql creatively in a sandbox

Cloudstack talk
Cloudstack talkCloudstack talk
Cloudstack talk
bodepd
 
Cloud building talk
Cloud building talkCloud building talk
Cloud building talk
bodepd
 
Tango Database & MySQL Cluster
Tango Database & MySQL ClusterTango Database & MySQL Cluster
Tango Database & MySQL Cluster
elliando dias
 
Drupal Con My Sql Ha 2008 08 29
Drupal Con My Sql Ha 2008 08 29Drupal Con My Sql Ha 2008 08 29
Drupal Con My Sql Ha 2008 08 29
liufabin 66688
 
Scalability
ScalabilityScalability
Scalability
felho
 

Similar a Testing mysql creatively in a sandbox (20)

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
 
Cloudstack talk
Cloudstack talkCloudstack talk
Cloudstack talk
 
Grails 2.0 Update
Grails 2.0 UpdateGrails 2.0 Update
Grails 2.0 Update
 
Keith Larson Replication
Keith Larson ReplicationKeith Larson Replication
Keith Larson Replication
 
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?
 
Automatic Configuration of Your Cloud with Puppet
Automatic Configuration of Your Cloud with PuppetAutomatic Configuration of Your Cloud with Puppet
Automatic Configuration of Your Cloud with Puppet
 
Cloud building talk
Cloud building talkCloud building talk
Cloud building talk
 
Posscon my sql56
Posscon my sql56Posscon my sql56
Posscon my sql56
 
Intergalactic data speak_highload++_20131028
Intergalactic data speak_highload++_20131028Intergalactic data speak_highload++_20131028
Intergalactic data speak_highload++_20131028
 
Tango Database & MySQL Cluster
Tango Database & MySQL ClusterTango Database & MySQL Cluster
Tango Database & MySQL Cluster
 
David Fetter, Disqus
David Fetter, DisqusDavid Fetter, Disqus
David Fetter, Disqus
 
Drupal Con My Sql Ha 2008 08 29
Drupal Con My Sql Ha 2008 08 29Drupal Con My Sql Ha 2008 08 29
Drupal Con My Sql Ha 2008 08 29
 
Scalability
ScalabilityScalability
Scalability
 
MySQL Sandbox 3
MySQL Sandbox 3MySQL Sandbox 3
MySQL Sandbox 3
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Dbdeployer
DbdeployerDbdeployer
Dbdeployer
 
Nosql and newsql
Nosql and newsqlNosql and newsql
Nosql and newsql
 
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, the universal installer
Dbdeployer, the universal installerDbdeployer, the universal installer
Dbdeployer, the universal installer
 
Seminar : "The Future of MySQL - Roadmap to Success" session MySQL ...
Seminar : "The Future of MySQL - Roadmap to Success" session MySQL ...Seminar : "The Future of MySQL - Roadmap to Success" session MySQL ...
Seminar : "The Future of MySQL - Roadmap to Success" session MySQL ...
 

Más de Giuseppe Maxia

Más 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
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
 
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
 
Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012
 
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
 
Moving data for the masses
Moving data for the massesMoving data for the masses
Moving data for the masses
 
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive lazinessMySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
 
Mysql replication outside the box
Mysql replication outside the boxMysql replication outside the box
Mysql replication outside the box
 
Jailbreaking mysql replication
Jailbreaking mysql replicationJailbreaking mysql replication
Jailbreaking mysql replication
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
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
giselly40
 

Último (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
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
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
[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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Testing mysql creatively in a sandbox

  • 1. Testing MySQL Creatively in a sandbox Giuseppe Maxia QA Director, Continuent, Inc 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, February 7, 12 1
  • 2. Laziness Laziness is a disinclination to activity or exertion despite having the ability to do so. http://en.wikipedia.org/wiki/Laziness Tuesday, February 7, 12 2
  • 3. I have the ability • but I don't feel inclined to do repetitive work • I ADMIT IT: I AM LAZY Tuesday, February 7, 12 3
  • 4. I have the ability • but I don't feel inclined to do repetitive work • I ADMIT IT: I AM LAZY Tuesday, February 7, 12 3
  • 5. A lazy developer ® Someone who writes 12,000 lines of code to spare himself (*) the trouble of typing 15 lines on a terminal. (*) And another 1,000,000 people Tuesday, February 7, 12 4
  • 6. 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 • Supports MySQL, Percona, MariaDB servers • Installs IN SECONDS Tuesday, February 7, 12 5
  • 7. overview MySQL MySQL server server Data DB1 Data DB1 DB2 DB3 DATA DIRECTORY DB2 DB3 PORT SOCKET Tuesday, February 7, 12 6
  • 8. 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, February 7, 12 7
  • 9. overview MySQL MySQL server server SAME PORT or SOCKET? 3306 3306 /tmp/mysql.sock /tmp/mysql.sock DOES NOT START Tuesday, February 7, 12 8
  • 10. The easy way $ make_sandbox /path/to/mysql-5.1.54_linux.tar.gz $ make_sandbox Percona-Server-5.1.54_linux.tar.gz # it should work always Tuesday, February 7, 12 9
  • 11. The easier way $ make_sandbox 5.1.54 # Needs some preliminary work Tuesday, February 7, 12 10
  • 12. The easiest way $ sb 5.1.54 # Needs the same preliminary work Tuesday, February 7, 12 11
  • 13. MySQL Sandbox VERSION MySQL server Data DB1 DB2 DB3 $SANDBOX_HOME/msb_VERSION/data VERSION /tmp/mysql_VERSION.sock Tuesday, February 7, 12 12
  • 14. MySQL Sandbox 5.1.54 MySQL server Data DB1 DB2 DB3 $SANDBOX_HOME/msb_5_1_54/data 5154 /tmp/mysql_5154.sock Tuesday, February 7, 12 13
  • 15. MySQL Sandbox 5.5.9 MySQL server Data DB1 DB2 DB3 $SANDBOX_HOME/msb_5_5_09/data 5509 /tmp/mysql_5509.sock Tuesday, February 7, 12 14
  • 16. Single Sandbox MySQL customized scripts server start stop restart status clear send_kill use Tuesday, February 7, 12 15
  • 17. 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, February 7, 12 16
  • 18. Where do you get it •from CPAN $ sudo su - # cpan MySQL::Sandbox •from launchpad http://launchpad.net/mysql-sandbox Tuesday, February 7, 12 17
  • 19. The easy replication way $ make_replication_sandbox /path/to/mysql-5.1.54_linux.tar.gz # or, after some preparation $ make_replication_sandbox 5.1.54 Tuesday, February 7, 12 18
  • 20. default architecture $HOME /sandboxes opt expanded tarballs $SANDBOX_HOME mysql $SANDBOX_BINARY installed sandboxes Tuesday, February 7, 12 19
  • 21. 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, February 7, 12 20
  • 23. creating a single sandbox make_sandbox /path/to/mysql-X.X.XX-OS.tar.gz Tuesday, February 7, 12 22
  • 24. 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, February 7, 12 23
  • 25. 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, February 7, 12 24
  • 26. 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, February 7, 12 25
  • 27. 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, February 7, 12 26
  • 28. starting a single sandbox $ cd $SANDBOX_HOME/msb_X_X_XX $ ./start Tuesday, February 7, 12 27
  • 29. 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, February 7, 12 28
  • 30. creating a sandbox with custom port and directory $ make_sandbox 5.1.34 -- --sandbox_port=7800 --sandbox_directory=mickeymouse Tuesday, February 7, 12 29
  • 31. 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, February 7, 12 30
  • 32. create a replication sandbox $ make_replication_sandbox path/to/mysql-5.1.34-osx10.5-x86.tar.gz Tuesday, February 7, 12 31
  • 33. changing port to an existing sandbox $ sbtool -o port -s /path/to/source/sandbox --new_port=XXXX Tuesday, February 7, 12 32
  • 34. more recipes $ perldoc MySQL::Sandbox::Recipes Tuesday, February 7, 12 33
  • 35. MySQL Sandbox evolution Tuesday, February 7, 12 34
  • 36. More flexible • make_sandbox • --high_performance • --master (creates a standalone master) • --slaveof (makes a quick slave of an existing server, even of different versions) Tuesday, February 7, 12 35
  • 37. create a customized replication system $ make_sandbox 5.1.57 -- --master $ make_sandbox 5.5.18 -- --slaveof='master_port=5157' $ make_sandbox 5.6.3 -- --slaveof='master_port=5157' Tuesday, February 7, 12 36
  • 38. Easier to integrate in other systems • make_multiple_sandbox, make_replication_sandbox • --node_options='options' • --one_slave_option='N:options' • --one_node_option='N:options' • --master_options='options' • --slave_options='options' Tuesday, February 7, 12 37
  • 39. Tungsten Sandbox Tuesday, February 7, 12 38
  • 40. replicator 1 replicator TSB 2 replicator 3 database HOME 1 database sandboxes base_dir 2 database 3 Tuesday, February 7, 12 39
  • 41. tungsten sandbox help Tungsten Tools, version 2.0.07 Tungsten Sandbox - Cluster builder (C) 2011 Giuseppe Maxia, Continuent, Inc Syntax: /home/tungsten/bin/tungsten-sandbox [options] operation -n --nodes = number How many nodes to install -m --mysql-version = name which MySQL version to use -t --tungsten-base = name Where to install the sandbox -i --installation-directory = name Where the Tungsten tarball has been expanded -d --group-dir = name sandbox group directory name --topology = name Which topology to deploy --hub = number Which node is a hub -s --service = name How the service is named -x --tsb-prefix = name Tungsten Sandbox prefix -p --base-port = number Base port for MySQL Sandbox nodes -l --thl-port = number Port for the THL service -r --rmi-port = number Port for the RMI service -v --version Show Tungsten sandbox version and exit --show-options Show Tungsten sandbox collected options and exit --ignore-manifest Ignore build values in .manifest when determining if the Tungsten package can be used with this sandbox --verbose Show more information during installation and help --man|manual display the program manual --install-options = name Options to be passed to the underlying installer, with the format {TR|MSB}:ROLE:options Where TR is Tungsten Replicator, MSB is MySQL Sandbox, and ROLE can be one of MASTER, SLAVE, DIRECT, NODE, HUB, ENDPOINT, GLOBAL -h --help display this help Tuesday, February 7, 12 40
  • 42. tungsten sandbox $ tungsten-sandbox -m 5.5.10 --topology=master-slave $ tungsten-sandbox -m 5.1.60 --topology=star --nodes=5 --hub=2 $ tungsten-sandbox -m 5.5.18 --topology=direct --nodes=2 $ tungsten-sandbox -m 5.1.60 --topology=all-masters --nodes=8 Tuesday, February 7, 12 41
  • 43. tungsten sandbox ls ~/tsb2 clear_tsandbox db2 db_clear_all db_send_kill_all db_status_all db_use_all n1 n3 restart_tsandbox test_topology tungsten_sandbox.info db1 db3 db_restart_all db_start_all db_stop_all erase_tsandbox n2 replicator_all services_all trepctl_all Tuesday, February 7, 12 42
  • 46. THANKS Let's talk! 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, February 7, 12 45