November 24, 2014

Using MySQL Sandbox with Percona Server

One of the most useful tools if you’re working with multiple versions of MySQL Servers is MySQL Sandbox which allows you to maintain many different versions of MySQL, Percona Server, MariaDB. If you’re just working with single sandbox you can just use MySQL Sandbox in its most basic way and it will work:

However if you want to have multiple Sandboxes for MySQL, Percona Server, MariaDB sharing the the same version it is not going to work as there will be conflict in the directory name MySQL Sandbox is using as well as port it is using. –add_prefix Can be used to solve first problem and often it can be good enough as you might want to have many Sandboxes created for testing but only run those you need:

If you’re looking to solve the port conflict you will need to look at the low_level_make_sandbox script which make_sandbox generates and call it directly passing different port to it, for example:

If you’re looking to create Replication Sandbox you might need to change –sandbox_base_port option to avoid conflicts if you’re having multiple sandboxes for MySQL, Percona Server, MariaDB of the same version, however you do not need to worry about directory conflict as MySQL Sandbox will use different names by default in this case, containing product name too and not only version:

So with few simple options I can get sandboxes set up for all different MySQL variants which is a great help if you’re involved in support of many MySQL environments and need to be able to test for behavior differences quickly.

About Peter Zaitsev

Peter managed the High Performance Group within MySQL until 2006, when he founded Percona. Peter has a Master's Degree in Computer Science and is an expert in database kernels, computer hardware, and application scaling.

Comments

  1. Be sure to upgrade to at least Sandbox 3.0.26 if you want to use it to launch instances of MySQL 5.6. The mysql.host system table went away in 5.6, and Sandbox was checking for that table’s existence to verify the instance initialized correctly.

  2. To solve port conflicts quickly, you don’t need to use low_level_make_sandbox.

    make_sandbox /tmp/Percona-Server-5.5.29-rel29.4-401.Linux.x86_64.tar.gz — –check_port

    (Notice — and –check_port)
    And MySQL Sandbox will use the next available port.

    There are recipes for this, and many more tricks in the online cookbook:
    http://search.cpan.org/~gmax/MySQL-Sandbox-3.0.30/lib/MySQL/Sandbox/Recipes.pm#Creating_a_single_sandbox_with_automatic_port_checking

  3. Thanks Giuseppe ! Indeed it is better solution!

Speak Your Mind

*