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

來源:互聯網
上載者:User

       本文講的是源碼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的安裝與使用。

 

 

 

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.