+ All Categories
Home > Technology > Testing mysql creatively in a sandbox

Testing mysql creatively in a sandbox

Date post: 20-Aug-2015
Category:
Upload: giuseppe-maxia
View: 966 times
Download: 2 times
Share this document with a friend
Popular Tags:
46
Testing MySQL Creatively in a sandbox Giuseppe Maxia QA Director, Continuent, Inc This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/ licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. 1 Tuesday, February 7, 12
Transcript
Page 1: Testing mysql creatively in a sandbox

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

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

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

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

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

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

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

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

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

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

The easier way$ make_sandbox 5.1.54

# Needs some preliminary work

10Tuesday, February 7, 12

Page 12: Testing mysql creatively in a sandbox

The easiest way$ sb 5.1.54

# Needs the same preliminary work

11Tuesday, February 7, 12

Page 13: Testing mysql creatively in a sandbox

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

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

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

Single SandboxMySQLserver

customized scripts

startstop

restartstatusclear

send_killuse

15Tuesday, February 7, 12

Page 17: Testing mysql creatively in a sandbox

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

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

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

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

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

21Tuesday, February 7, 12

Page 23: Testing mysql creatively in a sandbox

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

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

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

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

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

starting a single sandbox

$ cd $SANDBOX_HOME/msb_X_X_XX$ ./start

27Tuesday, February 7, 12

Page 29: Testing mysql creatively in a sandbox

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

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

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

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

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

more recipes

$ perldoc MySQL::Sandbox::Recipes

33Tuesday, February 7, 12

Page 35: Testing mysql creatively in a sandbox

MySQL Sandbox evolution

34Tuesday, February 7, 12

Page 36: Testing mysql creatively in a sandbox

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

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

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

Tungsten Sandbox

38Tuesday, February 7, 12

Page 40: Testing mysql creatively in a sandbox

base_dir

database1

database2

database3

replicator1

replicator2

replicator3

TSB

sandboxes

HOME

39Tuesday, February 7, 12

Page 41: Testing mysql creatively in a sandbox

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

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

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

Participate!

43Tuesday, February 7, 12

Page 45: Testing mysql creatively in a sandbox

Participate!

44Tuesday, February 7, 12

Page 46: Testing mysql creatively in a sandbox

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


Recommended