`
秦朝古月
  • 浏览: 227157 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

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/peng
mkdir spider
mkdir /usr/src/redhat      # MySQL源代码会被解压到这里
cd spider
rpm -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.tar
tar -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.46
patch -p2 < ../mysql-5.1.44.spider.diff
patch -p2 < ../mysql-5.1.36.partition_cond_push.diff
autoconf  # 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


编译成功时的信息
引用
g++ -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER -I. -I../../include -I../../zlib -I../../include -I../../include    -O3    -fno-implicit-templates -fno-exceptions -fno-rtti -MT mysqlmanager-guardian.o -MD -MP -MF .deps/mysqlmanager-guardian.Tpo -c -o mysqlmanager-guardian.o `test -f 'guardian.cc' || echo './'`guardian.cc
mv -f .deps/mysqlmanager-guardian.Tpo .deps/mysqlmanager-guardian.Po
g++ -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER -I. -I../../include -I../../zlib -I../../include -I../../include    -O3    -fno-implicit-templates -fno-exceptions -fno-rtti -MT mysqlmanager-parse_output.o -MD -MP -MF .deps/mysqlmanager-parse_output.Tpo -c -o mysqlmanager-parse_output.o `test -f 'parse_output.cc' || echo './'`parse_output.cc
mv -f .deps/mysqlmanager-parse_output.Tpo .deps/mysqlmanager-parse_output.Po
g++ -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER -I. -I../../include -I../../zlib -I../../include -I../../include    -O3    -fno-implicit-templates -fno-exceptions -fno-rtti -MT mysqlmanager-user_management_commands.o -MD -MP -MF .deps/mysqlmanager-user_management_commands.Tpo -c -o mysqlmanager-user_management_commands.o `test -f 'user_management_commands.cc' || echo './'`user_management_commands.cc
mv -f .deps/mysqlmanager-user_management_commands.Tpo .deps/mysqlmanager-user_management_commands.Po
g++ -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER -I. -I../../include -I../../zlib -I../../include -I../../include    -O3    -fno-implicit-templates -fno-exceptions -fno-rtti -MT mysqlmanager-angel.o -MD -MP -MF .deps/mysqlmanager-angel.Tpo -c -o mysqlmanager-angel.o `test -f 'angel.cc' || echo './'`angel.cc
mv -f .deps/mysqlmanager-angel.Tpo .deps/mysqlmanager-angel.Po
/bin/sh ../../libtool --preserve-dup-deps --tag=CXX   --mode=link g++  -O3    -fno-implicit-templates -fno-exceptions -fno-rtti  -rdynamic  -o mysqlmanager mysqlmanager-command.o mysqlmanager-mysqlmanager.o mysqlmanager-manager.o mysqlmanager-log.o mysqlmanager-thread_registry.o mysqlmanager-listener.o mysqlmanager-protocol.o mysqlmanager-mysql_connection.o mysqlmanager-user_map.o mysqlmanager-messages.o mysqlmanager-commands.o mysqlmanager-instance.o mysqlmanager-instance_map.o mysqlmanager-instance_options.o mysqlmanager-buffer.o mysqlmanager-parse.o mysqlmanager-guardian.o mysqlmanager-parse_output.o mysqlmanager-user_management_commands.o mysqlmanager-angel.o -static liboptions.la libnet.a ../../vio/libvio.a ../../mysys/libmysys.a ../../strings/libmystrings.a ../../dbug/libdbug.a ../../extra/yassl/src/libyassl.la               ../../extra/yassl/taocrypt/src/libtaocrypt.la ../../zlib/libzlt.la -lpthread -lcrypt -lnsl -lm  -lpthread
libtool: link: g++ -O3 -fno-implicit-templates -fno-exceptions -fno-rtti -rdynamic -o mysqlmanager mysqlmanager-command.o mysqlmanager-mysqlmanager.o mysqlmanager-manager.o mysqlmanager-log.o mysqlmanager-thread_registry.o mysqlmanager-listener.o mysqlmanager-protocol.o mysqlmanager-mysql_connection.o mysqlmanager-user_map.o mysqlmanager-messages.o mysqlmanager-commands.o mysqlmanager-instance.o mysqlmanager-instance_map.o mysqlmanager-instance_options.o mysqlmanager-buffer.o mysqlmanager-parse.o mysqlmanager-guardian.o mysqlmanager-parse_output.o mysqlmanager-user_management_commands.o mysqlmanager-angel.o  ./.libs/liboptions.a -lpthread -lpthread -lpthread -lpthread libnet.a ../../vio/libvio.a ../../mysys/libmysys.a ../../strings/libmystrings.a ../../dbug/libdbug.a ../../extra/yassl/src/.libs/libyassl.a -lpthread -lpthread -lpthread -lpthread ../../extra/yassl/taocrypt/src/.libs/libtaocrypt.a -lpthread -lpthread -lpthread -lpthread ../../zlib/.libs/libzlt.a -lpthread -lcrypt -lnsl -lm -lpthread
make[2]: Leaving directory `/var/lib/mysql/spider/mysql-5.1.46/server-tools/instance-manager'
make[1]: Leaving directory `/var/lib/mysql/spider/mysql-5.1.46/server-tools'
Making all in win
make[1]: Entering directory `/var/lib/mysql/spider/mysql-5.1.46/win'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/var/lib/mysql/spider/mysql-5.1.46/win'


