SlideShare une entreprise Scribd logo
1  sur  103
Télécharger pour lire hors ligne
MySQL Sandbox 3.0
                    Installing and testing MySQL servers
                                 effortlessly

                         http://launchpad.net/mysql-sandbox




                                                                      Giuseppe Maxia
                                                                     MySQL Community


                               This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License.

Sunday, 23 August 2009
Overview
        Not an official Sun/MySQL product
        GPL
        installs from a tarball in a few seconds
        to install side servers, not the main instance
        creates a separated environment
                    data directory
                    port
                    socket
         groups of related or unrelated servers
           


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

Sunday, 23 August 2009
System requirements
        Unix like operating system
                    Linux
                    Mac OS X
                    Solaris
                    Free BSD
        MySQL binary tarball
        MySQL Sandbox (current version 3.0.04)
        Perl
        Bash shell


Sunday, 23 August 2009
explaining the sandbox is like boxing




      explaining takes longer than delivering


Sunday, 23 August 2009
Overview




  data directory                    data directory

    port                            port

    socket                          socket



Sunday, 23 August 2009
Overview

                          same data
                          directory?



  /usr/local/mysql/data                /usr/local/mysql/data




                         data corruption


Sunday, 23 August 2009
Overview
                               same data
                                port or
                                socket?

          3306                             3306

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



                           does not start

Sunday, 23 August 2009
the hard way
          1.unpack the tarball
          2.ensure that it goes to a separate directory
          3.create the database tables
          4.create a .cnf file with separate
                • port
                • data directory
                                               error prone
                • socket
          5.launch mysqld_safe manually
          6.launch mysql with options


Sunday, 23 August 2009
Why tar.gz?
                         Why not .rpm/.deb/.pgk?
            • it would work
            • but only in their specific environments

           The sandbox aims at being standard
                across operating systems.

          It works the same way on Linux, Mac
             OSX, OpenSolaris, FreeBSD, and
                  probably many more
Sunday, 23 August 2009
MySQL Sandbox                       VERSION




                   $SANDBOX_HOME/msb_VERSION/data

                  VERSION

               /tmp/mysql_VERSION.sock


Sunday, 23 August 2009
MySQL Sandbox                          5.1.37




                     $SANDBOX_HOME/msb_5_1_37/data

                         5137

                     /tmp/mysql_5137.sock


Sunday, 23 August 2009
MySQL Sandbox                              5.4.1




                         $SANDBOX_HOME/msb_5_4_1/data

                         5401

                     /tmp/mysql_5401.sock


Sunday, 23 August 2009
MySQL Sandbox
                                   single sandbox
                                      commands

                start
                             use
                 stop
               restart
                clear
              send_kill

Sunday, 23 August 2009
MySQL Sandbox      multiple sandbox
                            commands

                         One sandbox to
                          rule them all
       start_all                m   n1
        stop_all               s1   n2
       clear_all               s2   n3
     send_kill_all
         use_all
Sunday, 23 August 2009
The easy way - installation

# as root
$ cpan
cpan> install MySQL::Sandbox




Sunday, 23 August 2009
Installing the sandbox as
                             unprivileged user
# download the sandbox
# http://launchpad.net/mysql-sandbox/
$ tar -xzf MySQL-Sandbox-x.x.x.tar.gz
$ cd MySQL-Sandbox-x.x.x/
$ perl Makefile.PL 
   PREFIX=$HOME/usr/local
$ make
$ make test
$ make install

# change $PERL5LIB and $PATH
Sunday, 23 August 2009
The easy way - single sandbox

$ make_sandbox 
    /path/mysql-OS-5.1.37.tar.gz

# that's it!




Sunday, 23 August 2009
The easy way - replication
      $ make_replication_sandbox 
          /path/mysql-OS-5.1.37.tar.gz

      # that's it!




Sunday, 23 August 2009
The easy way - circular replication
      $ make_replication_sandbox 
          --circular=5 
          /path/mysql-OS-5.1.37.tar.gz

      # that's it!




Sunday, 23 August 2009
The easy way - multiple servers
      $ make_multiple_sandbox 
          /path/mysql-OS-5.1.37.tar.gz

      # that's it!




Sunday, 23 August 2009
The even easier way -
                         $SANDBOX_BINARY
  # default SANDBOX_BINARY=$HOME/opt/mysql
  $ export SANDBOX_BINARY=$HOME/mybin
  $ ls $SANDBOX_BINARY
      5.0.64 5.0.66 5.0.67 5.1.20
      5.1.23 5.1.24 5.1.25 5.1.26
      5.1.28 5.1.29 5.1.37 5.1.38

  $ make_sandbox 5.1.37

  # that's it!



Sunday, 23 August 2009
multiple servers - different
                                   versions
      $ make_multiple_custom_sandbox 
          5.0.67 5.1.37 5.4.1

      # that's it!




Sunday, 23 August 2009
fine tuning
      $ make_sandbox 
          /path/mysql-OS-5.1.37.tar.gz 
          [option] [option] [option]




Sunday, 23 August 2009
pick your size
    $ make_sandbox 
        /path/mysql-OS-5.1.37.tar.gz 
        --my_file={small|medium|large|huge}




Sunday, 23 August 2009
fine tuning easily
      $ make_sandbox 
          /path/mysql-OS-5.1.37.tar.gz 
          --interactive




Sunday, 23 August 2009
fine tuning easily

      Enter the values for each option
      * To leave the interactive choice and accept default
        values for the remaining options, enter 'default'
      * To go to the previous item, enter 'back'
      * To quit the installation without any action, enter
        'quit'
      ------------------------------------------
      home_directory
         The home directory. (default: $HOME/sandboxes
         (/Users/gmax/sandboxes))
      Your choice: (current value [/Users/gmax/sandboxes]) _




Sunday, 23 August 2009
hands on




Sunday, 23 August 2009
Using the sandbox

           ./start [mysqld options]
           starts the server
           creates a .pid file in the data directory
           creates a socket file in /tmp
           if a .pid file exists, it exits immediately




Sunday, 23 August 2009
Using the sandbox

           ./restart [mysqld options]
           starts the server
           creates a .pid file in the data directory
           creates a socket file in /tmp
           if a .pid file exists, it exits immediately




Sunday, 23 August 2009
Using the sandbox

           ./stop
           stops the server
           if no .pid file exists, it exits immediately




Sunday, 23 August 2009
Using the sandbox

           ./send_kill
           stops the server, using
           kill -TERM pid#
           if the server is unresponsive, uses
           kill -KILL pid#




Sunday, 23 August 2009
Using the sandbox

           ./clear
           stops the server (by calling the stop script)
           removes all files in the data directory
           empties the test database




Sunday, 23 August 2009
Using the sandbox

           ./use
           starts the mysql client
           uses the credentials in the my_sandbox.cnf
           default username and password:
         msandbox/msandbox
            root password:
         msandbox




Sunday, 23 August 2009
Using the sandbox

           ./my {sqldump|sqlbinlog|sqladmin}
           starts a mysql command line tool
           uses the credentials in the my_sandbox.cnf

         it's a shortcut to call the tool from the right version
          with the proper options




Sunday, 23 August 2009
using mysql clients
      $ ./my sqlbinlog 
         ./data/mysql-bin.000001 |less

      $ ./my sqldump dbname > dumpname

      $ ./my sqladmin extended-status
      # no username or password needed!




Sunday, 23 August 2009
Using the replication sandbox
           ./start_all
        starts the master and all the slaves
           ./stop_all
        stops all the slaves and then the master
           ./send_kill_all
        kills all the slaves and then the master
            ./clear_all
         clears all the slaves and then the master
           ./use_all "command"
        executes "command" for all nodes
Sunday, 23 August 2009
Using the replication sandbox

            ./m
         uses the master
            ./s1
         uses the first slave

            ./s2 [s3, s4 ... ]
         uses the Nth slave




Sunday, 23 August 2009
Using the multi-nodes sandbox
            ./start_all
         starts all the nodes
           ./stop_all
        stops all the nodes
            ./send_kill_all
         kills all the nodes
            ./clear_all
         clears all the nodes
           ./use_all "command"
        executes "command" for all nodes
