Build a fast test environment with Mysql_sandbox

Source: Internet
Author: User

The MySQL sandbox is a tool for a very simple and fast deployment of isolated MySQL services.

On the same machine, you can quickly deploy one-to-many mysqld services that isolate each other from each other. For example, developers need to test the program system without having to dwell too much on MySQL installation. Be interested in some features of the new version and end the installation deployment as quickly as possible.

Minimum time to deploy data application architectures such as replication cluster for performance testing.

Prepare mysql_sandbox.:http://http://mysqlsandbox.net/

MySQL Source installation package

Steps

1 Installing Mysql_sandbox

CPAN Mysql::sandbox

Extract

Perl makefile.pl

Make

Make install

Setting environment variables

[[email protected] ~]# echo ' export sandbox_as_root=1 ' >>/root/.bash_profile[[email protected] ~]# source/root/.b Ash_profile

2 Installing the MySQL database

3sandbox parameters

Make_sandbox: The simplest sandbox to create
Low_level_make_sandbox: Create a single sandbox, fine-tune options but don't use them directly

Make_replication_sandbox: Creating a Master-slave Schema

Make_multiple_sandbox: Create a sandbox of the same version

Make_multiple_custom_sandbox: Creating different versions of sandboxes

Make_sandbox_from_source: Create a sandbox from the build directory

Make_sandbox_from_intalled: Create a sandbox from an installed binary file

Sbtool:sandbox Management Tools

4 Create a single sandbox

[[Email protected] ~]# make_sandbox mysql-5.6.17-linux-glibc2.5-i686.tar.gz unpacking  /root/mysql-5.6.17-linux-glibc2.5-i686.tar.gzexecuting low_level_make_sandbox --basedir=/root/ 5.6.17 \  --sandbox_directory=msb_5_6_17 \  --install_version=5.6 \   --sandbox_port=5617 \  --no_ver_after_name \  --my_clause=log-error= msandbox.err  the mysql sandbox,  version 3.0.44   (C)   2006-2013 giuseppe maxiainstalling with the following parameters:upper_directory = /root/sandboxessandbox_directory  = msb_5_6_17sandbox_port   =  5617check_port = no_check_port  = datadir_from   = scriptinstall_ version= 5.6basedir= /root/5.6.17tmpdir = my_file= operating_system_user  =  rootdb_user= msandBoxremote_access  = 127.%bind_address   = 127.0.0.1ro_user= msandbox_ rorw_user= msandbox_rwrepl_user  = rsandboxdb_password= msandboxrepl_password   = rsandboxmy_clause  = log-error=msandbox.errmaster = slaveof= high_ Performance   = prompt_prefix  = mysqlprompt_body=  [\h] {\u }  (\d)  > force  = no_ver_after_name  = 1verbose= load_ grants= 1no_load_grants = no_run = no_show= do you agree?  ([Y],n)  loading grants.  sandbox server startedYour sandbox server was installed in  $HOME /sandboxes/msb_5_6_17

You can do this by calling the use script below the sandbox file.

[Email protected] ~]# $HOME/sandboxes/msb_5_6_17/usewelcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 3Server version:5.6.17 mysql Community Server (GPL) Copyright (c) #, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql [localhost] {msandbox} ((none)) >

You can manage your sandbox through the Start/stop/restart/status

Create a master-slave replication schema

In order to create a master-slave replication schema topology (the default is 1 master, 2 from but you can change the parameter by--how_many_nodes)

We use the Make_replication_sandbox command.

[Email protected] ~]# Make_replication_sandbox mysql-5.6.17-linux-glibc2.5-i686.tar.gz Installing and starting masterinstalling slave 1installing slave 2starting slave 1 .... Sandbox server startedstarting slave 2.. Sandbox server startedinitializing slave 1initializing slave 2replication directory installed in $HOME/sandboxes/ Rsandbox_mysql-5_6_17

If you want to log on to the primary client, there is a use script in $home/sandboxes/rsandbox_mysql-5_6_23/master that runs the script to log on to the main client.

If you want to log on to the client from, $HOME/SANDBOXES/RSANDBOX_MYSQL-5_6_23/has node1,node2 2 folders, there is a use script in the folder, run the script to log on to the client from.

In the replication sandbox, you can manage individual sandboxes by running Start/stop/restart/status scripts in the Node/master folder, or you can manage them at the same time, in $home/ There are restart_all,start_all,status_all,stop_all in the Sandboxes/rsandbox_mysql-5_6_23 folder.

Create a multi-master replication

Create a multi-master sandbox we can add a--master_master option to the Make_replicaton_sandbox.

[[email protected] ~]# make_replication_sandbox --master_master  Mysql-5.6.17-linux-glibc2.5-i686.tar.gzinstalling node 1installing node 2# server:  1: # server: 2: # server: 1: # server: 2: circular  replication activatedgroup directory installed in  $HOME/sandboxes/rcsandbox_ Mysql-5_6_17 

You can check the functionality of the options by using the Help parameter:make_multiple_custom_sandbox make_multiple_sandbox make_replication_sandbox make_ Sandbox make_sandbox_from_installed and Make_sandbox_from_source

Build a fast test environment with Mysql_sandbox

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.