sphinx系列之mysql和sphinxSE安装(一)

       本文讲的是源码Tarball的安装方式,不是RPM安装方式,为了以后后到sphinx,安装时把mysql的sphinx引擎也安装上去。

       从mysql官网找到mysql的源码下载,这里下载的是Generic Linux (Architecture Independent), Compressed TAR Archive(mysql-5.1.52.tar.gz )版本,如下:

cd /usr/local/src
wget ftp://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.1/mysql-5.1.59.tar.gz 
-c

      从sphinx官网上找到sphinx的安装源码,sphinx目前有1.1beta版和0.9.9-release版,1.1beta版还不太稳定,安装mysql的sphinx引擎,编译mysql时提示configure: error: unknown plugin: sphinx错误,这里就下0.9.9-release版,如下:

cd /usr/local/src
wget http:
//www.sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz -c

      都下载完后就解压缩,如下:

tar -zxv -f mysql-5.1.52.tar.gz
tar 
-zxv -f sphinx-0.9.9.tar.gz

      解压后得到mysql的源代码文件夹为/usr/local/src/mysql-5.1.52,sphinx的源码文件为/usr/local/src/sphinx-0.9.9,然后把sphinx源码文件夹/usr/local/src/sphinx-0.9.9/mysqlse下的所有文件复制到mysql源码文件夹/usr/local/src/mysql-5.1.52/storage/sphinx下,如下:

mkdir /usr/local/src/mysql-5.1.52/storage/sphinx
cp 
/usr/local/src/sphinx-0.9.9/mysqlse/* /usr/local/src/mysql-5.1.52/storage/sphinx/

      复制完后进入到mysql源码文件进行编译安装,如下:

cd /usr/local/src/mysql-5.1.52/

./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charset=all --enable-thread-safe-client --enable-assembler --with-readline --with-big-tables --with-named-curses-libs=/usr/lib/libncursesw.so.5  --with-plugins=sphinx

make && make install

      安装完后对mysql进行些初始化工作,如下:

groupadd mysql #添加mysql用户组
useradd -g mysql mysql #创建mysql用户并把它放到mysql组下
chown -R root:mysql /usr/local/mysql #修改mysql文件属性
/usr/local/mysql/bin/mysql_install_db --user=mysql --dadadir=/usr/local/mysql/var #初始化数据库,这里要指定dadadir属性,要么启动mysql时会提示Starting MySQL..Manager of pid-file
 quit without updating f[失败]  错误
chown 
-R mysql /usr/local/mysql/var #修改属性
cp /root/mysql-5.1.52/support-files/mysql.server /etc/init.d/
chmod 
700 /etc/init.d/mysql.server #修改权限
cp /root/mysql-5.1.52/support-files/my-medium.cnf /etc/my.cnf
/etc/init.d/mysql.server start #启动
/etc/init.d/mysql.server stop #停止 

mysql #在mysql服务启动的情况下进入mysql命令行

show engines; #查看mysql引擎,就会看到 SPHINX引擎,如下:

mysql> show engines;             
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                   | Transactions | XA   | Savepoints |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
| CSV        | YES     | CSV storage engine                                        | NO           | NO   | NO         |
| SPHINX     | YES     | Sphinx storage engine 0.9.9                               | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables | NO           | NO   | NO         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance    | NO           | NO   | NO         |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                     | NO           | NO   | NO         |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
5 rows in set (0.01 sec)

 


 mysql安装就讲到这,下次讲sphinx的安装与使用。

 

 

 

 

 

posted @ 2010-11-04 11:38  Done  阅读(3706)  评论(2编辑  收藏  举报