Your SlideShare is downloading. ×
0
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
MySQL Sandbox - A toolkit for productive laziness
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

MySQL Sandbox - A toolkit for productive laziness

1,638

Published on

Presentation on MySQL Sandbox at Percona Live, London 2011 …

Presentation on MySQL Sandbox at Percona Live, London 2011
How to install several MySQL servers in the same host, either stand-alone or in groups, easily and painlessly

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,638
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
26
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. MySQL SandboxA toolkit forproductive lazinessGiuseppe 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.Tuesday, October 25, 11
  • 2. about me - Giuseppe Maxia • a.k.a. The Data Charmer • QA Director at Continuent, Inc • Long time hacking with MySQL features • Formerly, community manager,db consultant, designer, coder. • A passion for QA and open source • Blogger • http://datacharmer.blogspot.comTuesday, October 25, 11
  • 3. Laziness Laziness is a disinclination to activity or exertion despite having the ability to do so. http://en.wikipedia.org/wiki/LazinessTuesday, October 25, 11
  • 4. I am an experienced DBATuesday, October 25, 11
  • 5. I am an experienced DBA • I have the ability of installing multiple MySQL servers.Tuesday, October 25, 11
  • 6. I am an experienced DBA • I have the ability of installing multiple MySQL servers. • In the same host.Tuesday, October 25, 11
  • 7. I am an experienced DBA • I have the ability of installing multiple MySQL servers. • In the same host. • Without conflicting.Tuesday, October 25, 11
  • 8. I am an experienced DBA • I have the ability of installing multiple MySQL servers. • In the same host. • Without conflicting. • Manually.Tuesday, October 25, 11
  • 9. I am an experienced DBA • I have the ability of installing multiple MySQL servers. • In the same host. • Without conflicting. • Manually. • Do I feel inclined to do so?Tuesday, October 25, 11
  • 10. I am an experienced DBA • I have the ability of installing multiple MySQL servers. • In the same host. • Without conflicting. • Manually. • Do I feel inclined to do so? • Several times a day?Tuesday, October 25, 11
  • 11. I am an experienced DBA • I have the ability of installing multiple MySQL servers. • In the same host. • Without conflicting. • Manually. • Do I feel inclined to do so? • Several times a day? • I DONT THINK SO.Tuesday, October 25, 11
  • 12. I am a command line wizardTuesday, October 25, 11
  • 13. I am a command line wizard • After installing multiple serversTuesday, October 25, 11
  • 14. I am a command line wizard • After installing multiple servers • I can use themTuesday, October 25, 11
  • 15. I am a command line wizard • After installing multiple servers • I can use them • with various long options.Tuesday, October 25, 11
  • 16. I am a command line wizard • After installing multiple servers • I can use them • with various long options. • Manually.Tuesday, October 25, 11
  • 17. I am a command line wizard • After installing multiple servers • I can use them • with various long options. • Manually. • Do I feel inclined to do so?Tuesday, October 25, 11
  • 18. I am a command line wizard • After installing multiple servers • I can use them • with various long options. • Manually. • Do I feel inclined to do so? • Many dozen times a day?Tuesday, October 25, 11
  • 19. I am a command line wizard • After installing multiple servers • I can use them • with various long options. • Manually. • Do I feel inclined to do so? • Many dozen times a day? • I DEFINITELY DONT THINK SO.Tuesday, October 25, 11
  • 20. I can set up replicationTuesday, October 25, 11
  • 21. I can set up replication • Almost without errors.Tuesday, October 25, 11
  • 22. I can set up replication • Almost without errors. • And then I can connect to masters and slaves with long options on the command line.Tuesday, October 25, 11
  • 23. I can set up replication • Almost without errors. • And then I can connect to masters and slaves with long options on the command line. • Do I feel inclined to do so?Tuesday, October 25, 11
  • 24. I can set up replication • Almost without errors. • And then I can connect to masters and slaves with long options on the command line. • Do I feel inclined to do so? • I DONT THINK SO.Tuesday, October 25, 11
  • 25. I have the abilityTuesday, October 25, 11
  • 26. I have the ability • but I dont feel inclined to do repetitive workTuesday, October 25, 11
  • 27. I have the ability • but I dont feel inclined to do repetitive work • I ADMIT IT: I AM LAZYTuesday, October 25, 11
  • 28. I have the ability • but I dont feel inclined to do repetitive work • I ADMIT IT: I AM LAZYTuesday, October 25, 11
  • 29. A lazy developer ® Someone who writes 12,000 lines of code to spare himself the trouble of typing 15 lines on a terminal.Tuesday, October 25, 11
  • 30. 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 peopleTuesday, October 25, 11
  • 31. Thats meTuesday, October 25, 11
  • 32. 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 SECONDSTuesday, October 25, 11
  • 33. overview MySQL MySQL server server Data DB1 Data DB1 DB2 DB3 DATA DIRECTORY DB2 DB3 PORT SOCKETTuesday, October 25, 11
  • 34. overview MySQL MySQL server server Data DB1 SAME Data DB1 DB2 DB3 DATA DB2 DB3 DIRECTORY? /var/lib/mysql /var/lib/mysql DATA CORRUPTIONTuesday, October 25, 11
  • 35. overview MySQL MySQL server server SAME PORT or SOCKET? 3306 3306 /tmp/mysql.sock /tmp/mysql.sock DOES NOT STARTTuesday, October 25, 11
  • 36. The hard way (1)Tuesday, October 25, 11
  • 37. the hard way (2)Tuesday, October 25, 11
  • 38. 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 alwaysTuesday, October 25, 11
  • 39. The easier way $ make_sandbox 5.1.54 # Needs some preliminary workTuesday, October 25, 11
  • 40. The easiest way $ sb 5.1.54 # Needs the same preliminary workTuesday, October 25, 11
  • 41. MySQL Sandbox VERSION MySQL server Data DB1 DB2 DB3 $SANDBOX_HOME/msb_VERSION/data VERSION /tmp/mysql_VERSION.sockTuesday, October 25, 11
  • 42. MySQL Sandbox 5.1.54 MySQL server Data DB1 DB2 DB3 $SANDBOX_HOME/msb_5_1_54/data 5154 /tmp/mysql_5154.sockTuesday, October 25, 11
  • 43. MySQL Sandbox 5.5.9 MySQL server Data DB1 DB2 DB3 $SANDBOX_HOME/msb_5_5_09/data 5509 /tmp/mysql_5509.sockTuesday, October 25, 11
  • 44. Single Sandbox MySQL customized scripts server start stop restart status clear send_kill useTuesday, October 25, 11
  • 45. Multiple Sandbox MySQL customized scripts server start_all stop_all restart_all m n1 status_all s1 n2 clear_all s2 n3 send_kill_a ll use_allTuesday, October 25, 11
  • 46. Where do you get it •from CPAN sudo cpan MySQL::Sandbox •from launchpad http://launchpad.net/mysql-sandboxTuesday, October 25, 11
  • 47. 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.54Tuesday, October 25, 11
  • 48. default architecture $HOME /sandboxes opt expanded tarballs $SANDBOX_HOME mysql $SANDBOX_BINARY installed sandboxesTuesday, October 25, 11
  • 49. default architecture $HOME /sandboxes opt msb_5_0_91 mysql msb_5_1_48 5.0.91 rsandbox_5_1_48 5.1.45 master 5.1.48 node1 5.5.4 node2Tuesday, October 25, 11
  • 50. Tuesday, October 25, 11
  • 51. creating a single sandbox make_sandbox /path/to/mysql-X.X.XX-OS.tar.gzTuesday, October 25, 11
  • 52. using a single sandbox # after # make_sandbox # /path/to/mysql-X.X.XX-OS.tar.gz $ cd $SANDBOX_HOME/msb_X_X_XX $ ./useTuesday, October 25, 11
  • 53. creating a single sandbox with a specific options file make_sandbox /path/to/mysql-X.X.XX-OS.tar.gz -- --my_file=/path/to/my.cnfTuesday, October 25, 11
  • 54. easily create a sandbox after the first one The long way $ cd $HOME/opt/mysql # $SANDBOX_BINARY $ gunzip -c /path/to/mysql-5.1.34-osx10.5-x86.tar.gz | tar -xf - $ mv mysql-5.1.34-osx10.5-x86 5.1.34 $ make sandbox 5.1.34Tuesday, October 25, 11
  • 55. easily create a sandbox after the first one The short way $ make_sandbox --export_binaries path/to/mysql-5.1.34-osx10.5-x86.tar.gzTuesday, October 25, 11
  • 56. starting a single sandbox $ cd $SANDBOX_HOME/msb_X_X_XX $ ./startTuesday, October 25, 11
  • 57. starting a single sandbox with temporary options $ cd $SANDBOX_HOME/msb_X_X_XX $ ./start --option=value $ ./restart --option=value $ ./start --key-buffer=20000000Tuesday, October 25, 11
  • 58. creating a sandbox with custom port and directory $ make_sandbox 5.1.34 -- --sandbox_port=7800 --sandbox_directory=mickeymouseTuesday, October 25, 11
  • 59. 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_aTuesday, October 25, 11
  • 60. create a replication sandbox $ make_replication_sandbox path/to/mysql-5.1.34-osx10.5-x86.tar.gzTuesday, October 25, 11
  • 61. create a circular replication sandbox $ make_replication_sandbox --circular=4 path/to/mysql-5.1.34-osx10.5-x86.tar.gzTuesday, October 25, 11
  • 62. changing port to an existing sandbox $ sbtool -o port -s /path/to/source/sandbox --new_port=XXXXTuesday, October 25, 11
  • 63. installing the innodb plugin $ sbtool -o plugin --plugin=innodb -s /path/to/source/sandboxTuesday, October 25, 11
  • 64. creating a replication sandbox with new base port $ make_replication_sandbox --replication_directory=newwdir --check_base_port 5.0.79 # Creates a replication directory under # $SANDBOX_HOME/newdir # The previous one is preserved. # No conflicts happenTuesday, October 25, 11
  • 65. more recipes $ perldoc MySQL::Sandbox::RecipesTuesday, October 25, 11
  • 66. MySQL Sandbox evolutionTuesday, October 25, 11
  • 67. Tungsten SandboxTuesday, October 25, 11
  • 68. replicator 1 replicator TSB 2 replicator 3 database HOME 1 database sandboxes base_dir 2 database 3Tuesday, October 25, 11
  • 69. tungsten sandbox help ./tools/tungsten-sandbox -h USAGE: ./tools/tungsten-sandbox [flags] args flags: -n,--nodes: how many nodes to install (default: 3) -m,--mysql_version: which MySQL version to use (default: 5.5.13) -t,--tungsten_base: where to install the sandbox (default: $HOME/tsb2/) -d,--group_dir: sandbox group directory name (default: tr_dbs) -x,--tsb_prefix: Tungsten Sandbox prefix (default: db) -s,--service: how the service is named (default: tsandbox) -P,--base_port: port base for MySQL sandbox nodes (default: 7100) -l,--thl_port: port for the THL service (default: 12110) -r,--rmi_port: port for the RMI service (default: 10100) -v,--[no]version: show Tungsten sandbox version (default: false) -h,--[no]help: show Tungsten sandbox help (default: false)Tuesday, October 25, 11
  • 70. tungsten sandbox $ ./tools/tungsten-sandbox -m 5.5.10 executing "clear" on node 1 executing "clear" on node 2 executing "clear" on node 3 installing node 1 installing node 2 installing node 3 group directory installed in $HOME/sandboxes/tr_dbsTuesday, October 25, 11
  • 71. tungsten sandbox ls ~/tsb2 clear_tsandbox db1 db2 db3 db_clear_all db_send_kill_all db_start_all db_status_all db_stop_all db_use_all n1 n2 n3 replicator_all start_tsandbox trepctl_allTuesday, October 25, 11
  • 72. Participate!Tuesday, October 25, 11
  • 73. Participate!Tuesday, October 25, 11
  • 74. THANKS Lets talk! This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http:// creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.Tuesday, October 25, 11

×