Chinaunix首页 | 论坛 | 博客
  • 博客访问: 233446
  • 博文数量: 59
  • 博客积分: 2661
  • 博客等级: 少校
  • 技术积分: 732
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-24 11:54
文章分类

全部博文(59)

文章存档

2013年(1)

2012年(8)

2011年(17)

2010年(33)

我的朋友

分类: Mysql/postgreSQL

2010-08-10 11:16:01

   MySQL Sandbox是一个非常简单快捷部署MySQL技术的一个工具套件,它可以让你在同一台机器上,更加快速的无干扰的去达到你的最终目的,比如,作为软件测试人员只是要测试软件系统的良好性不需要在mysql的安装上纠缠过多,不需要对MySQL数据库有太多的经验;有的时候我们只是对新版本的一些特性感兴趣,尽可能快速结束安装部署,而是重点地去体验它的一些特性;可以使用sandbox最短时间部署我们需要的数据库应用架构(ReplicationCluster),以配合我们的现有的应用系统进行性能测试。

MySQL Sandbox 快速,是用秒来衡量的。下面我们就来感受一下sandbox给我们的F1般的速度,你可以在每次安装前使用time命令统计出real/user/sys三项的使用时间。

1.准备工作

下载MySQL Sandbox 2.0

你会看到2.0已经是个很成熟的版本,而3.0还处在开发测试阶段。

下载MySQL

http://dev.mysql.com/downloads/ 这里要求是这么一种版本(Intel C/C++ compiled, glibc-2.3)的tarball——mysql-5.x.xx-linux-i686-glibc23.tar.gz

2.解压MySQL Sandbox

msb12

我们看到sandbox下有一些文件和脚本,接下来我们就是通过使用sandbox给我们提供的方便快捷的脚本去实现我们的安装部署。

(一)使用make_sandbox安装单个MySQL DB

single-instance1

然后,我们来连接数据库。

# cd /root/sandboxes/msb_5_1_33/

# ./use (连接数据库)
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.1.33 MySQL Community Server (GPL)

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

mysql [localhost] {msandbox} ((none)) >     连接成功!!!

# ./stop (停止数据库服务)

# ./start (打开数据库服务)

( NOTE: 如果安装后,不知道相关的目录,可以再current_options.conf文件中找到,它在最初的sandbox解压文件夹中,不过这个文件只是纪录最近一次执行sandbox脚本后的信息。)

(二)使用make_replication_sandbox安装MySQL Replication

replication1

# cd /root/sandboxes/rsandbox_5_1_33

# ./m -e ’show databases’./s1 -e ’show databases’ )   (  ./s2 -e ’show databases’ )

+——————–+
| Database               |
+——————–+
| information_schema |
| mysql                               |
| test                                    |
+——————–+

# ./m -e ‘create database repl’

+——————–+
| Database               |
+——————–+
| information_schema |
| mysql                               |
| repl                                   |
| test                                    |
+——————–+

# ./s1 -e ’show databases’./s2 -e ’show databases’  )

我们会发现slave1和slave2中也增加了repl这个数据库,说明主从复制成功。

# ./stop_all (关闭所有节点)

stopreplication

(三)使用MySQL Cluster Sandbox安装MySQL Cluster

下载支持cluster安装的sandbox

下载mysql-cluster-gpl-6.3.20-linux-i686-glibc23.tar.gz http://dev.mysql.com/get/Downloads/

# tar -xzf mysqlcluster-63.tar.gz

# cd mysqlcluster-63

./dist-tgz.sh mysql-cluster-gpl-6.3.20-linux-i686-glibc23.tar.gz

# ./bootstrap.sh

# ./start-cluster-initial.sh

cluster

#  ./stop-cluster.sh

stopcluster

一共5个节点,id1是MGM node,id2和id3是SQL node,id4和id5是DATA node。你会发现还有6、7、8、9四个节点没有连接上,是因为mysqlcluster-63它有3中模式是的,一个no replication,master cluster,slave cluster,而这里我使用的是no replication的tarball。

阅读(648) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~