MySQL Sandbox 3

Giuseppe Maxia
Giuseppe MaxiaSoftware Explorer at VMware
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.
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/
System requirements
 Unix like operating system
         Linux
         Mac OS X
         Solaris
         Free BSD
 MySQL binary tarball
 MySQL Sandbox (current version 2.0.99a)
 Perl
 Bash shell
explaining the sandbox is like
            boxing
explaining the sandbox is like
            boxing
explaining the sandbox is like
            boxing
explaining the sandbox is like
              boxing




explaining takes longer than delivering
Overview




                            data directory
data directory

                            port
port

                            socket
socket
Overview
                    same data
                    directory?




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



                data corruption
Overview
                      same
                   data port or
                     socket?



3306                              3306

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


               does not start
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
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
MySQL Sandbox               VERSION




 $SANDBOX_HOME/msb_VERSION/data

 VERSION

  /tmp/mysql_VERSION.sock
MySQL Sandbox             5.1.32




  $SANDBOX_HOME/msb_5_1_32/data

   5132

   /tmp/mysql_5132.sock
MySQL Sandbox             6.0.6




  $SANDBOX_HOME/msb_6.0.6/data

   6006

   /tmp/mysql_6006.sock
MySQL Sandbox
                  single sandbox
                    commands

  start     use
   stop
  clear
send_kill
MySQL Sandbox   multiple sandbox
                  commands

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

# as root
$ cpan
cpan> install MySQL::Sandbox
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
The easy way - single sandbox

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

# that's it!
The easy way - replication
$ make_replication_sandbox 
    /path/mysql-OS-5.1.26.tar.gz

# that's it!
The easy way - circular
           replication
$ make_replication_sandbox 
    --circular=5 
    /path/mysql-OS-5.1.26.tar.gz

# that's it!
The easy way - multiple servers
$ make_multiple_sandbox 
    /path/mysql-OS-5.1.26.tar.gz

# that's it!
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 6.0.5 6.0.6

$ make_sandbox 5.1.29

# that's it!
multiple servers - different
             versions
$ make_multiple_custom_sandbox 
    5.0.67 5.1.26 6.0.6

# that's it!
fine tuning
$ make_sandbox 
    /path/mysql-OS-5.1.26.tar.gz 
    [option] [option] [option]
pick your size
$ make_sandbox 
    /path/mysql-OS-5.1.26.tar.gz 
    --my_file={small|medium|large|huge}
fine tuning easily
$ make_sandbox 
    /path/mysql-OS-5.1.26.tar.gz 
    --interactive
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]) _
hands on
Using the sandbox

./start
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
Using the sandbox

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

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

./clear
stops the server (by calling the stop script)
removes all files in the data directory
empties the test database
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

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
using mysql clients
$ ./my sqlbinlog 
   ./data/mysql-bin.000001 |less

$ ./my sqldump dbname > dumpname

$ ./my sqladmin extended-status
# no username or password needed!
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 quot;commandquot;
 executes quot;commandquot; for all nodes
Using the replication sandbox

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

 ./s2 [s3, s4 ... ]
 uses the Nth slave
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 quot;commandquot;
 executes quot;commandquot; for all nodes
Using the multi-node sandbox

 ./n1
 uses the first node

 ./n2 [n3, n4 ... ]
 uses the Nth node
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      quot;SQL statementquot;
 passes a SQL statement to all
  servers in all sandboxes
a crowded host
sandbox
 5.0.67


                      7 servers
replication
 replication
  replication
  5.1.26
   5.1.26
    5.0.67


independent
 independent
  independent
    5.1.26
     5.1.26
      5.0.67
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
                        6.0.6          5.1.26
a more crowded host
sandbox                   sandbox
 5.1.26                     6.0.6


                          replication
replication                replication
 replication
                  14        replication
  replication               5.1.26
  5.1.26                     5.1.26
   5.1.26                      6.0.6
    5.1.26
                servers
                          independent
