Over a million developers have joined DZone.

Using MySQL Sandbox with Percona Server

DZone's Guide to

Using MySQL Sandbox with Percona Server

· Performance Zone
Free Resource

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.

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:
root@smt2:~/sandboxes# make_sandbox /tmp/Percona-Server-5.5.29-rel29.4-401.Linux.x86_64.tar.gz
unpacking /tmp/Percona-Server-5.5.29-rel29.4-401.Linux.x86_64.tar.gz
Executing low_level_make_sandbox –basedir=/tmp/5.5.29 \
–sandbox_directory=msb_5_5_29 \
–install_version=5.5 \
–sandbox_port=5529 \
–no_ver_after_name \
no_run =
no_show =
do you agree? ([Y],n) Y
loading grants
… sandbox server started
Your sandbox server was installed in $HOME/sandboxes/msb_5_5_29 

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:

make_sandbox –add_prefix=ps /tmp/Percona-Server-5.5.29-rel29.4-401.Linux.x86_64.tar.gz
unpacking /tmp/Percona-Server-5.5.29-rel29.4-401.Linux.x86_64.tar.gz
Executing low_level_make_sandbox –basedir=/tmp/ps5.5.29 \
–sandbox_directory=msb_ps5_5_29 \
–install_version=5.5 \
–sandbox_port=5529 \
–no_ver_after_name \
.. sandbox server started
Your sandbox server was installed in $HOME/sandboxes/msb_ps5_5_29 

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:

root@smt2:~/sandboxes# low_level_make_sandbox –basedir=/tmp/ps5.5.29 –sandbox_directory=msb_ps5_5_29 –install_version=5.5 –sandbox_port=15529 –no_ver_aft er_name –my_clause=log-error=msandbox.err
The MySQL Sandbox, version 3.0.30
(C) 2006-2013 Giuseppe Maxia
installing with the following parameters:
upper_directory = /root/sandboxes
sandbox_directory = msb_ps5_5_29
sandbox_port = 15529
loading grants
… sandbox server started
Your sandbox server was installed in $HOME/sandboxes/msb_ps5_5_29 

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:

root@smt2:~/sandboxes# make_replication_sandbox /tmp/Percona-Server-5.5.29-rel29.4-401.Linux.x86_64.tar.gz
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 in $HOME/sandboxes/rsandbox_Percona-Server-5_5_29 

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.

Learn tips and best practices for optimizing your capacity management strategy with the Market Guide for Capacity Management, brought to you in partnership with BMC.


Published at DZone with permission of Peter Zaitsev, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}