3.创建二进制安装包
./scripts/make_binary_distribution

成功时的信息:
引用
mysql-5.1.46-linux-i686/share/man/man1/my_print_defaults.1
mysql-5.1.46-linux-i686/share/man/man1/mysqld_safe.1
mysql-5.1.46-linux-i686/share/man/man1/mysqlshow.1
mysql-5.1.46-linux-i686/share/man/man1/mysql_config.1
mysql-5.1.46-linux-i686/share/man/man1/mysqltest.1
mysql-5.1.46-linux-i686/share/man/man1/mysqlslap.1
mysql-5.1.46-linux-i686/share/man/man8/
mysql-5.1.46-linux-i686/share/man/man8/mysqlmanager.8
mysql-5.1.46-linux-i686/share/man/man8/mysqld.8
mysql-5.1.46-linux-i686/share/aclocal/
mysql-5.1.46-linux-i686/share/aclocal/mysql.m4
mysql-5.1.46-linux-i686/share/info/
mysql-5.1.46-linux-i686/share/info/mysql.info
mysql-5.1.46-linux-i686.tar.gz created
Removing temporary directory


4.安装集成了Spider引擎的MySQL(利用sandbox可以在一台服务器上安装多个MySQL实例,安装方法请参照后边)
make_sandbox $PWD/mysql-5.1.46-linux-i686.tar.gz --sandbox_directory=spider_main

安装成功时的信息:
引用
unpacking /var/lib/mysql/spider/mysql-5.1.46/mysql-5.1.46-linux-i686.tar.gz
Executing low_level_make_sandbox --basedir=/var/lib/mysql/spider/mysql-5.1.46/5.1.46 \
        --sandbox_directory=msb_5_1_46 \
        --install_version=5.1 \
        --sandbox_port=5146 \
        --no_ver_after_name \
        --sandbox_directory=spider_main \
        --my_clause=log-error=msandbox.err
    The MySQL Sandbox,  version 3.0.09
    (C) 2006-2010 Giuseppe Maxia
installing with the following parameters:
upper_directory                = /root/sandboxes
sandbox_directory              = spider_main
sandbox_port                   = 5146
check_port                     =
no_check_port                  =
datadir_from                   = script
install_version                = 5.1
basedir                        = /var/lib/mysql/spider/mysql-5.1.46/5.1.46
tmpdir                         =
my_file                        =
operating_system_user          = root
db_user                        = msandbox
db_password                    = msandbox
my_clause                      = log-error=msandbox.err
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) Y
loading grants
... sandbox server started
Your sandbox server was installed in $HOME/sandboxes/spider_main