Sunday, 23 August 2009
Using the multi-node sandbox

           ./n1
        uses the first node

           ./n2 [n3, n4 ... ]
        uses the Nth node




Sunday, 23 August 2009
Using the $SANDBOX_HOME directory
         the master sandbox that rules them all
            ./start_all
         starts all the sandboxes
           ./stop_all
        stops all the sandboxes

           ./clear_all
        clear all the sandboxes
           ./use_all     "SQL statement"
        passes a SQL statement to all servers
         in all sandboxes
Sunday, 23 August 2009
a crowded host
           sandbox
            5.0.67


             replication
              replication
               replication
                                   7 servers
               5.1.26
                5.1.26
                 5.0.67


             independent
              independent
               independent
                 5.1.26
                  5.1.26
                   5.0.67




Sunday, 23 August 2009
a differently crowded host
           sandbox
            5.0.67

                                 7 servers
             replication
              replication
               replication
               5.1.26
                5.1.26
                 5.0.67
                                               independent
                                                  5.0.67
                                     independent     independent
                                         5.4.1          5.1.26



Sunday, 23 August 2009
a more crowded host
           sandbox                       sandbox
            5.1.37                         5.4.1


             replication                 replication
                                          replication
              replication
               replication
               5.1.26
                5.1.26           14        replication
                                           5.1.26
                                            5.1.26
                 5.1.37                       5.4.1
                               servers
             independent                 independent
                                          independent
              independent
               independent                 independent
                 5.1.26                      5.1.26
                                              5.1.26
                  5.1.26
                   5.1.37                      5.4.1




Sunday, 23 August 2009
an even more crowded host
       sandbox                  sandbox           sandbox
        5.0.67                   5.1.37             5.4.1


         replication             replication      replication
                                                   replication
          replication
           replication            replication       replication
           5.1.26                  replication
                                   5.1.37           5.1.26
                                                     5.1.26
            5.1.26
             5.0.67                 5.1.37             5.4.1
                                     5.1.37


         independent             independent      independent
                                                   independent
          independent
           independent            independent       independent
                                                      5.1.26
             5.1.26                independent
                                     5.1.26            5.1.26
              5.1.26
               5.0.67                 5.1.26            5.4.1
                                       5.1.37

                                                 21
Sunday, 23 August 2009
DEMO TIME




Sunday, 23 August 2009
Installing a single one
    $ make_sandbox 5.1.37
      Executing ./low_level_make_sandbox --basedir=/Users/gmax/opt/mysql/5.1.37 
                --sandbox_directory=msb_5_1_37 
                --install_version=5.1 
                --sandbox_port=5129 
                --no_ver_after_name 
                --my_clause=log-error=msandbox.err
          The MySQL Sandbox, version 2.0.12 16-Oct-2008
          (C) 2006,2007,2008 Giuseppe Maxia, Sun Microsystems, Database Group
      installing with the following parameters:
      upper_directory                = /Users/gmax/sandboxes
      sandbox_directory              = msb_5_1_37
      sandbox_port                   = 5129
      datadir_from                   = script
      install_version                = 5.1
      basedir                        = /Users/gmax/opt/mysql/5.1.37
      operating_system_user          = gmax
      db_user                        = msandbox
      db_password                    = msandbox
      my_clause                      = log-error=msandbox.err
      prompt_prefix                  = mysql
      prompt_body                    = [h] {u} (d) > '
      do you agree? ([Y],n)
      loading grants
      .. sandbox server started
      ----------------------------------------
      Your sandbox server was installed in /Users/gmax/sandboxes/msb_5_1_37




Sunday, 23 August 2009
Using a single one
    $ cd $HOME/sandboxes/msb_5_1_37
    $ ./use

    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 3
    Server version: 5.1.37-rc MySQL Community Server (GPL)

    Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

    mysql [localhost] {msandbox} ((none)) >




Sunday, 23 August 2009
Installing a replication sandbox
    $ make_replication_sandbox 5.1.37
    installing and starting master
    installing slave 1
    installing slave 2
    starting slave 1
    .. sandbox server started
    starting slave 2
    .. sandbox server started
    initializing slave 1
    initializing slave 2
    replication directory installed on
      /Users/gmax/sandboxes/rsandbox_5_1_37




Sunday, 23 August 2009
using a replication sandbox
    $ cd $HOME/sandboxes/rsandbox_5_1_37
    # m = master

    $ ./m test
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 4
    Server version: 5.1.37-rc-log MySQL Community Server (GPL)

    Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

    master [localhost] {msandbox} (test) > create table t1 (i int);
    Query OK, 0 rows affected (0.08 sec)




Sunday, 23 August 2009
using a replication sandbox
    # s1 is slave1

    $ ./s1 test
    slave1 [localhost] {msandbox} (test) > show tables;
    +----------------+
    | Tables_in_test |
    +----------------+
    | t1             |
    +----------------+




Sunday, 23 August 2009
using a replication sandbox
    # checking the slaves

    $ ./check_slaves
    slave # 1
                 Slave_IO_Running:   Yes
                Slave_SQL_Running:   Yes
    slave # 2
                 Slave_IO_Running:   Yes
                Slave_SQL_Running:   Yes




Sunday, 23 August 2009
using a replication sandbox
    # sending commands to all nodes

    $ ./use all "SELECT @@server_id"
    # master
    @@server_id
    1
    # server: 1:
    @@server_id
    101
    # server: 2:
    @@server_id
    102




Sunday, 23 August 2009
Example: breaking replication
    # leveraging command line scripts
    $ ./m -e 'create table test.t2 (i int primary key)'
    $ ./s1 -e 'insert into test.t2 values (1)'
    $ ./m -e 'insert into test.t2 values (1)'
    $ ./check_slaves
    slave # 1
                 Slave_IO_Running: Yes
                Slave_SQL_Running: No
    slave # 2
                 Slave_IO_Running: Yes
                Slave_SQL_Running: Yes

    $ ./s1 -e 'show slave statusG' |grep Last_Error
    Last_Error: Error 'Duplicate entry '1' for key 'PRIMARY''
     on query. Default database: ''. Query: '



Sunday, 23 August 2009
Installing circular replication
    $ make_replication_sandbox --circular=4 5.1.34
    installing node 1
    installing node 2
    installing node 3
    installing node 4
    # server: 1:
    # server: 2:
    # server: 3:
    # server: 4:
    Circular replication activated
    group directory installed on
      /Users/gmax/sandboxes/rcsandbox_5_1_34




Sunday, 23 August 2009
using circular replication
   $ cd $HOME/sandboxes/rcsandbox_5_1_34
   $    ./n1 -e 'create table test.t1 (i int)'
   $    ./n3 -e 'insert into test.t1 values (3)'
   $    ./use_all 'select * from test.t1'
   #    server: 1:
   i
   3
   #    server: 2:
   i
   3
   #    server: 3:
   i
   3
   #    server: 4:
   i
   3


Sunday, 23 August 2009
Easy testing conditions (1)
   $ cd $HOME/sandboxes/msb_5_1_35
   $ ./use -e 'show variables like
   "key_buffer_size"'
   +-----------------+---------+
   | Variable_name    | Value  |
   +-----------------+---------+
   | key_buffer_size | 8384512 |
   +-----------------+---------+

   # we need to increase this one




Sunday, 23 August 2009
Easy testing conditions (2)
   $ ./restart --key_buffer=20M

   $ ./use -e 'show variables like
   "key_buffer_size"'
   +-----------------+-----------+
   | Variable_name    | Value    |
   +-----------------+-----------+
   | key_buffer_size | 209715200 |
   +-----------------+-----------+

   # as easy as saying it!



Sunday, 23 August 2009
Testing same version in different
                     conditions
   $ make_multiple_sandbox 5.1.34 
     --group_directory=unpartitioned 
     --base_port=5500 --check_base_port

   $ make_multiple_sandbox 5.1.34 
     --group_directory=partitioned 
     --how_many_nodes=4 
     --base_port=6500 --check_base_port




