Spider Storage Engine安装手顺
MySQL数据库的记录数达到两千万后,性能会急剧下降。所以在未到达之前,就要考虑新的办法。Spider Storage Engine可以对MySQL进行分区,因此进行了相关的调查。
1.下载MySQL源代码、Spider源代码、condition pushdown安装包(用于将Spider服务器的查询条件传递到远端服务器)
MySQL源代码下载地址:http://dev.mysql.com/downloads/mysql/#downloads
Spider源代码下载地址:https://launchpad.net/spiderformysql/+download
condition pushdown安装包下载地址:https://edge.launchpad.net/partitionconditionpushdownformysql/+download
都放置于/home/peng目录下。
2.安装Spider
解压MySQL源代码:
cd /home/pengmkdir spidermkdir /usr/src/redhat # MySQL源代码会被解压到这里cd spiderrpm -ivh --nodeps --force /home/peng/MySQL-community-5.1.46-1.rhel5.src.rpm
执行成功后,会在/usr/src/redhat/SOURCES下出现MySQL源文件的压缩包:mysql-5.1.46.tar.gz
解压上述压缩包:
tar -xzf /usr/src/redhat/SOURCES/mysql-5.1.46.tar.gz
同样在/home/peng/spider目录下解压Spider源代码以及文档:
tar -xzf /home/peng/spider-src-2.19-for-5.1.44.tgz.tartar -xzf /home/peng/spider-doc-2.19-for-5.1.44.tgz.tar
同样在/home/peng/spider目录下解压condition pushdown安装包(版本推荐5.1.36):
tar -xzf /home/peng/partition_cond_push-0.1-for-5.1.36.tgz
spider storage engine源码向MySQL中移行:
mv spider mysql-5.1.46/storage/
spider storage engine和MySQL集成编译:
cd mysql-5.1.46patch -p2 < ../mysql-5.1.44.spider.diffpatch -p2 < ../mysql-5.1.36.partition_cond_push.diffautoconf # autoconf安装手顺请参照下面automake # automake安装手顺请参照下面./configure --enable-thread-safe-client \--enable-local-infile \--with-pic --with-fast-mutexes \--with-client-ldflags=-static \--with-mysqld-ldflags=-static --with-zlib-dir=bundled \--with-big-tables --with-ssl --with-readline \--with-embedded-server --with-partition \--with-innodb --without-ndbcluster \--without-archive-storage-engine \--without-blackhole-storage-engine \--with-csv-storage-engine \--without-example-storage-engine \--without-federated-storage-engine \--with-extra-charsets=complex && make
编译成功时的信息
./scripts/make_binary_distribution
成功时的信息:
make_sandbox $PWD/mysql-5.1.46-linux-i686.tar.gz --sandbox_directory=spider_main
安装成功时的信息:
cd $HOME/sandboxes/spider_mainwget http://dl.iteye.com/topics/download/ce85be56-696a-36e9-9c6f-4db53dac528bmv install_spider.zip install_spider.sql./use < install_spider.sql
②检查Spider引擎
./use select engine,support,transactions,xa from information_schema.engines;
执行成功时会出现的信息:
+------------+---------+--------------+------+| engine | support | transactions | xa |+------------+---------+--------------+------+| SPIDER | YES | YES | YES || MRG_MYISAM | YES | NO | NO || CSV | YES | NO | NO || MyISAM | DEFAULT | NO | NO || InnoDB | YES | YES | YES || MEMORY | YES | NO | NO |+------------+---------+--------------+------+
编译时遇到的问题及解决办法
①编译时发生错误:
See `config.log' for more details.
解决办法:
ln -s /usr/src/linux/include/linux /usr/include/.
③继续执行上述编译命令,出现如下的错误:
cd /usr/includeln -s /usr/src/linux/include/asm-i386 /usr/include/asmln -s /usr/src/linux/include/asm-generic /usr/include/asm-generic
⑤继续执行上述编译命令,出现如下的错误:
ha_partition.cc:6575: error: no "const COND* ha_partition::cond_push(const COND*)" member function declared in class "ha_partition"
ha_partition.cc:6595: error: no "void ha_partition::cond_pop()" member function declared in class "ha_partition"
ha_partition.cc:6608: error: redefinition of "const COND* ha_partition::cond_push(const COND*)"
ha_partition.cc:6575: error: "const COND* ha_partition::cond_push(const COND*)" previously defined here
ha_partition.cc:6628: error: redefinition of "void ha_partition::cond_pop()"
ha_partition.cc:6595: error: "void ha_partition::cond_pop()" previously defined here
make[3]: *** [ha_partition.o] Error 1
make[3]: Leaving directory `/var/lib/mysql/spider/mysql-5.1.46/sql'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/var/lib/mysql/spider/mysql-5.1.46/sql'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/var/lib/mysql/spider/mysql-5.1.46/sql')
condition pushdown使用5.1.36版本可以回避这个问题。
工具安装
autoconf安装
下载地址:http://download.chinaunix.net/download/0001000/653.shtml
cd /home/pengtar -xzf autoconf-2.63.tar.gzcd autoconf-2.63/./configure --prefix=/usrmakemake install
automake安装
下载地址:http://ftp.gnu.org/gnu/automake/
cd /home/pengtar -xzf automake-1.11.1.tar.gzcd automake-1.11.1./configure --prefix=/usrmakemake check (耗时很长,非必须!!!)make install
gcc安装
CentOS的DVD系统光盘,然后进入CentOS目录内,取得如下的安装包,安装顺序如下:
rpm -ivh cpp-4.1.2-42.el5.i386.rpmrpm -ivh kernel-headers-2.6.6-1.i386.rpmrpm -ivh glibc-2.5-24.i386.rpmrpm -ivh glibc-headers-2.5-24.i386.rpmrpm -ivh glibc-devel-2.5-24.i386.rpmrpm -ivh libgomp-4.1.2-42.el5.i386.rpmrpm -ivh gcc-4.1.2-42.el5.i386.rpm
g++安装
CentOS的DVD系统光盘,然后进入CentOS目录内,取得如下的安装包,安装顺序如下:
rpm -ivh libstdc++-devel-4.1.2-42.el5.i386.rpmrpm -ivh gcc-c++-4.1.2-42.el5.i386.rpm
安装MySQLSandbox
下载地址:https://launchpad.net/mysql-sandbox/+download
cd /home/pengtar -xzf MySQL-Sandbox-3.0.09.tar.gzcd MySQL-Sandbox-3.0.09perl Makefile.PLmakesudo make installexport SANDBOX_AS_ROOT=1 (如果是root用户,此处必须是0以外的值;如果是root以外用户,设不不需要执行这行。)
MySQL的卸载方法
查找已经安装的MySQL
引用rpm -qa | grep MySQL
MySQL-server-community-5.1.28-0.rhel5
MySQL-client-community-5.1.28-0.rhel5
卸载现有的MySQL
引用rpm -e --nodeps MySQL-client-community-5.1.28-0.rhel5
rpm -e --nodeps MySQL-server-community-5.1.28-0.rhel5
参考
http://nippondanji.blogspot.com/2010/04/spider.html