independent                independent
 independent                independent
  independent                 5.1.26
    5.1.26                     5.1.26
     5.1.26                     6.0.6
      5.1.26
an even more crowded host
                                 sandbox
sandbox         sandbox
                                   6.0.6
 5.0.67          5.1.26


                                 replication
replication     replication       replication
 replication     replication       replication
  replication                      5.1.26
                  replication
  5.1.26          5.1.26            5.1.26
   5.1.26          5.1.26             6.0.6
    5.0.67          5.1.26

                                 independent
independent     independent       independent
 independent     independent       independent
  independent                        5.1.26
                  independent
    5.1.26          5.1.26            5.1.26
     5.1.26          5.1.26            6.0.6
      5.0.67          5.1.26

                                21
DEMO TIME
Installing a single one
$ make_sandbox 5.1.29
Executing ./low_level_make_sandbox --basedir=/Users/gmax/opt/mysql/5.1.29 
          --sandbox_directory=msb_5_1_29 
          --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_29
sandbox_port                    = 5129
datadir_from                    = script
install_version                 = 5.1
basedir                         = /Users/gmax/opt/mysql/5.1.29
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_29
Using a single one
$ cd $HOME/sandboxes/msb_5_1_29
$ ./use

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

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

mysql [localhost] {msandbox} ((none)) >
Installing a replication sandbox
$ make_replication_sandbox 5.1.29
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_29
using a replication sandbox
$ cd $HOME/sandboxes/rsandbox_5_1_29
# m = master

$ ./m test
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 4
Server version: 5.1.29-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)
using a replication sandbox
# s1 is slave1

$ ./s1 test
slave1 [localhost] {msandbox} (test) > show tables;
+----------------+
| Tables_in_test |
+----------------+
| t1             |
+----------------+
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
using a replication sandbox
# sending commands to all nodes

$ ./use all quot;SELECT @@server_idquot;
# master
@@server_id
1
# server: 1:
@@server_id
101
# server: 2:
@@server_id
102
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: '
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
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
Easy testing conditions (1)
$ cd $HOME/sandboxes/msb_5_1_35
$ ./use -e 'show variables like
quot;key_buffer_sizequot;'
+-----------------+---------+
| Variable_name    | Value  |
+-----------------+---------+
| key_buffer_size | 8384512 |
+-----------------+---------+

# we need to increase this one
Easy testing conditions (2)
$ ./restart --key_buffer=20M

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

# as easy as saying it!
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
Testing same version in different
           conditions
$SANDBOX_HOME/unpartitioned
|
+-- node1 MyISAM
|
+-- node2 InnoDB
|
+-- node3 Archive
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
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
Latest news


3.0
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
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
Install from source directory
# compile mysql

$ ./configure && make

# install a sandbox

$ make_sandbox_from_source $PWD single
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
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
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
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
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
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%)
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
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)
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'
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 |
+-----------+-------+-------+-------------------+-----------+
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 |
+-----------+-------+-------+-------------------+-----------+
Using a replication tree (3)
$ ./n1 -e 'create table test.t1 (i int)'
$./n1 -e 'insert into test.t1
       values (@@server_id)'
Using a replication tree (4)
$ ./use_all quot;select * from test.t1quot;
# server:   1:
i
101
# server:   2:
i
102
# server:   3:
i
103
# server:   4:
i
104
# server:   5:
i
105
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
checking ranges
$ sbtool -o range --min_range=5130
 5136 - 5146
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
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
deleting a sandbox
$ sbtool -o delete 
   -s $HOME/sandboxes/msb_5_1_35
sandbox at <$HOME/sandboxes/msb_5_1_35> has
been removed
Roadmap

 Install on remote servers (in design)
 create a failover script in replication to promote
  a slave to master (in design)
 GUI
 flexible topology read-and-install
