Testing mysql creatively in a sandbox
-
Upload
giuseppe-maxia -
Category
Technology
-
view
967 -
download
2
Transcript of Testing mysql creatively in a sandbox
![Page 1: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/1.jpg)
Testing MySQL Creatively in a sandboxGiuseppe MaxiaQA Director, Continuent, Inc
This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
1Tuesday, February 7, 12
![Page 2: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/2.jpg)
Laziness is a disinclination to activity or exertion despite having the ability to do so.
http://en.wikipedia.org/wiki/Laziness
Laziness
2Tuesday, February 7, 12
![Page 3: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/3.jpg)
I have the ability
• but I don't feel inclined to do repetitive work
• I ADMIT IT: I AM LAZY
3Tuesday, February 7, 12
![Page 4: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/4.jpg)
I have the ability
• but I don't feel inclined to do repetitive work
• I ADMIT IT: I AM LAZY
3Tuesday, February 7, 12
![Page 5: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/5.jpg)
A lazy developer ®
Someone who writes 12,000 lines of code to spare himself the trouble of typing 15 lines on a terminal.
(*) And another 1,000,000 people
(*)
4Tuesday, February 7, 12
![Page 6: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/6.jpg)
MySQL Sandbox
• Free software (Perl under GPL)
• One (unix) host
• Many database servers
• Single or multiple sandboxes
• Customized scripts to use the servers
• Standard or circular replication
• Supports MySQL, Percona, MariaDB servers
• Installs IN SECONDS
http://mysqlsandbox.net
5Tuesday, February 7, 12
![Page 7: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/7.jpg)
overview
MySQLserver
MySQLserver
Data DB1
DB2 DB3
Data DB1
DB2 DB3DATA DIRECTORY
PORT
SOCKET
6Tuesday, February 7, 12
![Page 8: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/8.jpg)
overview
MySQLserver
MySQLserver
Data DB1
DB2 DB3
Data DB1
DB2 DB3
SAME DATA
DIRECTORY?
DATA CORRUPTION
/var/lib/mysql /var/lib/mysql
7Tuesday, February 7, 12
![Page 9: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/9.jpg)
overview
MySQLserver
MySQLserver
SAME PORT or SOCKET?
DOES NOT START
/tmp/mysql.sock /tmp/mysql.sock
33063306
8Tuesday, February 7, 12
![Page 10: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/10.jpg)
The easy way$ make_sandbox \
/path/to/mysql-5.1.54_linux.tar.gz
$ make_sandbox \
Percona-Server-5.1.54_linux.tar.gz
# it should work always
9Tuesday, February 7, 12
![Page 11: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/11.jpg)
The easier way$ make_sandbox 5.1.54
# Needs some preliminary work
10Tuesday, February 7, 12
![Page 12: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/12.jpg)
The easiest way$ sb 5.1.54
# Needs the same preliminary work
11Tuesday, February 7, 12
![Page 13: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/13.jpg)
MySQL Sandbox
MySQLserver
VERSION
$SANDBOX_HOME/msb_VERSION/dataData DB1
DB2 DB3
VERSION
/tmp/mysql_VERSION.sock
12Tuesday, February 7, 12
![Page 14: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/14.jpg)
MySQL Sandbox
MySQLserver
5.1.54
$SANDBOX_HOME/msb_5_1_54/dataData DB1
DB2 DB3
5154
/tmp/mysql_5154.sock
13Tuesday, February 7, 12
![Page 15: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/15.jpg)
MySQL Sandbox
MySQLserver
5.5.9
$SANDBOX_HOME/msb_5_5_09/dataData DB1
DB2 DB3
5509
/tmp/mysql_5509.sock
14Tuesday, February 7, 12
![Page 16: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/16.jpg)
Single SandboxMySQLserver
customized scripts
startstop
restartstatusclear
send_killuse
15Tuesday, February 7, 12
![Page 17: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/17.jpg)
Multiple SandboxMySQLserver
customized scripts
start_allstop_all
restart_allstatus_allclear_all
send_kill_all
use_all
ms1s2
n1n2n3
16Tuesday, February 7, 12
![Page 18: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/18.jpg)
Where do you get it
•from CPAN$ sudo su -
# cpan MySQL::Sandbox
•from launchpadhttp://launchpad.net/mysql-sandbox
17Tuesday, February 7, 12
![Page 19: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/19.jpg)
The easy replication way$ make_replication_sandbox \
/path/to/mysql-5.1.54_linux.tar.gz
# or, after some preparation
$ make_replication_sandbox 5.1.54
18Tuesday, February 7, 12
![Page 20: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/20.jpg)
default architecture
$HOME
/sandboxes opt
mysql
$SANDBOX_HOME
$SANDBOX_BINARY
expandedtarballs
installed sandboxes
19Tuesday, February 7, 12
![Page 21: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/21.jpg)
default architecture
$HOME
/sandboxes opt
mysql
5.0.91
5.1.45
5.1.48
5.5.4
msb_5_0_91
msb_5_1_48
rsandbox_5_1_48
master
node1
node220Tuesday, February 7, 12
![Page 22: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/22.jpg)
21Tuesday, February 7, 12
![Page 23: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/23.jpg)
creating a single sandbox
make_sandbox \ /path/to/mysql-X.X.XX-OS.tar.gz
22Tuesday, February 7, 12
![Page 24: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/24.jpg)
using a single sandbox
# after # make_sandbox \# /path/to/mysql-X.X.XX-OS.tar.gz
$ cd $SANDBOX_HOME/msb_X_X_XX$ ./use
23Tuesday, February 7, 12
![Page 25: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/25.jpg)
creating a single sandboxwith a specific options file
make_sandbox \ /path/to/mysql-X.X.XX-OS.tar.gz \ -- --my_file=/path/to/my.cnf
24Tuesday, February 7, 12
![Page 26: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/26.jpg)
easily create a sandbox after the first one
$ cd $HOME/opt/mysql$ gunzip -c \ /path/to/mysql-5.1.34-osx10.5-x86.tar.gz \ | tar -xf -$ mv mysql-5.1.34-osx10.5-x86 5.1.34$ make sandbox 5.1.34
The long way
# $SANDBOX_BINARY
25Tuesday, February 7, 12
![Page 27: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/27.jpg)
easily create a sandbox after the first one
$ make_sandbox --export_binaries \ path/to/mysql-5.1.34-osx10.5-x86.tar.gz
The short way
26Tuesday, February 7, 12
![Page 28: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/28.jpg)
starting a single sandbox
$ cd $SANDBOX_HOME/msb_X_X_XX$ ./start
27Tuesday, February 7, 12
![Page 29: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/29.jpg)
starting a single sandboxwith temporary options
$ cd $SANDBOX_HOME/msb_X_X_XX$ ./start --option=value
$ ./restart --option=value
$ ./start --key-buffer=20000000
28Tuesday, February 7, 12
![Page 30: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/30.jpg)
creating a sandbox with custom port and directory
$ make_sandbox 5.1.34 -- \ --sandbox_port=7800 \ --sandbox_directory=mickeymouse
29Tuesday, February 7, 12
![Page 31: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/31.jpg)
creating a sandbox with automatic port checking
$ make_sandbox 5.1.34 -- --check_port
# if 5.1.34 is free# port=5134# directory=msb_5_1_34# else# port=5135 (or the first free)# directory=msb_5_1_34_a
30Tuesday, February 7, 12
![Page 32: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/32.jpg)
create a replication sandbox
$ make_replication_sandbox \ path/to/mysql-5.1.34-osx10.5-x86.tar.gz
31Tuesday, February 7, 12
![Page 33: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/33.jpg)
changing port to an existing sandbox
$ sbtool -o port \ -s /path/to/source/sandbox \ --new_port=XXXX
32Tuesday, February 7, 12
![Page 34: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/34.jpg)
more recipes
$ perldoc MySQL::Sandbox::Recipes
33Tuesday, February 7, 12
![Page 35: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/35.jpg)
MySQL Sandbox evolution
34Tuesday, February 7, 12
![Page 36: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/36.jpg)
More flexible
• make_sandbox
• --high_performance
• --master (creates a standalone master)
• --slaveof (makes a quick slave of an existing server, even of different versions)
35Tuesday, February 7, 12
![Page 37: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/37.jpg)
create a customized replication system
$ make_sandbox 5.1.57 -- --master
$ make_sandbox 5.5.18 \ -- --slaveof='master_port=5157'
$ make_sandbox 5.6.3 \ -- --slaveof='master_port=5157'
36Tuesday, February 7, 12
![Page 38: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/38.jpg)
Easier to integrate in other systems
• make_multiple_sandbox, make_replication_sandbox
• --node_options='options'
• --one_slave_option='N:options'
• --one_node_option='N:options'
• --master_options='options'
• --slave_options='options'
37Tuesday, February 7, 12
![Page 39: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/39.jpg)
Tungsten Sandbox
38Tuesday, February 7, 12
![Page 40: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/40.jpg)
base_dir
database1
database2
database3
replicator1
replicator2
replicator3
TSB
sandboxes
HOME
39Tuesday, February 7, 12
![Page 41: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/41.jpg)
tungsten sandbox help Tungsten Tools, version 2.0.07 Tungsten Sandbox - Cluster builder (C) 2011 Giuseppe Maxia, Continuent, IncSyntax: /home/tungsten/bin/tungsten-sandbox [options] operation -n --nodes = number How many nodes to install -m --mysql-version = name which MySQL version to use -t --tungsten-base = name Where to install the sandbox -i --installation-directory = name Where the Tungsten tarball has been expanded -d --group-dir = name sandbox group directory name --topology = name Which topology to deploy --hub = number Which node is a hub -s --service = name How the service is named -x --tsb-prefix = name Tungsten Sandbox prefix -p --base-port = number Base port for MySQL Sandbox nodes -l --thl-port = number Port for the THL service -r --rmi-port = number Port for the RMI service -v --version Show Tungsten sandbox version and exit --show-options Show Tungsten sandbox collected options and exit --ignore-manifest Ignore build values in .manifest when determining if the Tungsten package can be used with this sandbox --verbose Show more information during installation and help --man|manual display the program manual --install-options = name Options to be passed to the underlying installer, with the format {TR|MSB}:ROLE:options Where TR is Tungsten Replicator, MSB is MySQL Sandbox, and ROLE can be one of MASTER, SLAVE, DIRECT, NODE, HUB, ENDPOINT, GLOBAL -h --help display this help
40Tuesday, February 7, 12
![Page 42: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/42.jpg)
tungsten sandbox$ tungsten-sandbox -m 5.5.10 \ --topology=master-slave
$ tungsten-sandbox -m 5.1.60 \ --topology=star \ --nodes=5 --hub=2
$ tungsten-sandbox -m 5.5.18 \ --topology=direct \ --nodes=2
$ tungsten-sandbox -m 5.1.60 \ --topology=all-masters \ --nodes=8
41Tuesday, February 7, 12
![Page 43: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/43.jpg)
tungsten sandboxls ~/tsb2clear_tsandbox db2 db_clear_all db_send_kill_all db_status_all db_use_all n1 n3 restart_tsandbox test_topology tungsten_sandbox.infodb1 db3 db_restart_all db_start_all db_stop_all erase_tsandbox n2 replicator_all services_all trepctl_all
42Tuesday, February 7, 12
![Page 44: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/44.jpg)
Participate!
43Tuesday, February 7, 12
![Page 45: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/45.jpg)
Participate!
44Tuesday, February 7, 12
![Page 46: Testing mysql creatively in a sandbox](https://reader030.fdocuments.us/reader030/viewer/2022032514/55d52b25bb61ebf6498b4715/html5/thumbnails/46.jpg)
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.
THANKSLet's talk!
45Tuesday, February 7, 12