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 \ --my_clause=log-error=msandbox.err ... 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 \ --my_clause=log-error=msandbox.err ... .. 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 >>/tmp <<5.5>> 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.
The post Using MySQL Sandbox with Percona Server appeared first on MySQL Performance Blog.