Participate!
Participate!
Participate!
Participate!
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.
1 of 91

Recommended

Best practices for MySQL High Availability by
Best practices for MySQL High AvailabilityBest practices for MySQL High Availability
Best practices for MySQL High AvailabilityColin Charles
23.5K views145 slides
MariaDB Galera Cluster - Simple, Transparent, Highly Available by
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Corporation
13.2K views44 slides
High Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin by
High Availability with Galera Cluster - SkySQL Road Show 2013 in BerlinHigh Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin
High Availability with Galera Cluster - SkySQL Road Show 2013 in BerlinMariaDB Corporation
2.2K views68 slides
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides by
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - SlidesSeveralnines
12.9K views39 slides
MySQL HA with PaceMaker by
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMakerKris Buytaert
15.6K views49 slides
Galera cluster - SkySQL Paris Meetup 17.12.2013 by
Galera cluster - SkySQL Paris Meetup 17.12.2013Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013MariaDB Corporation
1.7K views34 slides

More Related Content

What's hot

MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014 by
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014MariaDB Corporation
777 views36 slides
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北 by
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北Ivan Tu
1.2K views20 slides
MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB? by
MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?
MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?Sveta Smirnova
1.9K views61 slides
Galera cluster for MySQL - Introduction Slides by
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesSeveralnines
144.2K views48 slides
M|18 Under the Hood: Galera Cluster by
M|18 Under the Hood: Galera ClusterM|18 Under the Hood: Galera Cluster
M|18 Under the Hood: Galera ClusterMariaDB plc
1.3K views75 slides
How to Monitor MySQL by
How to Monitor MySQLHow to Monitor MySQL
How to Monitor MySQLServer Density
87.4K views15 slides

What's hot(20)

MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014 by MariaDB Corporation
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北 by Ivan Tu
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
Ivan Tu1.2K views
MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB? by Sveta Smirnova
MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?
MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?
Sveta Smirnova1.9K views
Galera cluster for MySQL - Introduction Slides by Severalnines
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction Slides
Severalnines144.2K views
M|18 Under the Hood: Galera Cluster by MariaDB plc
M|18 Under the Hood: Galera ClusterM|18 Under the Hood: Galera Cluster
M|18 Under the Hood: Galera Cluster
MariaDB plc1.3K views
M|18 Writing Stored Procedures in the Real World by MariaDB plc
M|18 Writing Stored Procedures in the Real WorldM|18 Writing Stored Procedures in the Real World
M|18 Writing Stored Procedures in the Real World
MariaDB plc340 views
Cinder Live Migration and Replication - OpenStack Summit Austin by Ed Balduf
Cinder Live Migration and Replication - OpenStack Summit AustinCinder Live Migration and Replication - OpenStack Summit Austin
Cinder Live Migration and Replication - OpenStack Summit Austin
Ed Balduf3.4K views
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication by Yashada Jadhav
Yahoo: Experiences with MySQL GTID and Multi Threaded ReplicationYahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yashada Jadhav7.8K views
The MySQL High Availability Landscape and where Galera Cluster fits in by Sakari Keskitalo
The MySQL High Availability Landscape and where Galera Cluster fits inThe MySQL High Availability Landscape and where Galera Cluster fits in
The MySQL High Availability Landscape and where Galera Cluster fits in
Sakari Keskitalo495 views
MySQL Scalability and Reliability for Replicated Environment by Jean-François Gagné
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated Environment
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator by Jean-François Gagné
Almost Perfect Service Discovery and Failover with ProxySQL and OrchestratorAlmost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
ceph optimization on ssd ilsoo byun-short by NAVER D2
ceph optimization on ssd ilsoo byun-shortceph optimization on ssd ilsoo byun-short
ceph optimization on ssd ilsoo byun-short
NAVER D22.4K views
MongoDB Engines: Demystified by Sveta Smirnova
MongoDB Engines: DemystifiedMongoDB Engines: Demystified
MongoDB Engines: Demystified
Sveta Smirnova453 views
MySQL replication best practices 105-232-931 by Baruch Osoveskiy
MySQL replication best practices 105-232-931MySQL replication best practices 105-232-931
MySQL replication best practices 105-232-931
Baruch Osoveskiy648 views