Sunday, 23 August 2009
Testing same version in different
                     conditions
         $SANDBOX_HOME/unpartitioned
         |
         +-- node1 MyISAM
         |
         +-- node2 InnoDB
         |
         +-- node3 Archive




Sunday, 23 August 2009
Testing same version in different
                     conditions
         $SANDBOX_HOME/partitioned
         |
         +-- node1 MyISAM by month
         |
         +-- node2 InnoDB by month
         |
         +-- node3 InnoDB file per table by month
         |
         +-- node4 Archive by month




Sunday, 23 August 2009
Running tests
   cd $SANDBOX_HOME/unpartitioned

   ./stop_all
   RESULTS=unpartitioned_results.txt
   date > $RESULTS
   for SB in 1 2 3
   do
      ./node$SB/start
      time ./n$SB < test.sql >> $RESULTS
      ./node$DB/stop
   done
   # more on tests later on. Stay tuned

Sunday, 23 August 2009
Latest news




Sunday, 23 August 2009
MySQL Sandbox 3.0
        Released as Perl package - now on CPAN
        Added the sbtool
        Port detection
        Install from a source directory
        Allow the test suite to load and execute a
         customized test
        Improved documentation




Sunday, 23 August 2009
Port detection
   $ make_sandbox 5.1.33 --check_port
   # port 5133 under msb_5_1_33

   $ make_sandbox 5.1.33 --check_port
   # port 5134 under msb_5_1_33_a

   $ make_sandbox 5.1.33 --check_port
   # port 5135 under msb_5_1_33_b
   # ... and so on


Sunday, 23 August 2009
Install from source directory
   # compile mysql

   $ ./configure && make

   # install a sandbox

   $ make_sandbox_from_source $PWD single




Sunday, 23 August 2009
sbtool - the sandbox helper
        Server clone
        Server move
        Change port
        Sandbox deletion
        List ports
        Find a port range
        Multi-level replication
        Convert a sandbox from temporary to permanent




Sunday, 23 August 2009
Cloning a sandbox
   # install two sandboxes
   $ make_sandbox 5.1.33
   $ make_sandbox 5.1.34

   # Load and process data into msb_5_1_33
   # ...
   # ...
   # Clone data into the second sandbox
   sbtool -o copy 
      -s $HOME/sandboxes/msb_5_1_33 
      -d $HOME/sandboxes/msb_5_1_34


Sunday, 23 August 2009
Moving a sandbox
   # install a sandbox
   $ make_sandbox 5.1.33

   # move it
   sbtool -o move 
      -s $HOME/sandboxes/msb_5_1_33 
      -d /some/path/a_fancy_name




Sunday, 23 August 2009
Powerful new testing (1)
   # write a test script 'check_single_server.sb'

   shell:
   command = make_sandbox 5.1.30 --no_confirm
   expected = sandbox server started
   msg      = sandbox creation

   sql:
   path    = $SANDBOX_HOME/msb_5_1_30
   query   = select version()
   expected = 5.1.30
   msg      = checking version

Sunday, 23 August 2009
Powerful new testing (2)
   # write a test script 'check_single_server.sb'
   # (continues)

   shell:
   command = $SANDBOX_HOME/msb_5_1_30/stop
   expected = OK
   msg      = stopped




Sunday, 23 August 2009
Powerful new testing (3)
   # Run the test


   $ test_sandbox --tests=user 
     --user_test=t/check_single_server.sb
   ** currently there are (0) mysqld processes
   and (0) mysqld_safe processes
   ok 1 - sandbox creation
   ok 2 - checking version
   ok 3 - stopped
   *** Executed 3 tests. Passed 3 (100.00%).
   Failed 0 ( 0.00%)


Sunday, 23 August 2009
Powerful new testing (4)
   # Run the test is simple TAP mode

   $ export TAP_MODE=1
   $ test_sandbox --tests=user 
     --user_test=t/check_single_server.sb
   ok 1 - sandbox creation
   ok 2 - checking version
   ok 3 - stopped

   # for more info on the TAP format:
   $ perldoc Test::Harness::TAP



Sunday, 23 August 2009
Powerful new testing (5)
   # Run the test inside a test suite

   prove -v t/06_test_user_defined.t
   t/06_test_user_defined....
   1..3
   ok 1 - sandbox creation
   ok 2 - checking version
   ok 3 - stopped
   ok
   All tests successful.
   Files=1, Tests=3, 8 wallclock secs ( 0.50
   cusr + 0.56 csys = 1.06 CPU)


Sunday, 23 August 2009
Create a replication tree
   # 1 create a multiple sandbox

   $ make_multiple_sandbox 
     --how_many_nodes=12 5.0.77

   # set the roles

   $      sbtool -o tree 
         --tree_dir=~/sandboxes/multi_msb_5_0_77 
          --master_node=1 
          --mid_nodes='2 3 4' 
          --leaf_nodes='5 6|7 8 9|10 11 12'

Sunday, 23 August 2009
Using a replication tree (1)
   $ cd ~/sandboxes/multi_msb_5_0_77

   $ ./n1 -e 'show slave hosts'
   +-----------+-------+-------+-------------------+-----------+
   | Server_id | Host | Port | Rpl_recovery_rank | Master_id |
   +-----------+-------+-------+-------------------+-----------+
   |       102 | node2 | 19778 |                 0 |       101 |
   |       104 | node4 | 19778 |                 0 |       101 |
   |       103 | node3 | 19778 |                 0 |       101 |
   +-----------+-------+-------+-------------------+-----------+




Sunday, 23 August 2009
Using a replication tree (2)
   $ ./n2 -e 'show slave hosts'

   +-----------+-------+-------+-------------------+-----------+
   | Server_id | Host | Port | Rpl_recovery_rank | Master_id |
   +-----------+-------+-------+-------------------+-----------+
   |       105 | node5 | 19779 |                 0 |       102 |
   |       106 | node6 | 19779 |                 0 |       102 |
   +-----------+-------+-------+-------------------+-----------+




Sunday, 23 August 2009
Using a replication tree (3)
  $ ./n1 -e 'create table test.t1 (i int)'
  $./n1 -e 'insert into test.t1
         values (@@server_id)'




Sunday, 23 August 2009
Using a replication tree (4)
   $ ./use_all "select * from test.t1"
   # server:             1:
   i
   101
   # server:             2:
   i
   102
   # server:             3:
   i
   103
   # server:             4:
   i
   104
   # server:             5:
   i
   105


Sunday, 23 August 2009
checking ports
   $ sbtool -o ports
    5078 0
    5130 0
    5131 0
    5132 0
    5133 1
    5135 0
    5333 0
    5400 0

   $ sbtool -o ports --only_used
    5133 1

Sunday, 23 August 2009
checking ranges
   $ sbtool -o range --min_range=5130
    5136 - 5146




Sunday, 23 August 2009
Preserving a sandbox
   $ sbtool -o preserve 
      -s $HOME/sandboxes/msb_5_1_33/
   sandbox at <$HOME/sandboxes/msb_5_1_33/> is
   now permanent

   $ $HOME/sandboxes/msb_5_1_33/clear
   This sandbox is permanent.
   The 'clear' command has been disabled.
   The contents of the old 'clear' command are in
   the 'no_clear' file




Sunday, 23 August 2009
un-preserving a sandbox
   $ sbtool -o unpreserve 
      -s $HOME/sandboxes/msb_5_1_33/
   sandbox at <$HOME/sandboxes/msb_5_1_33/> is
   now NOT PERMANENT

   $ $HOME/sandboxes/msb_5_1_33/clear

   # no error




Sunday, 23 August 2009
deleting a sandbox
   $ sbtool -o delete 
      -s $HOME/sandboxes/msb_5_1_35
   sandbox at <$HOME/sandboxes/msb_5_1_35> has
   been removed




Sunday, 23 August 2009
Roadmap

        Install on remote servers (Prototype ready)
        create a failover script in replication to promote a
         slave to master (in design)
        GUI
        flexible topology read-and-install




Sunday, 23 August 2009
Shortcuts
               new command: sb
               sb #.#.## installs a sandbox (unless exists) and
               calls it
               sb r#.#.## installs a replication sandbox (unless
               exists) and calls the master