5.设定:
①Spider引擎设定(从Spider作者博客下载了spider_setup.sql,但是不好用,以为是编译的问题费了好长时间,后来在日文博客里找到了可以用的设定。)
cd $HOME/sandboxes/spider_main
wget http://dl.iteye.com/topics/download/ce85be56-696a-36e9-9c6f-4db53dac528b
mv 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   |
+------------+---------+--------------+------+


编译时遇到的问题及解决办法
①编译时发生错误:
引用
configure:3615: error: in `/var/lib/mysql/spider/mysql-5.1.46':
configure:3618: error: no acceptable C compiler found in $PATH

经查阅,需要安装GCC组件。GCC组件的安装方法可参照下面的手顺。

②装完GCC后,再次MySQL命令时,又发生了如下的错误:
引用
configure:7121: /lib/cpp  conftest.c
In file included from /usr/include/bits/posix1_lim.h:153,
                 from /usr/include/limits.h:145,
                 from /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h:122,
                 from /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h:7,
                 from /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h:11,
                 from conftest.c:11:
/usr/include/bits/local_lim.h:36:26: error: linux/limits.h: No such file or directory
configure:7128: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "MySQL Server"
| #define PACKAGE_TARNAME "mysql"
| #define PACKAGE_VERSION "5.1.46"
| #define PACKAGE_STRING "MySQL Server 5.1.46"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "mysql"
| #define VERSION "5.1.46"
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|                    Syntax error
configure:7190: error: in `/var/lib/mysql/spider/mysql-5.1.46':
configure:7193: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.

解决办法:
ln -s /usr/src/linux/include/linux /usr/include/.


③继续执行上述编译命令,出现如下的错误:
引用
configure: error: No curses/termcap library found

经调查,需要安装 ncurses-devel。
执行远程安装命令 yum install ncurses-devel 命令安装即可解决该问题。

④继续执行上述编译命令命令,出现如下的错误:
引用
In file included from /usr/include/bits/errno.h:25,
                 from /usr/include/errno.h:36,
                 from zutil.h:38,
                 from crc32.c:29:
/usr/include/linux/errno.h:4:23: error: asm/errno.h: No such file or directory
make[1]: *** [crc32.lo] Error 1
make[1]: Leaving directory `/var/lib/mysql/spider/mysql-5.1.46/zlib'
make: *** [all-recursive] Error 1

解决办法如下:
cd /usr/include
ln -s /usr/src/linux/include/asm-i386 /usr/include/asm
ln -s /usr/src/linux/include/asm-generic /usr/include/asm-generic


⑤继续执行上述编译命令,出现如下的错误:
引用
mv -f .deps/handler.Tpo .deps/handler.Po
g++ -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/usr/local\"" -DMYSQL_DATADIR="\"/usr/local/var\"" -DSHAREDIR="\"/usr/local/share/mysql\"" -DPLUGINDIR="\"/usr/local/lib/mysql/plugin\"" -DHAVE_EVENT_SCHEDULER -DHAVE_CONFIG_H -I. -I../include -I../zlib -I../include -I../include -I../regex -I.     -O3    -fno-implicit-templates -fno-exceptions -fno-rtti -MT ha_partition.o -MD -MP -MF .deps/ha_partition.Tpo -c -o ha_partition.o ha_partition.cc
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/peng
tar -xzf autoconf-2.63.tar.gz
cd autoconf-2.63/
./configure --prefix=/usr
make
make install


automake安装
下载地址:http://ftp.gnu.org/gnu/automake/
cd /home/peng
tar -xzf automake-1.11.1.tar.gz
cd automake-1.11.1
./configure --prefix=/usr
make
make check  (耗时很长,非必须!!!)
make install


gcc安装
CentOS的DVD系统光盘,然后进入CentOS目录内,取得如下的安装包,安装顺序如下:
rpm -ivh cpp-4.1.2-42.el5.i386.rpm
rpm -ivh kernel-headers-2.6.6-1.i386.rpm
rpm -ivh glibc-2.5-24.i386.rpm
rpm -ivh glibc-headers-2.5-24.i386.rpm
rpm -ivh glibc-devel-2.5-24.i386.rpm
rpm -ivh libgomp-4.1.2-42.el5.i386.rpm
rpm -ivh gcc-4.1.2-42.el5.i386.rpm


g++安装
CentOS的DVD系统光盘,然后进入CentOS目录内,取得如下的安装包,安装顺序如下:
rpm -ivh libstdc++-devel-4.1.2-42.el5.i386.rpm
rpm -ivh gcc-c++-4.1.2-42.el5.i386.rpm


安装MySQLSandbox
下载地址:https://launchpad.net/mysql-sandbox/+download
cd /home/peng
tar -xzf MySQL-Sandbox-3.0.09.tar.gz
cd MySQL-Sandbox-3.0.09
perl Makefile.PL
make
sudo make install
export 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
0
1
分享到:
评论

相关推荐

    mozilla spidermonkey javascript engine 源代码

    SpiderMonkey is Mozilla's JavaScript engine written in C/C++. It is used in various Mozilla products, including Firefox, and is available under the MPL2.

    mysql-plugin-spider-engine:从mariadb迁移而来的蜘蛛引擎

    mysql-plugin-spider-engine 从mariadb迁移而来的蜘蛛引擎用法首先,编译插件并安装到插件目录 cp -r src /path/to/mysql-src/storage/spidercd /path/to/mysql-srccmake . -DBUILD_CONFIG=mysql_release -DCMAKE_...

    spider monkey+codeblocks 安装及使用demo

    **Spider Monkey与CodeBlocks安装及使用教程** Spider Monkey是Mozilla公司开发的一款JavaScript引擎,它用于在Firefox中执行JavaScript代码。由于其高效的性能和灵活性,Spider Monkey也被广泛应用于其他非浏览器...

    spider-admin-pro 一个集爬虫Scrapy+Scrapyd爬虫项-spider-admin-pro.zip

    标题"spider-admin-pro 一个集爬虫Scrapy+Scrapyd爬虫项-spider-admin-pro.zip"表明这是一个基于Scrapy和Scrapyd的爬虫项目管理平台,名为"spider-admin-pro"。它已经被打包成.zip文件供用户下载和使用。这个平台...

    Black_Spider_1.7.2.zip_Black Spider 1.7.2_Black_Spider_1.7.2_bla

    Black Spider 1.7.2 是一款网络安全工具,主要用于上传shell和检查系统漏洞。这个版本的更新可能包含了一些新的功能和改进,使得它在黑客防御和渗透测试中更加强大和有效。"Black_Spider_1.7.2.zip" 是这个工具的...

    python-spidermonkey

    《用perl解析JavaScript之JavaScript模块的安装--SpiderMonkey》 安装依赖软件: 安装pyrex:sudo apt-get install python-pyrex 安装g++:sudo apt-get install g++ 安装libjs.so: $ tar zxvf js-1.7.0.tar...

    spidermonkey31.2.0开发包

    **SpiderMonkey 31.2.0 开发包详解** SpiderMonkey是Mozilla公司为JavaScript编程语言开发的一个开源、高性能的JavaScript引擎。它以其强大的解析、编译和执行能力,为Web浏览器、服务器、桌面应用程序等多个场景...

    Spider 用于网络分析

    【Spider 用于网络分析】 网络分析是数据科学领域的一个重要组成部分,主要涉及研究网络结构、节点间的关系以及网络动态变化。在这个过程中,Spider(爬虫)作为一种自动化工具,扮演着至关重要的角色。它能帮助...

    spider

    "Spider"在这里指的是一个在Matlab环境下实现的机器学习工具箱,主要用于分类和回归任务。在机器学习领域,"Spider"可能是一个自定义的库,集合了多种算法以供研究和应用。以下将详细探讨与这个工具箱相关的知识点:...

    Article_Spider_spider_

    【标题】:文章爬虫(Spider)开发指南 在信息技术领域,网络爬虫(Web Spider)是一种自动遍历网络并抓取网页信息的程序。在这个案例中,我们关注的是一个特定于“Article Spider”的项目,它专注于从cnblogs.com...

    开源webspider网络蜘蛛webspider-1.0.0.6.tar.gz

    这些文件通常会包含如主程序、库文件、示例代码、配置示例、README文件、安装脚本等,用户可以根据这些文件来编译、安装和使用Webspider。 通过这个开源项目,开发者不仅可以学习到网络爬虫的设计原理和实现技巧,...

    JDspider_jdspider_python爬虫_京东_

    【标题】"JDspider_jdspider_python爬虫_京东_" 涉及的主要知识点是使用Python编程语言构建一个名为JDspider的爬虫程序,该程序专门针对京东(JD.com)的商品页面进行数据抓取,尤其是关注商品的优惠价格信息。...

    spider原理资料

    【Spider原理详解】 Spider,又称为网络爬虫或网络机器人,是互联网中一种自动化程序,其主要任务是在互联网上抓取网页信息。Spider的基本工作原理是通过跟随网页上的超链接,像一只蜘蛛在巨大的蜘蛛网上爬行一样,...

    wechat_spider 微信公众号爬虫

    wechat_spider 微信公众号爬虫。 需要环境: mysql、redis 支持平台: windows/mac 。 示例配置文件: mysqldb: ip: localhost port: 3306 db: wechat user: root passwd: "123456" auto_create_tables: true ...

    weibo_spider_爬虫python_关键词爬虫_python_python爬虫_spider_源码.rar

    标题中的"weibo_spider"表明这是一个针对微博的爬虫项目,主要使用的编程语言是Python。关键词"python爬虫"和"spider_源码"暗示我们这里将深入探讨Python编程语言中的网络爬虫技术,特别是针对微博平台的数据抓取。...

    spiderMonkey_js-1.5-rc6a.tar.gz_SpiderMonkey_openVXI_spiderMonke

    SpiderMonkey是Mozilla公司开发的一款JavaScript引擎,它是Firefox浏览器的核心组成部分之一。这个名为"spiderMonkey_js-1.5-rc6a.tar.gz"的压缩包文件包含了SpiderMonkey的1.5版本的源代码,其中rc6a代表的是...

    spider_spider_spiderpython官网_爬虫_

    本项目"spider_spider_spiderpython官网_爬虫_"是一个使用Python编写的豆瓣网数据爬取小程序。在本文中,我们将深入探讨Python爬虫的基础知识、涉及的库以及如何使用它们来实现豆瓣网的数据抓取。 首先,Python爬虫...

    SpiderMonkey_JSAPI

    2. 创建上下文:`JSContext *cx = JS_NewContext(engine);` 3. 获取全局对象:`JSObject *global = JS_GetGlobalObject(cx);` 4. 定义或加载脚本:`JS_Eval(cx, script, length, filename, JS_EVAL_TYPE_GLOBAL);` 5...

    通过MOZILLA的javascript引擎(SpiderMonkey)执行js代码

    Mozilla的SpiderMonkey是第一个JavaScript引擎,由Mozilla基金会开发,用于支持Firefox浏览器和其他Mozilla相关项目。这个引擎实现了ECMAScript标准,使得JavaScript代码能够被高效地解析和执行。 SpiderMonkey的...

Global site tag (gtag.js) - Google Analytics