Viewers also liked

db tech showcase2016 - MySQLドキュメントストア by
db tech showcase2016 - MySQLドキュメントストアdb tech showcase2016 - MySQLドキュメントストア
db tech showcase2016 - MySQLドキュメントストアShinya Sugiyama
2.6K views52 slides
PPT by
PPTPPT
PPTwebhostingguy
793 views22 slides
Mysql1 by
Mysql1Mysql1
Mysql1rajikaa
1.1K views51 slides
Plsql by
PlsqlPlsql
PlsqlNV Chandra Sekhar Nittala
523 views14 slides
Download It by
Download ItDownload It
Download Itwebhostingguy
1.9K views32 slides
Mysql by
MysqlMysql
MysqlYuvaraja Rajenderan
972 views47 slides

Viewers also liked(20)

db tech showcase2016 - MySQLドキュメントストア by Shinya Sugiyama
db tech showcase2016 - MySQLドキュメントストアdb tech showcase2016 - MySQLドキュメントストア
db tech showcase2016 - MySQLドキュメントストア
Shinya Sugiyama2.6K views
Mysql1 by rajikaa
Mysql1Mysql1
Mysql1
rajikaa1.1K views
Introduction to MySQL by Ted Wennmark
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
Ted Wennmark917 views
MySQL clients by yoku0825
MySQL clientsMySQL clients
MySQL clients
yoku08255.5K views
An introduction to MySQL by Creditas
An introduction to MySQLAn introduction to MySQL
An introduction to MySQL
Creditas954 views
Hortonworks Sandbox Startup Guide for VirtualBox by Hortonworks
Hortonworks Sandbox Startup Guide for VirtualBoxHortonworks Sandbox Startup Guide for VirtualBox
Hortonworks Sandbox Startup Guide for VirtualBox
Hortonworks34.7K views
The Sandbox Manifesto by Angela Maiers
The Sandbox ManifestoThe Sandbox Manifesto
The Sandbox Manifesto
Angela Maiers10.9K views
BITS: Introduction to relational databases and MySQL - SQL by BITS
BITS: Introduction to relational databases and MySQL - SQLBITS: Introduction to relational databases and MySQL - SQL
BITS: Introduction to relational databases and MySQL - SQL
BITS2.9K views
From Sandbox To Production: An Introduction to Salesforce Release Management by Salesforce Developers
From Sandbox To Production: An Introduction to Salesforce Release ManagementFrom Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release Management

Similar to MySQL Sandbox 3

Dbdeployer by
DbdeployerDbdeployer
DbdeployerGiuseppe Maxia
1K views45 slides
Test complex database systems in your laptop with dbdeployer by
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
563 views45 slides
Dbdeployer, the universal installer by
Dbdeployer, the universal installerDbdeployer, the universal installer
Dbdeployer, the universal installerGiuseppe Maxia
617 views44 slides
OpenStack Tokyo Meeup - Gluster Storage Day by
OpenStack Tokyo Meeup - Gluster Storage DayOpenStack Tokyo Meeup - Gluster Storage Day
OpenStack Tokyo Meeup - Gluster Storage DayDan Radez
1.2K views28 slides
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013 by
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Carlos Sanchez
16.9K views63 slides
Network Manual by
Network ManualNetwork Manual
Network ManualJason Myers
88 views42 slides

Similar to MySQL Sandbox 3(20)