Sunday, 23 August 2009
Remote sandboxes
               Using GEARMAN
                    client server architecture
                    N servers
                    N workers
                    N clients
                    Supports multiple languages




Sunday, 23 August 2009
host1                           worker1                    host2
                                                  worker2
                                        func1
     worker0                                        func1
                                         func2         func3
        func1
         func3
                                                          worker3
                                                           func1
                          Gearman
                           server                            func3




        worker4
             func1
               func3                 Gearman
                                      server     client
                         worker5
                           func1
    host3                   func3                              host4
Sunday, 23 August 2009
host1                                          worker1                 host2
                                                            worker2
                                                 func1
    worker0                                                   func1
                                                  func2          func3
       func1
        func3
                                                                    worker3
                                                                     func1
                           Gearman              Gearman
 Master                     server               server    Slave1      func3




       worker4
           func1
                             Gearman
             func3
                              server
                                                           client
                                     worker5
                                       func1
  host3                  Slave2         func3                            host4

Sunday, 23 August 2009
Participate!




Sunday, 23 August 2009
Participate!




Sunday, 23 August 2009
Participate!




Sunday, 23 August 2009
Participate!




Sunday, 23 August 2009
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.
Sunday, 23 August 2009
BONUS SLIDES




               lightning talk about MySQL
                         Sandbox



Sunday, 23 August 2009
MySQL::Sandbox
                         Perl magic for
                           DBAs and
                          developers

                           Giuseppe Maxia
Sunday, 23 August 2009
I used to install a lot
                     of MySQL databases
                          for testing

                  MANUALLY
Sunday, 23 August 2009
Then, I decided to
                    use Perl ...


Sunday, 23 August 2009
DBA pop
                           quiz
Sunday, 23 August 2009
HOW MANY
                           KEYSTROKES
                         to install a MySQL
                               server?
                      10
              sb 5.0.83
              123456789 + return
Sunday, 23 August 2009
HOW MANY
                    KEYSTROKES
                  to install 3 MySQL
                servers in replication?
                11
       sb r5.0.83
       1234567890 + return
Sunday, 23 August 2009
HOW LONG
                             does it take
                         to install a MySQL
                               server?
                           < 2 seconds
                         time sb 5.0.83
                            0m1.518s
Sunday, 23 August 2009
HOW LONG
                      does it take
                  to install 3 MySQL
                servers in replication?
                         < 5 seconds
                         sb 5.0.83
                          0m4.515s
Sunday, 23 August 2009
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
                   •Installs (experimental with Gearman) to
                         remote servers
Sunday, 23 August 2009

Contenu connexe

Tendances

Install Cuckoo on Mac OS X
Install Cuckoo on Mac OS XInstall Cuckoo on Mac OS X
Install Cuckoo on Mac OS XMohd Khairulazam
 
RabbitMQ Server - cheat sheet -
RabbitMQ Server - cheat sheet -RabbitMQ Server - cheat sheet -
RabbitMQ Server - cheat sheet -Naoto MATSUMOTO
 
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean Winn
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean WinnCouch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean Winn
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean WinnTrevor Roberts Jr.
 
How to install OpenStack MITAKA --allinone - cheat sheet -
How to install OpenStack MITAKA --allinone - cheat sheet -How to install OpenStack MITAKA --allinone - cheat sheet -
How to install OpenStack MITAKA --allinone - cheat sheet -Naoto MATSUMOTO
 
OpenNebulaConf2015 2.03 Docker-Machine and OpenNebula - Jaime Melis
OpenNebulaConf2015 2.03 Docker-Machine and OpenNebula - Jaime MelisOpenNebulaConf2015 2.03 Docker-Machine and OpenNebula - Jaime Melis
OpenNebulaConf2015 2.03 Docker-Machine and OpenNebula - Jaime MelisOpenNebula Project
 
JavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureJavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureShiju Varghese
 
Scaling IO-bound microservices
Scaling IO-bound microservicesScaling IO-bound microservices
Scaling IO-bound microservicesSalo Shp
 
Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77chhorn
 
Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101jelrikvh
 
Building packages through emulation by Sean Bruno
Building packages through emulation by Sean BrunoBuilding packages through emulation by Sean Bruno
Building packages through emulation by Sean Brunoeurobsdcon
 
Setting up Puppet at Colruyt
Setting up Puppet at ColruytSetting up Puppet at Colruyt
Setting up Puppet at ColruytPuppet
 
Mininet multiple controller
Mininet   multiple controllerMininet   multiple controller
Mininet multiple controllerCatur Mei Rahayu
 
Booting directly opensuse iso file by grub2 @ openSUSE Asia Summit2015
Booting directly opensuse iso file by grub2 @ openSUSE Asia Summit2015Booting directly opensuse iso file by grub2 @ openSUSE Asia Summit2015
Booting directly opensuse iso file by grub2 @ openSUSE Asia Summit2015Kentaro Hatori
 
Linux Kernel Init Process
Linux Kernel Init ProcessLinux Kernel Init Process
Linux Kernel Init ProcessKernel TLV
 

Tendances (20)

Install Cuckoo on Mac OS X
Install Cuckoo on Mac OS XInstall Cuckoo on Mac OS X
Install Cuckoo on Mac OS X
 
Couch to open_stack_keystone
Couch to open_stack_keystoneCouch to open_stack_keystone
Couch to open_stack_keystone
 
Docker Insight
Docker InsightDocker Insight
Docker Insight
 
RabbitMQ Server - cheat sheet -
RabbitMQ Server - cheat sheet -RabbitMQ Server - cheat sheet -
RabbitMQ Server - cheat sheet -
 
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean Winn
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean WinnCouch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean Winn
Couch to OpenStack: Neutron (Quantum) - August 13, 2013 Featuring Sean Winn
 
How to install OpenStack MITAKA --allinone - cheat sheet -
How to install OpenStack MITAKA --allinone - cheat sheet -How to install OpenStack MITAKA --allinone - cheat sheet -
How to install OpenStack MITAKA --allinone - cheat sheet -
 
OpenNebulaConf2015 2.03 Docker-Machine and OpenNebula - Jaime Melis
OpenNebulaConf2015 2.03 Docker-Machine and OpenNebula - Jaime MelisOpenNebulaConf2015 2.03 Docker-Machine and OpenNebula - Jaime Melis
OpenNebulaConf2015 2.03 Docker-Machine and OpenNebula - Jaime Melis
 
JavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows AzureJavaScript, Meet Cloud : Node.js on Windows Azure
JavaScript, Meet Cloud : Node.js on Windows Azure
 
Scaling IO-bound microservices
Scaling IO-bound microservicesScaling IO-bound microservices
Scaling IO-bound microservices
 
Dbdeployer
DbdeployerDbdeployer
Dbdeployer
 
Cluster filesystems
Cluster filesystemsCluster filesystems
Cluster filesystems
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
 
Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77
 
Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101
 
Building packages through emulation by Sean Bruno
Building packages through emulation by Sean BrunoBuilding packages through emulation by Sean Bruno
Building packages through emulation by Sean Bruno
 
Performance Strategies
Performance StrategiesPerformance Strategies
Performance Strategies
 
Setting up Puppet at Colruyt
Setting up Puppet at ColruytSetting up Puppet at Colruyt
Setting up Puppet at Colruyt
 
Mininet multiple controller
Mininet   multiple controllerMininet   multiple controller
Mininet multiple controller
 
Booting directly opensuse iso file by grub2 @ openSUSE Asia Summit2015
Booting directly opensuse iso file by grub2 @ openSUSE Asia Summit2015Booting directly opensuse iso file by grub2 @ openSUSE Asia Summit2015
Booting directly opensuse iso file by grub2 @ openSUSE Asia Summit2015
 
Linux Kernel Init Process
Linux Kernel Init ProcessLinux Kernel Init Process
Linux Kernel Init Process
 

Similaire à MySQL Sandbox 3

Plugin Memcached%20 Study
Plugin Memcached%20 StudyPlugin Memcached%20 Study
Plugin Memcached%20 StudyLiu Lizhi
 
