用mysql_sandbox建立快速测试环境

MySQL Sandbox是一个非常简单快捷部署隔离的MySQL服务的一个工具。

可以在同一台机器上,快速的部署一个到多个相互隔离互不影响的mysqld服务。比如,开发人员要测试程序系统的不需要在mysql的安装上纠缠过多。对新版本的一些特性感兴趣,尽可能快速结束安装部署。

最短时间部署数据应用架构如Replication Cluster进行性能测试。

准备mysql_sandbox.下载地址:http://http://mysqlsandbox.net/

mysql源码安装包

步骤

1安装mysql_sandbox

cpan MySQL::Sandbox

解压

perl Makefile.pl

make

make install

设置环境变量

[[email protected] ~]# echo ‘export SANDBOX_AS_ROOT=1‘ >> /root/.bash_profile
[[email protected] ~]# source /root/.bash_profile

2安装mysql数据库

3sandbox参数

make_sandbox:最简单创建sandbox
low_level_make_sandbox:创建单个sandbox,微调选项但不直接使用

make_replication_sandbox:创建master-slave架构

make_multiple_sandbox:创建相同版本的sandbox

make_multiple_custom_sandbox:创建不同版本的sandbox

make_sandbox_from_source:从build目录创建一个sandbox

make_sandbox_from_intalled:从已安装的二进制文件创建一个sandbox

sbtool:sandbox管理工具

4创建一个单一的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.gz
Executing 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 Maxia
installing with the following parameters:
upper_directory				= /root/sandboxes
sandbox_directory			  = msb_5_6_17
sandbox_port				   = 5617
check_port					 = 
no_check_port				  = 
datadir_from				   = script
install_version				= 5.6
basedir						= /root/5.6.17
tmpdir						 = 
my_file						= 
operating_system_user		  = root
db_user						= msandbox
remote_access				  = 127.%
bind_address				   = 127.0.0.1
ro_user						= msandbox_ro
rw_user						= msandbox_rw
repl_user					  = rsandbox
db_password					= msandbox
repl_password				  = rsandbox
my_clause					  = log-error=msandbox.err
master						 = 
slaveof						= 
high_performance			   = 
prompt_prefix				  = mysql
prompt_body					=  [\h] {\u} (\d) > 
force						  = 
no_ver_after_name			  = 1
verbose						= 
load_grants					= 1
no_load_grants				 = 
no_run						 = 
no_show						= 
do you agree? ([Y],n) 
loading grants
.. sandbox server started
Your sandbox server was installed in $HOME/sandboxes/msb_5_6_17

你可以通过调用在sandbox文件下面的use脚本进行操作。