Test complex database systems in your laptop with dbdeployer by Giuseppe Maxia
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
Giuseppe Maxia563 views
Dbdeployer, the universal installer by Giuseppe Maxia
Dbdeployer, the universal installerDbdeployer, the universal installer
Dbdeployer, the universal installer
Giuseppe Maxia617 views
OpenStack Tokyo Meeup - Gluster Storage Day by Dan Radez
OpenStack Tokyo Meeup - Gluster Storage DayOpenStack Tokyo Meeup - Gluster Storage Day
OpenStack Tokyo Meeup - Gluster Storage Day
Dan Radez1.2K views
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013 by Carlos Sanchez
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Carlos Sanchez16.9K views
Vagrant for real (codemotion rome 2016) by Michele Orselli
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
Michele Orselli43.9K views
Vagrant for real by Codemotion
Vagrant for realVagrant for real
Vagrant for real
Codemotion344 views
Continuous Delivery: The Next Frontier by Carlos Sanchez
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
Carlos Sanchez1.6K views
Chef Workshop: Setup Environment with Chef,Vagrant, and Berkshelf by Jun Sakata
Chef Workshop: Setup Environment with Chef,Vagrant, and BerkshelfChef Workshop: Setup Environment with Chef,Vagrant, and Berkshelf
Chef Workshop: Setup Environment with Chef,Vagrant, and Berkshelf
Jun Sakata2.6K views
MySQL Spider Architecture by I Goo Lee
MySQL Spider ArchitectureMySQL Spider Architecture
MySQL Spider Architecture
I Goo Lee425 views
Spider Setup with AWS/sandbox by I Goo Lee
Spider Setup with AWS/sandboxSpider Setup with AWS/sandbox
Spider Setup with AWS/sandbox
I Goo Lee497 views
MySQL for Beginners - part 1 by Ivan Zoratti
MySQL for Beginners - part 1MySQL for Beginners - part 1
MySQL for Beginners - part 1
Ivan Zoratti472 views
Mysql by Mindtree
Mysql Mysql
Mysql
Mindtree1.1K views
Bare Metal to OpenStack with Razor and Chef by Matt Ray
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and Chef
Matt Ray7K views
Vagrant for real codemotion (moar tips! ;-)) by Michele Orselli
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
Michele Orselli1K views

More from Giuseppe Maxia

MySQL NDB 8.0 clusters in your laptop with dbdeployer by
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
498 views42 slides
Test like a_boss by
Test like a_bossTest like a_boss
Test like a_bossGiuseppe Maxia
364 views130 slides
Dbdeployer by
DbdeployerDbdeployer
DbdeployerGiuseppe Maxia
661 views44 slides
A quick tour of Mysql 8 roles by
A quick tour of Mysql 8 rolesA quick tour of Mysql 8 roles
A quick tour of Mysql 8 rolesGiuseppe Maxia
1.2K views46 slides
MySQL document_store by
MySQL document_storeMySQL document_store
MySQL document_storeGiuseppe Maxia
1.3K views55 slides
Replication skeptic by
Replication skepticReplication skeptic
Replication skepticGiuseppe Maxia
586 views73 slides

More from Giuseppe Maxia(20)