Palestra no Grupo Sou Java
Palestra no Grupo Sou JavaPalestra no Grupo Sou Java
Palestra no Grupo Sou JavaFabio Akita
 
Continuous Delivery at Netflix
Continuous Delivery at NetflixContinuous Delivery at Netflix
Continuous Delivery at NetflixRob Spieldenner
 
Managing Windows Systems with Puppet - PuppetConf 2013
Managing Windows Systems with Puppet - PuppetConf 2013Managing Windows Systems with Puppet - PuppetConf 2013
Managing Windows Systems with Puppet - PuppetConf 2013Puppet
 
Deploying Heterogeneous Artifacts to the Cloud with OSGi - Neil Bartlett
Deploying Heterogeneous Artifacts to the Cloud with OSGi - Neil BartlettDeploying Heterogeneous Artifacts to the Cloud with OSGi - Neil Bartlett
Deploying Heterogeneous Artifacts to the Cloud with OSGi - Neil Bartlettmfrancis
 
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
 
Dbdeployer, the universal installer
Dbdeployer, the universal installerDbdeployer, the universal installer
Dbdeployer, the universal installerGiuseppe Maxia
 
Software livre e padrões abertos no desenvolvimento Web
Software livre e padrões abertos no desenvolvimento WebSoftware livre e padrões abertos no desenvolvimento Web
Software livre e padrões abertos no desenvolvimento WebFelipe Ribeiro
 
When Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of TorqueboxWhen Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of Torqueboxrockyjaiswal
 
Hacking Lab con ProxMox e Metasploitable
Hacking Lab con ProxMox e MetasploitableHacking Lab con ProxMox e Metasploitable
Hacking Lab con ProxMox e MetasploitableAndrea Draghetti
 
Testing Drupal with Ghosts and Gherkin
Testing Drupal  with Ghosts and GherkinTesting Drupal  with Ghosts and Gherkin
Testing Drupal with Ghosts and GherkinPhase2
 
Building and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and MarathonBuilding and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and MarathonJulia Mateo
 
Testing mysql creatively in a sandbox
Testing mysql creatively in a sandboxTesting mysql creatively in a sandbox
Testing mysql creatively in a sandboxGiuseppe Maxia
 
Workers of the web - BrazilJS 2013
Workers of the web - BrazilJS 2013Workers of the web - BrazilJS 2013
Workers of the web - BrazilJS 2013Thibault Imbert
 
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with UciprovLukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with UciprovZabbix
 

Similaire à MySQL Sandbox 3 (20)

MySQL Sandbox 3
MySQL Sandbox 3MySQL Sandbox 3
MySQL Sandbox 3
 
Memcached
MemcachedMemcached
Memcached
 
Plugin Memcached%20 Study
Plugin Memcached%20 StudyPlugin Memcached%20 Study
Plugin Memcached%20 Study
 
Palestra no Grupo Sou Java
Palestra no Grupo Sou JavaPalestra no Grupo Sou Java
Palestra no Grupo Sou Java
 
Continuous Delivery at Netflix
Continuous Delivery at NetflixContinuous Delivery at Netflix
Continuous Delivery at Netflix
 
Managing Windows Systems with Puppet - PuppetConf 2013
Managing Windows Systems with Puppet - PuppetConf 2013Managing Windows Systems with Puppet - PuppetConf 2013
Managing Windows Systems with Puppet - PuppetConf 2013
 
Vim Notes
Vim NotesVim Notes
Vim Notes
 
Deploying Heterogeneous Artifacts to the Cloud with OSGi - Neil Bartlett
Deploying Heterogeneous Artifacts to the Cloud with OSGi - Neil BartlettDeploying Heterogeneous Artifacts to the Cloud with OSGi - Neil Bartlett
Deploying Heterogeneous Artifacts to the Cloud with OSGi - Neil Bartlett
 
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
 
Software livre e padrões abertos no desenvolvimento Web
Software livre e padrões abertos no desenvolvimento WebSoftware livre e padrões abertos no desenvolvimento Web
Software livre e padrões abertos no desenvolvimento Web
 
When Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of TorqueboxWhen Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of Torquebox
 
Hacking Lab con ProxMox e Metasploitable
Hacking Lab con ProxMox e MetasploitableHacking Lab con ProxMox e Metasploitable
Hacking Lab con ProxMox e Metasploitable
 
Introduction to Vagrant
Introduction to VagrantIntroduction to Vagrant
Introduction to Vagrant
 
Testing Drupal with Ghosts and Gherkin
Testing Drupal  with Ghosts and GherkinTesting Drupal  with Ghosts and Gherkin
Testing Drupal with Ghosts and Gherkin
 
Script it
Script itScript it
Script it
 
Building and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and MarathonBuilding and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and Marathon
 
Testing mysql creatively in a sandbox
Testing mysql creatively in a sandboxTesting mysql creatively in a sandbox
Testing mysql creatively in a sandbox
 
Workers of the web - BrazilJS 2013
Workers of the web - BrazilJS 2013Workers of the web - BrazilJS 2013
Workers of the web - BrazilJS 2013
 
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with UciprovLukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
 

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
 
A quick tour of Mysql 8 roles
A quick tour of Mysql 8 rolesA quick tour of Mysql 8 roles
A quick tour of Mysql 8 rolesGiuseppe Maxia
 
Synchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDBSynchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDBGiuseppe Maxia
 
Juggle your data with Tungsten Replicator
Juggle your data with Tungsten ReplicatorJuggle your data with Tungsten Replicator
Juggle your data with Tungsten ReplicatorGiuseppe Maxia
 
Tungsten Replicator tutorial
Tungsten Replicator tutorialTungsten Replicator tutorial
Tungsten Replicator tutorialGiuseppe Maxia
 
Preventing multi master conflicts with tungsten
Preventing multi master conflicts with tungstenPreventing multi master conflicts with tungsten
Preventing multi master conflicts with tungstenGiuseppe Maxia
 
MySQL high availability power and usability
MySQL high availability power and usabilityMySQL high availability power and usability
MySQL high availability power and usabilityGiuseppe Maxia
 
Solving MySQL replication problems with Tungsten
Solving MySQL replication problems with TungstenSolving MySQL replication problems with Tungsten
Solving MySQL replication problems with TungstenGiuseppe Maxia
 
State of the art of MySQL replication and clustering
State of the art of MySQL replication and clusteringState of the art of MySQL replication and clustering
State of the art of MySQL replication and clusteringGiuseppe Maxia
 
Testing mysql creatively in a sandbox
Testing mysql creatively in a sandboxTesting mysql creatively in a sandbox
Testing mysql creatively in a sandboxGiuseppe Maxia
 
Mysql 5.5 and 5.6 replication
Mysql 5.5 and 5.6 replicationMysql 5.5 and 5.6 replication
Mysql 5.5 and 5.6 replicationGiuseppe Maxia
 
Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012Giuseppe Maxia
 
Testing early mysql releases in a sandbox
Testing early mysql releases in a sandboxTesting early mysql releases in a sandbox
Testing early mysql releases in a sandboxGiuseppe 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
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
 
Tungsten Replicator tutorial
Tungsten Replicator tutorialTungsten Replicator tutorial
Tungsten Replicator tutorial
 
Preventing multi master conflicts with tungsten
Preventing multi master conflicts with tungstenPreventing multi master conflicts with tungsten
Preventing multi master conflicts with tungsten
 
MySQL high availability power and usability
MySQL high availability power and usabilityMySQL high availability power and usability
MySQL high availability power and usability
 
Solving MySQL replication problems with Tungsten
Solving MySQL replication problems with TungstenSolving MySQL replication problems with Tungsten
Solving MySQL replication problems with Tungsten
 
State of the art of MySQL replication and clustering
State of the art of MySQL replication and clusteringState of the art of MySQL replication and clustering
State of the art of MySQL replication and clustering
 
Testing mysql creatively in a sandbox
Testing mysql creatively in a sandboxTesting mysql creatively in a sandbox
Testing mysql creatively in a sandbox
 
Mysql 5.5 and 5.6 replication
Mysql 5.5 and 5.6 replicationMysql 5.5 and 5.6 replication
Mysql 5.5 and 5.6 replication
 
Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012
 
