正在加载...

From:http://salogs.com


由于业务需求,需要在现有mysql中安装sphinx的存储引擎,要保证现有mysql运行的情况下完成。mysql也的确支持存储引擎的在线热插拔,下面介绍安装步骤:

1、查看现有mysql的运行版本
# mysqladmin  -u user -ppwd version

Server version          5.1.47-log
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket           /data/mysql_db/mysql.sock
Uptime:                 15 days 2 hours 17 min 40 sec


2、下载mysql和sphinx
mysql:wget ftp://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.1/mysql-5.1.47.tar.gz
sphinx:wget http://sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz

注意:mysql源码包的版本一定要与当前运行的mysql版本一致!

解压
# tar -xzvf mysql-5.1.47.tar.gz
# tar -xzvf sphinx-0.9.9.tar.gz

3、将sphinx-0.9.9下的mysqlse目录复制到mysql目录中
#cp -r sphinx-0.9.9/mysqlse/ mysql-5.1.47/storage/sphinx

build
# cd mysql-5.1.47
# sh BUILD/autorun.sh
#./configure
# make

注意:这里到make这步即可,不用install

4、将make好的文件复制到当前运行的mysql目录中
# cp storage/sphinx/.libs/ha_sphinx.* /usr/local/mysql/lib/mysql/plugin
更改所有者
# chown mysql.mysql /usr/local/mysql/lib/mysql/plugin/*

注:我当前运行的mysql目录在/usr/local/mysql

5、登陆mysql加载sphinx引擎模块
#mysql -u root -p -h localhost
# mysql> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';
检查引擎模块是否正常加载
mysql> show engines;

+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                        | Transactions | XA   | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| ndbcluster | NO      | Clustered, fault-tolerant tables                               | NULL         | NULL | NULL       |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| BLACKHOLE  | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| SPHINX     | YES     | Sphinx storage engine 0.9.9                                    | NO           | NO   | NO         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         | NO           | NO   | NO         |
| CSV        | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+



安装完成!如果要卸载存储模块使用
mysql> UNINSTALL PLUGIN sphinx;

最后编辑: selboo 编辑于2011/09/03 00:47
Tags:
,
发表评论
表情
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]