MySQL NDB 8.0 clusters in your laptop with dbdeployer by Giuseppe Maxia
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
Giuseppe Maxia498 views
A quick tour of Mysql 8 roles by Giuseppe Maxia
A quick tour of Mysql 8 rolesA quick tour of Mysql 8 roles
A quick tour of Mysql 8 roles
Giuseppe Maxia1.2K views
Synchronise your data between MySQL and MongoDB by Giuseppe Maxia
Synchronise your data between MySQL and MongoDBSynchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDB
Giuseppe Maxia16K views
Juggle your data with Tungsten Replicator by Giuseppe Maxia
Juggle your data with Tungsten ReplicatorJuggle your data with Tungsten Replicator
Juggle your data with Tungsten Replicator
Giuseppe Maxia1.4K views
Tungsten Replicator tutorial by Giuseppe Maxia
Tungsten Replicator tutorialTungsten Replicator tutorial
Tungsten Replicator tutorial
Giuseppe Maxia7.4K views
Preventing multi master conflicts with tungsten by Giuseppe Maxia
Preventing multi master conflicts with tungstenPreventing multi master conflicts with tungsten
Preventing multi master conflicts with tungsten
Giuseppe Maxia1.8K views
MySQL high availability power and usability by Giuseppe Maxia
MySQL high availability power and usabilityMySQL high availability power and usability
MySQL high availability power and usability
Giuseppe Maxia944 views
Solving MySQL replication problems with Tungsten by Giuseppe Maxia
Solving MySQL replication problems with TungstenSolving MySQL replication problems with Tungsten
Solving MySQL replication problems with Tungsten
Giuseppe Maxia3.8K views
State of the art of MySQL replication and clustering by Giuseppe Maxia
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
Giuseppe Maxia1.8K views
Testing mysql creatively in a sandbox by Giuseppe Maxia
Testing mysql creatively in a sandboxTesting mysql creatively in a sandbox
Testing mysql creatively in a sandbox
Giuseppe Maxia908 views
Mysql 5.5 and 5.6 replication by Giuseppe Maxia
Mysql 5.5 and 5.6 replicationMysql 5.5 and 5.6 replication
Mysql 5.5 and 5.6 replication
Giuseppe Maxia6.2K views
Lightning talks percona live mysql_2012 by Giuseppe Maxia
Lightning talks percona live mysql_2012Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012
Giuseppe Maxia2.2K views
Testing early mysql releases in a sandbox by Giuseppe Maxia
Testing early mysql releases in a sandboxTesting early mysql releases in a sandbox
Testing early mysql releases in a sandbox
Giuseppe Maxia847 views

Recently uploaded

Special_edition_innovator_2023.pdf by
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdfWillDavies22
17 views6 slides
Ransomware is Knocking your Door_Final.pdf by
Ransomware is Knocking your Door_Final.pdfRansomware is Knocking your Door_Final.pdf
Ransomware is Knocking your Door_Final.pdfSecurity Bootcamp
55 views46 slides
AMAZON PRODUCT RESEARCH.pdf by
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdfJerikkLaureta
26 views13 slides
Tunable Laser (1).pptx by
Tunable Laser (1).pptxTunable Laser (1).pptx
Tunable Laser (1).pptxHajira Mahmood
24 views37 slides
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveNetwork Automation Forum
31 views35 slides
Zero to Automated in Under a Year by
Zero to Automated in Under a YearZero to Automated in Under a Year
Zero to Automated in Under a YearNetwork Automation Forum
15 views23 slides