[[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) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql [localhost] {msandbox} ((none)) >

你可以管理你的sandbox通过start/stop/restart/status

创建一个主从复制架构

为了创建一个主从复制架构拓扑(默认的是1个主,2个从但是你可以通过改变参数--how_many_nodes)

我们用make_replication_sandbox命令

[[email protected] ~]# make_replication_sandbox mysql-5.6.17-linux-glibc2.5-i686.tar.gz installing and starting master
installing slave 1installing slave 2starting slave 1.... sandbox server started
starting slave 2.. sandbox server started
initializing slave 1initializing slave 2replication directory installed in $HOME/sandboxes/rsandbox_mysql-5_6_17

如果要登录到主的客户端的,在$HOME/sandboxes/rsandbox_mysql-5_6_23/master中 有个use脚本,运行该脚本就可以登录到主的客户端。

如果要登录到从的客户端,在$HOME/sandboxes/rsandbox_mysql-5_6_23/有node1,node2 2个文件夹,在文件夹中有use的脚本,运行该脚本就可以登录到从的客户端。

在replication sandbox,你可管理个别的sandbox通过运行start/stop/restart/status脚本在node/master文件夹中,也可以同时对它们进行管理,在$HOME/sandboxes/rsandbox_mysql-5_6_23文件夹中有restart_all,start_all,status_all,stop_all.

创建一个多主的replication

创建一个多主的sandbox 我们可以在make_replicaton_sandbox加上一个--master_master选项

[[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 activated
group directory installed in $HOME/sandboxes/rcsandbox_mysql-5_6_17

你可以通过help参数来查看一下选项的功能:make_multiple_custom_sandbox make_multiple_sandbox make_replication_sandbox make_sandbox make_sandbox_from_installed and make_sandbox_from_source

时间: 2024-07-29 11:58:52

用mysql_sandbox建立快速测试环境的相关文章

Robot Framework - 建立本地测试环境

注意:本文内容是以"在Window7系统中安装本地RobotFrmamework自动化测试环境"为例. Robot Framework简介 HomePage:http://robotframework.org/ Robot Framework User Guide:http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html Robot Framework documentation:http:

腾讯云安装openvz,快速搭建测试环境

CSDN送了腾讯云的测试资格,准备拿来作为cici的软件发布首页,想在上面做个demo,无奈没有设备环境,于是想要用openvz来虚拟一些vps: 第一步:选择腾讯云的os模板,centos6.3 第二步:安装openvz           安装方法参见:http://openvz.org/Quick_installation 第三步:下载os模板,创建4个vps,分别是ubutnu centos6.5 suse centos7.0 第四步:开启vps 这里发现vps上不了网,估计是腾讯对na

快速搭建虚拟桌面测试环境(NetScaler10.1.119.7、StoreFront、XenDesktop7.5)

经过本人几天的摸索和测试 快速搭建虚拟桌面的步骤如下: 1.制作Windows2008R2的模版(安装上Xentools.dotNet4.0.dotNet4.5.SQLServer2008R2安装准备.关闭IE安全.关闭防火墙,然后使用Sysprep封装,转成模版) 2.使用模版生产3个虚拟机分别命名为AD50,DB49,XD55,PVS56(安装域控,把XD55和PVS56都加入到域中,还有安装一个数据库) 3.在XD55上安装Xendesktop软件,在PVS上安装PVS软件 4.安装Win

一块钱使用开发测试环境,助你快速打造万圣节促销应用

作为一名兢兢业业的员工,我热爱很多节日,比如:春节.劳动节.国庆节(放假的日子不要太爽好不啦),但是我也讨厌很多节日,比如:情人节.教师节.万圣节(又不放假,还要搞事情!).节日期间总是企业间最拼效率的时候,谁的产品先上线,谁就能抓住先机,赚他个盆满钵满的,老板亲切和蔼的告诉我们,工作要点就是一个字:快快快! 然而理想和现实还是有差距的!眼看万圣节就要来临,一个整合促销功能的小应用只要短短几天就能开发完毕,但购置一套开发测试环境却要等待几周甚至是更长的时间,我不敢想象老板那时的表情.时间的问题困

测试环境LAMP用YUM快速部署。

#!/bin/bash # #测试环境LAMP用YUM快速部署. ##注释## #LAMP配置文件路径: #1./etc/httpd/conf/httpd.conf #2./etc/my.cnf #3./etc/php.ini #php网站目录:/var/www/html/ #1.安装LAMP依赖环境 yum -y install gcc gcc-c++ make authconf automake libtool libevent libevent-devel ncurse nucrse-de

eclipse 快速建立PHP调试环境

eclipse 快速建立PHP调试环境 在网上看了许多关于eclipse 建立PHP调试环境的文章,自己去尝试了一翻,但都没有成功,后来自己到Zend的官方去看,原来是版本的问题.现在提供完整的配置步骤.希望初学者能快 速建立好环境,把精力集中到代码而不是配置上.如果您看完还没有配置成功,您还可以点击 视频1 视频2 此处查看FLASH视频. 我的环境如下:Windows-xp+Wamp(Windos Apache Mysql PHP集成安装环境)或者xampp(类似wamp). 1.准备工作

LVS+keepalived快速搭建测试环境

#LVS+keepalived快速搭建测试环境 #centos6 X64 # LVS 负载均衡模式:DR(直接路由) 192.168.18.31 master(LVS) 192.168.18.32 slave(LVS) 192.168.18.18 VIP 192.168.18.11 web1 192.168.18.12 web2 ################################## #手动配置测试 ###LVS 安装配置 yum install ipvsadm -y rpm -q

一文教您如何通过 Docker 快速搭建各种测试环境(Mysql, Redis, Elasticsearch, MongoDB) | 建议收藏

原文:一文教您如何通过 Docker 快速搭建各种测试环境(Mysql, Redis, Elasticsearch, MongoDB) | 建议收藏 欢迎关注个人微信公众号: 小哈学Java, 文末分享阿里 P8 高级架构师吐血总结的 <Java 核心知识整理&面试.pdf>资源链接!! 个人网站: https://www.exception.site 小哈今天给大家分享的主题是,如何通过 Docker 快速搭建各种测试环境,本文列举的,也是小哈在工作中经常用到的,其中包括 Mysql

Docker-教你如何通过 Docker 快速搭建各种测试环境

今天给大家分享的主题是,如何通过 Docker 快速搭建各种测试环境,本文列举的,也是作者在工作中经常用到的,其中包括 MySQL.Redis.Elasticsearch.MongoDB 安装步骤,通过几行命令秒秒钟就能轻松搞定.友情提示:搭建之前,你需要先安装 Docker 哟,本文基于您已经安装好 Docker 的基础上!废话少说,正文开始! 一.镜像加速 Docker 默认是从官方镜像地址 Docker Hub 下下载镜像,由于服务器在国外的缘故,导致经常下载速度非常慢.为了提升镜像的下载