Replication 101
Replication 101Replication 101
Replication 101
 
Testing early mysql releases in a sandbox
Testing early mysql releases in a sandboxTesting early mysql releases in a sandbox
Testing early mysql releases in a sandbox
 
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

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Dernier (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

MySQL Sandbox 3

  • 1. MySQL Sandbox 3.0 Installing and testing MySQL servers effortlessly http://launchpad.net/mysql-sandbox Giuseppe Maxia MySQL Community This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. Sunday, 23 August 2009
  • 2. Overview  Not an official Sun/MySQL product  GPL  installs from a tarball in a few seconds  to install side servers, not the main instance  creates a separated environment  data directory  port  socket groups of related or unrelated servers  http://launchpad.net/mysql-sandbox/ Sunday, 23 August 2009
  • 3. System requirements  Unix like operating system Linux Mac OS X Solaris Free BSD  MySQL binary tarball  MySQL Sandbox (current version 3.0.04)  Perl  Bash shell Sunday, 23 August 2009
  • 4. explaining the sandbox is like boxing explaining takes longer than delivering Sunday, 23 August 2009
  • 5. Overview data directory data directory port port socket socket Sunday, 23 August 2009
  • 6. Overview same data directory? /usr/local/mysql/data /usr/local/mysql/data data corruption Sunday, 23 August 2009
  • 7. Overview same data port or socket? 3306 3306 /tmp/mysql.sock /tmp/mysql.sock does not start Sunday, 23 August 2009
  • 8. the hard way 1.unpack the tarball 2.ensure that it goes to a separate directory 3.create the database tables 4.create a .cnf file with separate • port • data directory error prone • socket 5.launch mysqld_safe manually 6.launch mysql with options Sunday, 23 August 2009
  • 9. Why tar.gz? Why not .rpm/.deb/.pgk? • it would work • but only in their specific environments The sandbox aims at being standard across operating systems. It works the same way on Linux, Mac OSX, OpenSolaris, FreeBSD, and probably many more Sunday, 23 August 2009
  • 10. MySQL Sandbox VERSION $SANDBOX_HOME/msb_VERSION/data VERSION /tmp/mysql_VERSION.sock Sunday, 23 August 2009
  • 11. MySQL Sandbox 5.1.37 $SANDBOX_HOME/msb_5_1_37/data 5137 /tmp/mysql_5137.sock Sunday, 23 August 2009
  • 12. MySQL Sandbox 5.4.1 $SANDBOX_HOME/msb_5_4_1/data 5401 /tmp/mysql_5401.sock Sunday, 23 August 2009
  • 13. MySQL Sandbox single sandbox commands start use stop restart clear send_kill Sunday, 23 August 2009
  • 14. MySQL Sandbox multiple sandbox commands One sandbox to rule them all start_all m n1 stop_all s1 n2 clear_all s2 n3 send_kill_all use_all Sunday, 23 August 2009
  • 15. The easy way - installation # as root $ cpan cpan> install MySQL::Sandbox Sunday, 23 August 2009
  • 16. Installing the sandbox as unprivileged user # download the sandbox # http://launchpad.net/mysql-sandbox/ $ tar -xzf MySQL-Sandbox-x.x.x.tar.gz $ cd MySQL-Sandbox-x.x.x/ $ perl Makefile.PL PREFIX=$HOME/usr/local $ make $ make test $ make install # change $PERL5LIB and $PATH Sunday, 23 August 2009
  • 17. The easy way - single sandbox $ make_sandbox /path/mysql-OS-5.1.37.tar.gz # that's it! Sunday, 23 August 2009
  • 18. The easy way - replication $ make_replication_sandbox /path/mysql-OS-5.1.37.tar.gz # that's it! Sunday, 23 August 2009
  • 19. The easy way - circular replication $ make_replication_sandbox --circular=5 /path/mysql-OS-5.1.37.tar.gz # that's it! Sunday, 23 August 2009
  • 20. The easy way - multiple servers $ make_multiple_sandbox /path/mysql-OS-5.1.37.tar.gz # that's it! Sunday, 23 August 2009
  • 21. The even easier way - $SANDBOX_BINARY # default SANDBOX_BINARY=$HOME/opt/mysql $ export SANDBOX_BINARY=$HOME/mybin $ ls $SANDBOX_BINARY 5.0.64 5.0.66 5.0.67 5.1.20 5.1.23 5.1.24 5.1.25 5.1.26 5.1.28 5.1.29 5.1.37 5.1.38 $ make_sandbox 5.1.37 # that's it! Sunday, 23 August 2009
  • 22. multiple servers - different versions $ make_multiple_custom_sandbox 5.0.67 5.1.37 5.4.1 # that's it! Sunday, 23 August 2009
  • 23. fine tuning $ make_sandbox /path/mysql-OS-5.1.37.tar.gz [option] [option] [option] Sunday, 23 August 2009
  • 24. pick your size $ make_sandbox /path/mysql-OS-5.1.37.tar.gz --my_file={small|medium|large|huge} Sunday, 23 August 2009
  • 25. fine tuning easily $ make_sandbox /path/mysql-OS-5.1.37.tar.gz --interactive Sunday, 23 August 2009
  • 26. fine tuning easily Enter the values for each option * To leave the interactive choice and accept default values for the remaining options, enter 'default' * To go to the previous item, enter 'back' * To quit the installation without any action, enter 'quit' ------------------------------------------ home_directory The home directory. (default: $HOME/sandboxes (/Users/gmax/sandboxes)) Your choice: (current value [/Users/gmax/sandboxes]) _ Sunday, 23 August 2009
  • 27. hands on Sunday, 23 August 2009
  • 28. Using the sandbox ./start [mysqld options] starts the server creates a .pid file in the data directory creates a socket file in /tmp if a .pid file exists, it exits immediately Sunday, 23 August 2009
  • 29. Using the sandbox ./restart [mysqld options] starts the server creates a .pid file in the data directory creates a socket file in /tmp if a .pid file exists, it exits immediately Sunday, 23 August 2009
  • 30. Using the sandbox ./stop stops the server if no .pid file exists, it exits immediately Sunday, 23 August 2009
  • 31. Using the sandbox ./send_kill stops the server, using kill -TERM pid# if the server is unresponsive, uses kill -KILL pid# Sunday, 23 August 2009
  • 32. Using the sandbox ./clear stops the server (by calling the stop script) removes all files in the data directory empties the test database Sunday, 23 August 2009
  • 33. Using the sandbox ./use starts the mysql client uses the credentials in the my_sandbox.cnf default username and password:  msandbox/msandbox root password:  msandbox Sunday, 23 August 2009
  • 34. Using the sandbox ./my {sqldump|sqlbinlog|sqladmin} starts a mysql command line tool uses the credentials in the my_sandbox.cnf  it's a shortcut to call the tool from the right version with the proper options Sunday, 23 August 2009
  • 35. using mysql clients $ ./my sqlbinlog ./data/mysql-bin.000001 |less $ ./my sqldump dbname > dumpname $ ./my sqladmin extended-status # no username or password needed! Sunday, 23 August 2009
  • 36. Using the replication sandbox ./start_all  starts the master and all the slaves ./stop_all  stops all the slaves and then the master ./send_kill_all  kills all the slaves and then the master ./clear_all  clears all the slaves and then the master ./use_all "command"  executes "command" for all nodes Sunday, 23 August 2009
  • 37. Using the replication sandbox ./m  uses the master ./s1  uses the first slave ./s2 [s3, s4 ... ]  uses the Nth slave Sunday, 23 August 2009
  • 38. Using the multi-nodes sandbox ./start_all  starts all the nodes ./stop_all  stops all the nodes ./send_kill_all  kills all the nodes ./clear_all  clears all the nodes ./use_all "command"  executes "command" for all nodes Sunday, 23 August 2009
  • 39. Using the multi-node sandbox ./n1  uses the first node ./n2 [n3, n4 ... ]  uses the Nth node Sunday, 23 August 2009
  • 40. Using the $SANDBOX_HOME directory the master sandbox that rules them all ./start_all  starts all the sandboxes ./stop_all  stops all the sandboxes ./clear_all  clear all the sandboxes ./use_all "SQL statement"  passes a SQL statement to all servers in all sandboxes Sunday, 23 August 2009
  • 41. a crowded host sandbox 5.0.67 replication replication replication 7 servers 5.1.26 5.1.26 5.0.67 independent independent independent 5.1.26 5.1.26 5.0.67 Sunday, 23 August 2009
  • 42. a differently crowded host sandbox 5.0.67 7 servers replication replication replication 5.1.26 5.1.26 5.0.67 independent 5.0.67 independent independent 5.4.1 5.1.26 Sunday, 23 August 2009
  • 43. a more crowded host sandbox sandbox 5.1.37 5.4.1 replication replication replication replication replication 5.1.26 5.1.26 14 replication 5.1.26 5.1.26 5.1.37 5.4.1 servers independent independent independent independent independent independent 5.1.26 5.1.26 5.1.26 5.1.26 5.1.37 5.4.1 Sunday, 23 August 2009
  • 44. an even more crowded host sandbox sandbox sandbox 5.0.67 5.1.37 5.4.1 replication replication replication replication replication replication replication replication 5.1.26 replication 5.1.37 5.1.26 5.1.26 5.1.26 5.0.67 5.1.37 5.4.1 5.1.37 independent independent independent independent independent independent independent independent 5.1.26 5.1.26 independent 5.1.26 5.1.26 5.1.26 5.0.67 5.1.26 5.4.1 5.1.37 21 Sunday, 23 August 2009
  • 45. DEMO TIME Sunday, 23 August 2009
  • 46. Installing a single one $ make_sandbox 5.1.37 Executing ./low_level_make_sandbox --basedir=/Users/gmax/opt/mysql/5.1.37 --sandbox_directory=msb_5_1_37 --install_version=5.1 --sandbox_port=5129 --no_ver_after_name --my_clause=log-error=msandbox.err The MySQL Sandbox, version 2.0.12 16-Oct-2008 (C) 2006,2007,2008 Giuseppe Maxia, Sun Microsystems, Database Group installing with the following parameters: upper_directory = /Users/gmax/sandboxes sandbox_directory = msb_5_1_37 sandbox_port = 5129 datadir_from = script install_version = 5.1 basedir = /Users/gmax/opt/mysql/5.1.37 operating_system_user = gmax db_user = msandbox db_password = msandbox my_clause = log-error=msandbox.err prompt_prefix = mysql prompt_body = [h] {u} (d) > ' do you agree? ([Y],n) loading grants .. sandbox server started ---------------------------------------- Your sandbox server was installed in /Users/gmax/sandboxes/msb_5_1_37 Sunday, 23 August 2009
  • 47. Using a single one $ cd $HOME/sandboxes/msb_5_1_37 $ ./use Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 3 Server version: 5.1.37-rc MySQL Community Server (GPL) Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql [localhost] {msandbox} ((none)) > Sunday, 23 August 2009
  • 48. Installing a replication sandbox $ make_replication_sandbox 5.1.37 installing and starting master installing slave 1 installing slave 2 starting slave 1 .. sandbox server started starting slave 2 .. sandbox server started initializing slave 1 initializing slave 2 replication directory installed on /Users/gmax/sandboxes/rsandbox_5_1_37 Sunday, 23 August 2009
  • 49. using a replication sandbox $ cd $HOME/sandboxes/rsandbox_5_1_37 # m = master $ ./m test Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 4 Server version: 5.1.37-rc-log MySQL Community Server (GPL) Type 'help;' or 'h' for help. Type 'c' to clear the buffer. master [localhost] {msandbox} (test) > create table t1 (i int); Query OK, 0 rows affected (0.08 sec) Sunday, 23 August 2009
  • 50. using a replication sandbox # s1 is slave1 $ ./s1 test slave1 [localhost] {msandbox} (test) > show tables; +----------------+ | Tables_in_test | +----------------+ | t1 | +----------------+ Sunday, 23 August 2009
  • 51. using a replication sandbox # checking the slaves $ ./check_slaves slave # 1 Slave_IO_Running: Yes Slave_SQL_Running: Yes slave # 2 Slave_IO_Running: Yes Slave_SQL_Running: Yes Sunday, 23 August 2009
  • 52. using a replication sandbox # sending commands to all nodes $ ./use all "SELECT @@server_id" # master @@server_id 1 # server: 1: @@server_id 101 # server: 2: @@server_id 102 Sunday, 23 August 2009
  • 53. Example: breaking replication # leveraging command line scripts $ ./m -e 'create table test.t2 (i int primary key)' $ ./s1 -e 'insert into test.t2 values (1)' $ ./m -e 'insert into test.t2 values (1)' $ ./check_slaves slave # 1 Slave_IO_Running: Yes Slave_SQL_Running: No slave # 2 Slave_IO_Running: Yes Slave_SQL_Running: Yes $ ./s1 -e 'show slave statusG' |grep Last_Error Last_Error: Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: ''. Query: ' Sunday, 23 August 2009
  • 54. Installing circular replication $ make_replication_sandbox --circular=4 5.1.34 installing node 1 installing node 2 installing node 3 installing node 4 # server: 1: # server: 2: # server: 3: # server: 4: Circular replication activated group directory installed on /Users/gmax/sandboxes/rcsandbox_5_1_34 Sunday, 23 August 2009
  • 55. using circular replication $ cd $HOME/sandboxes/rcsandbox_5_1_34 $ ./n1 -e 'create table test.t1 (i int)' $ ./n3 -e 'insert into test.t1 values (3)' $ ./use_all 'select * from test.t1' # server: 1: i 3 # server: 2: i 3 # server: 3: i 3 # server: 4: i 3 Sunday, 23 August 2009
  • 56. Easy testing conditions (1) $ cd $HOME/sandboxes/msb_5_1_35 $ ./use -e 'show variables like "key_buffer_size"' +-----------------+---------+ | Variable_name | Value | +-----------------+---------+ | key_buffer_size | 8384512 | +-----------------+---------+ # we need to increase this one Sunday, 23 August 2009
  • 57. Easy testing conditions (2) $ ./restart --key_buffer=20M $ ./use -e 'show variables like "key_buffer_size"' +-----------------+-----------+ | Variable_name | Value | +-----------------+-----------+ | key_buffer_size | 209715200 | +-----------------+-----------+ # as easy as saying it! Sunday, 23 August 2009
  • 58. Testing same version in different conditions $ make_multiple_sandbox 5.1.34 --group_directory=unpartitioned --base_port=5500 --check_base_port $ make_multiple_sandbox 5.1.34 --group_directory=partitioned --how_many_nodes=4 --base_port=6500 --check_base_port Sunday, 23 August 2009
  • 59. Testing same version in different conditions $SANDBOX_HOME/unpartitioned | +-- node1 MyISAM | +-- node2 InnoDB | +-- node3 Archive Sunday, 23 August 2009
  • 60. Testing same version in different conditions $SANDBOX_HOME/partitioned | +-- node1 MyISAM by month | +-- node2 InnoDB by month | +-- node3 InnoDB file per table by month | +-- node4 Archive by month Sunday, 23 August 2009
  • 61. Running tests cd $SANDBOX_HOME/unpartitioned ./stop_all RESULTS=unpartitioned_results.txt date > $RESULTS for SB in 1 2 3 do ./node$SB/start time ./n$SB < test.sql >> $RESULTS ./node$DB/stop done # more on tests later on. Stay tuned Sunday, 23 August 2009
  • 62. Latest news Sunday, 23 August 2009
  • 63. MySQL Sandbox 3.0  Released as Perl package - now on CPAN  Added the sbtool  Port detection  Install from a source directory  Allow the test suite to load and execute a customized test  Improved documentation Sunday, 23 August 2009
  • 64. Port detection $ make_sandbox 5.1.33 --check_port # port 5133 under msb_5_1_33 $ make_sandbox 5.1.33 --check_port # port 5134 under msb_5_1_33_a $ make_sandbox 5.1.33 --check_port # port 5135 under msb_5_1_33_b # ... and so on Sunday, 23 August 2009
  • 65. Install from source directory # compile mysql $ ./configure && make # install a sandbox $ make_sandbox_from_source $PWD single Sunday, 23 August 2009
  • 66. sbtool - the sandbox helper  Server clone  Server move  Change port  Sandbox deletion  List ports  Find a port range  Multi-level replication  Convert a sandbox from temporary to permanent Sunday, 23 August 2009
  • 67. Cloning a sandbox # install two sandboxes $ make_sandbox 5.1.33 $ make_sandbox 5.1.34 # Load and process data into msb_5_1_33 # ... # ... # Clone data into the second sandbox sbtool -o copy -s $HOME/sandboxes/msb_5_1_33 -d $HOME/sandboxes/msb_5_1_34 Sunday, 23 August 2009
  • 68. Moving a sandbox # install a sandbox $ make_sandbox 5.1.33 # move it sbtool -o move -s $HOME/sandboxes/msb_5_1_33 -d /some/path/a_fancy_name Sunday, 23 August 2009
  • 69. Powerful new testing (1) # write a test script 'check_single_server.sb' shell: command = make_sandbox 5.1.30 --no_confirm expected = sandbox server started msg = sandbox creation sql: path = $SANDBOX_HOME/msb_5_1_30 query = select version() expected = 5.1.30 msg = checking version Sunday, 23 August 2009
  • 70. Powerful new testing (2) # write a test script 'check_single_server.sb' # (continues) shell: command = $SANDBOX_HOME/msb_5_1_30/stop expected = OK msg = stopped Sunday, 23 August 2009
  • 71. Powerful new testing (3) # Run the test $ test_sandbox --tests=user --user_test=t/check_single_server.sb ** currently there are (0) mysqld processes and (0) mysqld_safe processes ok 1 - sandbox creation ok 2 - checking version ok 3 - stopped *** Executed 3 tests. Passed 3 (100.00%). Failed 0 ( 0.00%) Sunday, 23 August 2009
  • 72. Powerful new testing (4) # Run the test is simple TAP mode $ export TAP_MODE=1 $ test_sandbox --tests=user --user_test=t/check_single_server.sb ok 1 - sandbox creation ok 2 - checking version ok 3 - stopped # for more info on the TAP format: $ perldoc Test::Harness::TAP Sunday, 23 August 2009
  • 73. Powerful new testing (5) # Run the test inside a test suite prove -v t/06_test_user_defined.t t/06_test_user_defined.... 1..3 ok 1 - sandbox creation ok 2 - checking version ok 3 - stopped ok All tests successful. Files=1, Tests=3, 8 wallclock secs ( 0.50 cusr + 0.56 csys = 1.06 CPU) Sunday, 23 August 2009
  • 74. Create a replication tree # 1 create a multiple sandbox $ make_multiple_sandbox --how_many_nodes=12 5.0.77 # set the roles $ sbtool -o tree --tree_dir=~/sandboxes/multi_msb_5_0_77 --master_node=1 --mid_nodes='2 3 4' --leaf_nodes='5 6|7 8 9|10 11 12' Sunday, 23 August 2009
  • 75. Using a replication tree (1) $ cd ~/sandboxes/multi_msb_5_0_77 $ ./n1 -e 'show slave hosts' +-----------+-------+-------+-------------------+-----------+ | Server_id | Host | Port | Rpl_recovery_rank | Master_id | +-----------+-------+-------+-------------------+-----------+ | 102 | node2 | 19778 | 0 | 101 | | 104 | node4 | 19778 | 0 | 101 | | 103 | node3 | 19778 | 0 | 101 | +-----------+-------+-------+-------------------+-----------+ Sunday, 23 August 2009
  • 76. Using a replication tree (2) $ ./n2 -e 'show slave hosts' +-----------+-------+-------+-------------------+-----------+ | Server_id | Host | Port | Rpl_recovery_rank | Master_id | +-----------+-------+-------+-------------------+-----------+ | 105 | node5 | 19779 | 0 | 102 | | 106 | node6 | 19779 | 0 | 102 | +-----------+-------+-------+-------------------+-----------+ Sunday, 23 August 2009
  • 77. Using a replication tree (3) $ ./n1 -e 'create table test.t1 (i int)' $./n1 -e 'insert into test.t1 values (@@server_id)' Sunday, 23 August 2009
  • 78. Using a replication tree (4) $ ./use_all "select * from test.t1" # server: 1: i 101 # server: 2: i 102 # server: 3: i 103 # server: 4: i 104 # server: 5: i 105 Sunday, 23 August 2009
  • 79. checking ports $ sbtool -o ports 5078 0 5130 0 5131 0 5132 0 5133 1 5135 0 5333 0 5400 0 $ sbtool -o ports --only_used 5133 1 Sunday, 23 August 2009
  • 80. checking ranges $ sbtool -o range --min_range=5130 5136 - 5146 Sunday, 23 August 2009
  • 81. Preserving a sandbox $ sbtool -o preserve -s $HOME/sandboxes/msb_5_1_33/ sandbox at <$HOME/sandboxes/msb_5_1_33/> is now permanent $ $HOME/sandboxes/msb_5_1_33/clear This sandbox is permanent. The 'clear' command has been disabled. The contents of the old 'clear' command are in the 'no_clear' file Sunday, 23 August 2009
  • 82. un-preserving a sandbox $ sbtool -o unpreserve -s $HOME/sandboxes/msb_5_1_33/ sandbox at <$HOME/sandboxes/msb_5_1_33/> is now NOT PERMANENT $ $HOME/sandboxes/msb_5_1_33/clear # no error Sunday, 23 August 2009
  • 83. deleting a sandbox $ sbtool -o delete -s $HOME/sandboxes/msb_5_1_35 sandbox at <$HOME/sandboxes/msb_5_1_35> has been removed Sunday, 23 August 2009
  • 84. Roadmap  Install on remote servers (Prototype ready)  create a failover script in replication to promote a slave to master (in design)  GUI  flexible topology read-and-install Sunday, 23 August 2009
  • 85. Shortcuts new command: sb sb #.#.## installs a sandbox (unless exists) and calls it sb r#.#.## installs a replication sandbox (unless exists) and calls the master Sunday, 23 August 2009
  • 86. Remote sandboxes Using GEARMAN client server architecture N servers N workers N clients Supports multiple languages Sunday, 23 August 2009
  • 87. host1 worker1 host2 worker2 func1 worker0 func1 func2 func3 func1 func3 worker3 func1 Gearman server func3 worker4 func1 func3 Gearman server client worker5 func1 host3 func3 host4 Sunday, 23 August 2009
  • 88. host1 worker1 host2 worker2 func1 worker0 func1 func2 func3 func1 func3 worker3 func1 Gearman Gearman Master server server Slave1 func3 worker4 func1 Gearman func3 server client worker5 func1 host3 Slave2 func3 host4 Sunday, 23 August 2009
  • 93. 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. Sunday, 23 August 2009
  • 94. BONUS SLIDES lightning talk about MySQL Sandbox Sunday, 23 August 2009
  • 95. MySQL::Sandbox Perl magic for DBAs and developers Giuseppe Maxia Sunday, 23 August 2009
  • 96. I used to install a lot of MySQL databases for testing MANUALLY Sunday, 23 August 2009
  • 97. Then, I decided to use Perl ... Sunday, 23 August 2009
  • 98. DBA pop quiz Sunday, 23 August 2009
  • 99. HOW MANY KEYSTROKES to install a MySQL server? 10 sb 5.0.83 123456789 + return Sunday, 23 August 2009
  • 100. HOW MANY KEYSTROKES to install 3 MySQL servers in replication? 11 sb r5.0.83 1234567890 + return Sunday, 23 August 2009
  • 101. HOW LONG does it take to install a MySQL server? < 2 seconds time sb 5.0.83 0m1.518s Sunday, 23 August 2009
  • 102. HOW LONG does it take to install 3 MySQL servers in replication? < 5 seconds sb 5.0.83 0m4.515s Sunday, 23 August 2009
  • 103. 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 •Installs (experimental with Gearman) to remote servers Sunday, 23 August 2009