Recently uploaded(20)

Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2217 views
AMAZON PRODUCT RESEARCH.pdf by JerikkLaureta
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdf
JerikkLaureta26 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Empathic Computing: Delivering the Potential of the Metaverse by Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst478 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker37 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software263 views
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex22 views
The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada127 views
Serverless computing with Google Cloud (2023-24) by wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun11 views

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.
  • 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/
  • 3. System requirements  Unix like operating system Linux Mac OS X Solaris Free BSD  MySQL binary tarball  MySQL Sandbox (current version 2.0.99a)  Perl  Bash shell
  • 4. explaining the sandbox is like boxing
  • 5. explaining the sandbox is like boxing
  • 6. explaining the sandbox is like boxing
  • 7. explaining the sandbox is like boxing explaining takes longer than delivering
  • 8. Overview data directory data directory port port socket socket
  • 9. Overview same data directory? /usr/local/mysql/data /usr/local/mysql/data data corruption
  • 10. Overview same data port or socket? 3306 3306 /tmp/mysql.sock /tmp/mysql.sock does not start
  • 11. 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
  • 12. 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
  • 13. MySQL Sandbox VERSION $SANDBOX_HOME/msb_VERSION/data VERSION /tmp/mysql_VERSION.sock
  • 14. MySQL Sandbox 5.1.32 $SANDBOX_HOME/msb_5_1_32/data 5132 /tmp/mysql_5132.sock
  • 15. MySQL Sandbox 6.0.6 $SANDBOX_HOME/msb_6.0.6/data 6006 /tmp/mysql_6006.sock
  • 16. MySQL Sandbox single sandbox commands start use stop clear send_kill
  • 17. MySQL Sandbox multiple sandbox commands One sandbox to rule them all m n1 start_all s1 n2 stop_all s2 n3 clear_all send_kill_all use_all
  • 18. The easy way - installation # as root $ cpan cpan> install MySQL::Sandbox
  • 19. 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
  • 20. The easy way - single sandbox $ make_sandbox /path/mysql-OS-5.1.26.tar.gz # that's it!
  • 21. The easy way - replication $ make_replication_sandbox /path/mysql-OS-5.1.26.tar.gz # that's it!
  • 22. The easy way - circular replication $ make_replication_sandbox --circular=5 /path/mysql-OS-5.1.26.tar.gz # that's it!
  • 23. The easy way - multiple servers $ make_multiple_sandbox /path/mysql-OS-5.1.26.tar.gz # that's it!
  • 24. 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 6.0.5 6.0.6 $ make_sandbox 5.1.29 # that's it!
  • 25. multiple servers - different versions $ make_multiple_custom_sandbox 5.0.67 5.1.26 6.0.6 # that's it!
  • 26. fine tuning $ make_sandbox /path/mysql-OS-5.1.26.tar.gz [option] [option] [option]
  • 27. pick your size $ make_sandbox /path/mysql-OS-5.1.26.tar.gz --my_file={small|medium|large|huge}
  • 28. fine tuning easily $ make_sandbox /path/mysql-OS-5.1.26.tar.gz --interactive
  • 29. 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]) _
  • 31. Using the sandbox ./start 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
  • 32. Using the sandbox ./stop stops the server if no .pid file exists, it exits immediately
  • 33. Using the sandbox ./send_kill stops the server, using kill -TERM pid# if the server is unresponsive, uses kill -KILL pid#
  • 34. Using the sandbox ./clear stops the server (by calling the stop script) removes all files in the data directory empties the test database
  • 35. 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 
  • 36. 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
  • 37. using mysql clients $ ./my sqlbinlog ./data/mysql-bin.000001 |less $ ./my sqldump dbname > dumpname $ ./my sqladmin extended-status # no username or password needed!
  • 38. 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 quot;commandquot;  executes quot;commandquot; for all nodes
  • 39. Using the replication sandbox ./m  uses the master ./s1  uses the first slave ./s2 [s3, s4 ... ]  uses the Nth slave
  • 40. 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 quot;commandquot;  executes quot;commandquot; for all nodes
  • 41. Using the multi-node sandbox ./n1  uses the first node ./n2 [n3, n4 ... ]  uses the Nth node
  • 42. 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 quot;SQL statementquot;  passes a SQL statement to all servers in all sandboxes
  • 43. a crowded host sandbox 5.0.67 7 servers replication replication replication 5.1.26 5.1.26 5.0.67 independent independent independent 5.1.26 5.1.26 5.0.67
  • 44. 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 6.0.6 5.1.26
  • 45. a more crowded host sandbox sandbox 5.1.26 6.0.6 replication replication replication replication 14 replication replication 5.1.26 5.1.26 5.1.26 5.1.26 6.0.6 5.1.26 servers independent independent independent independent independent independent 5.1.26 5.1.26 5.1.26 5.1.26 6.0.6 5.1.26
  • 46. an even more crowded host sandbox sandbox sandbox 6.0.6 5.0.67 5.1.26 replication replication replication replication replication replication replication replication 5.1.26 replication 5.1.26 5.1.26 5.1.26 5.1.26 5.1.26 6.0.6 5.0.67 5.1.26 independent independent independent independent independent independent independent independent 5.1.26 independent 5.1.26 5.1.26 5.1.26 5.1.26 5.1.26 6.0.6 5.0.67 5.1.26 21
  • 48. Installing a single one $ make_sandbox 5.1.29 Executing ./low_level_make_sandbox --basedir=/Users/gmax/opt/mysql/5.1.29 --sandbox_directory=msb_5_1_29 --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_29 sandbox_port = 5129 datadir_from = script install_version = 5.1 basedir = /Users/gmax/opt/mysql/5.1.29 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_29
  • 49. Using a single one $ cd $HOME/sandboxes/msb_5_1_29 $ ./use Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 3 Server version: 5.1.29-rc MySQL Community Server (GPL) Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql [localhost] {msandbox} ((none)) >
  • 50. Installing a replication sandbox $ make_replication_sandbox 5.1.29 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_29
  • 51. using a replication sandbox $ cd $HOME/sandboxes/rsandbox_5_1_29 # m = master $ ./m test Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 4 Server version: 5.1.29-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)
  • 52. using a replication sandbox # s1 is slave1 $ ./s1 test slave1 [localhost] {msandbox} (test) > show tables; +----------------+ | Tables_in_test | +----------------+ | t1 | +----------------+
  • 53. 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
  • 54. using a replication sandbox # sending commands to all nodes $ ./use all quot;SELECT @@server_idquot; # master @@server_id 1 # server: 1: @@server_id 101 # server: 2: @@server_id 102
  • 55. 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: '
  • 56. 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
  • 57. 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
  • 58. Easy testing conditions (1) $ cd $HOME/sandboxes/msb_5_1_35 $ ./use -e 'show variables like quot;key_buffer_sizequot;' +-----------------+---------+ | Variable_name | Value | +-----------------+---------+ | key_buffer_size | 8384512 | +-----------------+---------+ # we need to increase this one
  • 59. Easy testing conditions (2) $ ./restart --key_buffer=20M $ ./use -e 'show variables like quot;key_buffer_sizequot;' +-----------------+-----------+ | Variable_name | Value | +-----------------+-----------+ | key_buffer_size | 209715200 | +-----------------+-----------+ # as easy as saying it!
  • 60. 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
  • 61. Testing same version in different conditions $SANDBOX_HOME/unpartitioned | +-- node1 MyISAM | +-- node2 InnoDB | +-- node3 Archive
  • 62. 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
  • 63. 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
  • 65. 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
  • 66. 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
  • 67. Install from source directory # compile mysql $ ./configure && make # install a sandbox $ make_sandbox_from_source $PWD single
  • 68. 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
  • 69. 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
  • 70. 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
  • 71. 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
  • 72. 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
  • 73. 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%)
  • 74. 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
  • 75. 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)
  • 76. 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'
  • 77. 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 | +-----------+-------+-------+-------------------+-----------+
  • 78. 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 | +-----------+-------+-------+-------------------+-----------+
  • 79. Using a replication tree (3) $ ./n1 -e 'create table test.t1 (i int)' $./n1 -e 'insert into test.t1 values (@@server_id)'
  • 80. Using a replication tree (4) $ ./use_all quot;select * from test.t1quot; # server: 1: i 101 # server: 2: i 102 # server: 3: i 103 # server: 4: i 104 # server: 5: i 105
  • 81. 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
  • 82. checking ranges $ sbtool -o range --min_range=5130 5136 - 5146
  • 83. 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
  • 84. 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
  • 85. deleting a sandbox $ sbtool -o delete -s $HOME/sandboxes/msb_5_1_35 sandbox at <$HOME/sandboxes/msb_5_1_35> has been removed
  • 86. Roadmap  Install on remote servers (in design)  create a failover script in replication to promote a slave to master (in design)  GUI  flexible topology read-and-install
  • 91. 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.