Coreseek安装测试配置指南(转)
Sphinx--強(qiáng)大的開源全文檢索引擎,Coreseek--免費(fèi)開源的中文全文檢索引擎
軟件版本:coreseek-4.1
mmseg-3.2.14
autoconf-2.64
老版本的coreseek-3.2和mmseg-3.2.13安裝過程一樣。
一、安裝前準(zhǔn)備編譯環(huán)境
1.1?yum安裝編譯環(huán)境和mysql開發(fā)包
#?yum?install???libtool?gcc-c++
#?yum?install???mysql-devel?libxml2-devel?expat-devel
1.2?編譯安裝autoconf
autoconf?automake手工編譯安裝(因aclocal.m4文件由autoconf?2.64生成)。
#?tar?xzvf?autoconf-2.64.tar.gz
#?./configure
#?make
#?make?install
1.3?編譯安裝automake
#?tar?xzvf?automake-1.11.2.tar.gz
#?cd?automake-1.11.2
#?./configure
#?make
#?make?install
二、安裝mmseg
#?cd?coreseek-3.2.13
#?cd?mmseg-3.2.13
#?./bootstrap????#輸出的warning信息可以忽略,如果出現(xiàn)error則需要解決
#?./configure?--prefix=/usr/local/mmseg
#?make
#?make?install
三、安裝coreseek
#?cd?csft-3.2.13
檢查系統(tǒng)環(huán)境
#?sh?buildconf.sh????#輸出的warning信息可以忽略,如果出現(xiàn)error則需要解決
配置時(shí)要加上mysql數(shù)據(jù)源的支持
#?./configure?--prefix=/usr/local/coreseek??--without-unixodbc?--with-mmseg?--with-mmseg-includes=/usr/local/mmseg/include/mmseg/?--with-mmseg-libs=/usr/local/mmseg/lib/?--with-mysql
#?make
#?make?install
#?cd?..
四、mmseg中文分詞測(cè)試,coreseek搜索測(cè)試
4.1?mmseg中文分詞測(cè)試
#?cd?testpack
此時(shí)應(yīng)該正確顯示中文,需要預(yù)先設(shè)置好字符集為zh_CN.UTF-8,確保正確顯示中文。
#?cat?var/test/test.xml
中文分詞測(cè)試
#?/usr/local/mmseg/bin/mmseg?-d?/usr/local/mmseg/etc/?/root/coreseek-3.2.13/mmseg-3.2.13/src/t1.txt
#?/usr/local/mmseg/bin/mmseg?-d?/usr/local/mmseg/etc/?/root/coreseek-3.2.13/testpack/var/test/test.xml
配置測(cè)試,測(cè)試是否可以正確運(yùn)行
#?/usr/local/coreseek/bin/indexer?-c?/usr/local/coreseek/etc/sphinx-min.conf.dist
csft-4.0版顯示:ERROR:?nothing?to?do.
4.2?coreseek中文全文檢索測(cè)試
查看正常索引指定數(shù)據(jù)時(shí)的提示信息
#?/usr/local/coreseek/bin/indexer?-c?/root/coreseek-4.1-beta/testpack/etc/csft.conf
#?/usr/local/coreseek/bin/indexer?-c?/root/coreseek-3.2.13/testpack/etc/csft.conf
查看正常索引全部數(shù)據(jù)時(shí)的提示信息
#?/usr/local/coreseek/bin/indexer?-c?/root/coreseek-3.2.13/testpack/etc/csft.conf??--all
查看正常測(cè)試搜索時(shí)的提示信息
#?/usr/local/coreseek/bin/search??-c?/root/coreseek-3.2.13/testpack/etc/csft.conf
#?/usr/local/coreseek/bin/search??-c?/root/coreseek-4.1-beta/testpack/etc/csft.conf
查看正常測(cè)試搜索關(guān)鍵詞時(shí)的提示信息
#?/usr/local/coreseek/bin/search??-c?/root/coreseek-3.2.13/testpack/etc/csft.conf?-a?提供了搜索服務(wù)
#?/usr/local/coreseek/bin/search??-c?/root/coreseek-4.1-beta/testpack/etc/csft.conf?-a?提供了搜索服務(wù)
4.3?搜索服務(wù)的啟動(dòng)與關(guān)閉
開啟搜索服務(wù)
#?/usr/local/coreseek/bin/searchd??-c?/root/coreseek-3.2.13/testpack/etc/csft.conf
#?/usr/local/coreseek/bin/searchd?-c?/root/coreseek-4.1-beta/testpack/etc/csft.conf
停止搜索服務(wù)
#?/usr/local/coreseek/bin/searchd??-c?/root/coreseek-3.2.13/testpack/etc/csft.conf?--stop
#?/usr/local/coreseek/bin/searchd?-c?/root/coreseek-4.1-beta/testpack/etc/csft.conf?--stop
五、配置、測(cè)試mysql數(shù)據(jù)源搜索
5.1?準(zhǔn)備mysql環(huán)境
sql測(cè)試數(shù)據(jù)路徑
/root/coreseek-4.1-beta/testpack/var/test/documents.sql
創(chuàng)建test數(shù)據(jù)庫
mysql>create?database?test;
導(dǎo)入sql測(cè)試數(shù)據(jù)
mysql?-uroot?-p123456?test?<?/root/coreseek-4.1-beta/testpack/var/test/documents.sql
拷貝mysql示例配置文件到coreseek安裝目錄
#?cp?/root/coreseek-4.1-beta/testpack/etc/csft_mysql.conf?/usr/local/coreseek/etc/
修改上述配置文件的數(shù)據(jù)庫主機(jī)地址,賬號(hào),密碼等。
5.2?啟動(dòng)搜索服務(wù)
啟動(dòng)搜索服務(wù),這里選擇后臺(tái)運(yùn)行的方式
#?/usr/local/coreseek/bin/searchd?-c?/usr/local/coreseek/etc/csft_mysql.conf
以在log中記錄每個(gè)查詢的io和cpu狀態(tài)的方式啟動(dòng)搜索服務(wù)
#?/usr/local/coreseek/bin/searchd??--iostats?--cpustats?-c?/usr/local/coreseek/etc/csft_mysql.conf
停止搜索服務(wù)
#?/usr/local/coreseek/bin/searchd?-c?/usr/local/coreseek/etc/csft_mysql.conf?--stop
查看搜索服務(wù)狀態(tài)
#?/usr/local/coreseek/bin/searchd?-c?/usr/local/coreseek/etc/csft_mysql.conf?--status
5.3?本機(jī)搜索測(cè)試
#?/usr/local/coreseek/bin/search?-c?/usr/local/coreseek/etc/csft_mysql.conf?-a?百度成立
停止mysql,觀察以上本機(jī)搜索測(cè)試是否正常
#?/etc/init.d/mysqld?stop
啟動(dòng)mysql,觀察以上本機(jī)搜索測(cè)試是否正常
#?/etc/init.d/mysqld?start
5.4?異機(jī)php客戶端api調(diào)用測(cè)試
API路徑:/root/coreseek-4.1-beta/testpack/api
拷貝test.php?和sphinxapi.php到支持php環(huán)境的機(jī)器,然后修改數(shù)據(jù)庫地址,賬號(hào),密碼等配置,測(cè)試如下:
#?php?test.php??中國(guó)
PHP?Warning:??Module?'redis'?already?loaded?in?Unknown?on?line?0
Query?'中國(guó)?'?retrieved?1?of?1?matches?in?0.016?sec.
Query?stats:
'中國(guó)'?found?17?times?in?1?documents
六、后期根據(jù)需求自定義返回?cái)?shù)據(jù)格式
七、安裝配置過程可能遇到的問題及解決方法
7.1?編譯問題及解決方法
#?sh?buildconf.sh
aclocal.m4:20:?warning:?this?file?was?generated?for?autoconf?2.64.
You?have?another?version?of?autoconf.??It?may?work,?but?is?not?guaranteed?to.
If?you?have?problems,?you?may?need?to?regenerate?the?build?system?entirely.
To?do?so,?use?the?procedure?documented?by?the?package,?typically?`autoreconf'.
configure.ac:13:?error:?Autoconf?version?2.62?or?higher?is?required
aclocal.m4:518:?AM_INIT_AUTOMAKE?is?expanded?from...
configure.ac:13:?the?top?level
autom4te:?/usr/bin/m4?failed?with?exit?status:?63
autoheader:?/usr/bin/autom4te?failed?with?exit?status:?63
我的autoconf版本2.59
#?yum?list?installed|grep?autoconf
autoconf.noarch??????????????????????????2.59-12???????????????????????i
解決方法:
手工編譯安裝autoconf-2.64?,automake-1.11.2,(因aclocal.m4文件由autoconf?2.64生成)。
7.2?版本3.2.13生成索引的問題及解決方法
#?/usr/local/coreseek/bin/indexer?-c?etc/csft.conf?--all
Coreseek?Fulltext?3.2?[?Sphinx?0.9.9-release?(r2117)]
Copyright?(c)?2007-2010,
Beijing?Choice?Software?Technologies?Inc?(http://www.coreseek.com)
using?config?file?'etc/csft.conf'...
indexing?index?'xml'...
Unigram?dictionary?load?Error
Segmentation?fault
解決辦法:
#?more?/root/coreseek-3.2.13/testpack/etc/csft.conf
詞典路徑不對(duì),修改實(shí)際安裝字典路徑,默認(rèn)使用相對(duì)路徑,建議使用絕對(duì)路徑。
7.3?版本4.1生成索引的問題及解決方法
#?/usr/local/coreseek/bin/indexer?-c?etc/csft.conf?--all
Coreseek?Fulltext?4.1?[?Sphinx?2.0.2-dev?(r2922)]
Copyright?(c)?2007-2011,
Beijing?Choice?Software?Technologies?Inc?(http://www.coreseek.com)
using?config?file?'etc/csft.conf'...
indexing?index?'xml'...
Unigram?dictionary?load?Error
FATAL:??Tokenizer?initialization?failure.
解決辦法:
#?more?/root/coreseek-3.2.13/testpack/etc/csft.conf
詞典路徑不對(duì),修改實(shí)際安裝字典路徑,默認(rèn)使用相對(duì)路徑,建議使用絕對(duì)路徑。
7.4?編譯安裝軟件的小建議:編譯安裝完成后,不要?jiǎng)h除源代碼,不然無法unnistall
make的原理是執(zhí)行一個(gè)叫Makefile文件里的指令,make的基本用處是自動(dòng)根據(jù)makefile里的指令來編譯源文件。它還可以用來做比 如安裝軟件,卸載軟件等事情,但前提是作者在makefile里寫了。然后用make?install的話,make程序就會(huì)按照上面install:后 面的指令<?commands?>執(zhí)行安裝,uninstall也是一樣的道理,大部分的作者會(huì)寫有卸載的部分,這時(shí)只要簡(jiǎn)單地執(zhí)行 make?unistall就可以,如果作者懶沒有寫,那就只有根據(jù)make?install中的步驟,看它把什么文件拷到哪去了,然后分別手動(dòng)刪除。
還有關(guān)鍵的一點(diǎn)是,編譯安裝完成后,不要?jiǎng)h除源代碼,不然就算作者寫了unnistall目標(biāo),你也沒有makefile可以執(zhí)行了。
7.5?make: Nothing to be done for `all' 解決方法
1.這句提示是說明你已經(jīng)編譯好了,而且沒有對(duì)代碼進(jìn)行任何改動(dòng)。
若想重新編譯,可以先刪除以前編譯產(chǎn)生的目標(biāo)文件:
make clean
然后再
make
2.出現(xiàn)這種情況解決方法:
a.make clean 清除安裝時(shí)留下的文件
b.在運(yùn)行一下ldconfig
c.再make 可運(yùn)行出結(jié)果
7.6? error while loading shared libraries: xxx.so.x"錯(cuò)誤的原因和解決辦法
一般我們?cè)贚inux下執(zhí)行某些外部程序的時(shí)候可能會(huì)提示找不到共享庫的錯(cuò)誤, 比如:
tmux: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
原因一般有兩個(gè), 一個(gè)是操作系統(tǒng)里確實(shí)沒有包含該共享庫(lib*.so.*文件)或者共享庫版本不對(duì), 遇到這種情況那就去網(wǎng)上下載并安裝上即可.
另外一個(gè)原因就是已經(jīng)安裝了該共享庫, 但執(zhí)行需要調(diào)用該共享庫的程序的時(shí)候, 程序按照默認(rèn)共享庫路徑找不到該共享庫文件.
所以安裝共享庫后要注意共享庫路徑設(shè)置問題, 如下:
1) 如果共享庫文件安裝到了/lib或/usr/lib目錄下, 那么需執(zhí)行一下ldconfig命令
ldconfig命令的用途, 主要是在默認(rèn)搜尋目錄(/lib和/usr/lib)以及動(dòng)態(tài)庫配置文件/etc/ld.so.conf內(nèi)所列的目錄下, 搜索出可共享的動(dòng)態(tài)鏈接庫(格式如lib*.so*), 進(jìn)而創(chuàng)建出動(dòng)態(tài)裝入程序(ld.so)所需的連接和緩存文件. 緩存文件默認(rèn)為/etc/ld.so.cache, 此文件保存已排好序的動(dòng)態(tài)鏈接庫名字列表.
2) 如果共享庫文件安裝到了/usr/local/lib(很多開源的共享庫都會(huì)安裝到該目錄下)或其它"非/lib或/usr/lib"目錄下, 那么在執(zhí)行l(wèi)dconfig命令前, 還要把新共享庫目錄加入到共享庫配置文件/etc/ld.so.conf中, 如下:
# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
# echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig
3) 如果共享庫文件安裝到了其它"非/lib或/usr/lib" 目錄下, 但是又不想在/etc/ld.so.conf中加路徑(或者是沒有權(quán)限加路徑). 那可以export一個(gè)全局變量LD_LIBRARY_PATH, 然后運(yùn)行程序的時(shí)候就會(huì)去這個(gè)目錄中找共享庫.
LD_LIBRARY_PATH的意思是告訴loader在哪些目錄中可以找到共享庫. 可以設(shè)置多個(gè)搜索目錄, 這些目錄之間用冒號(hào)分隔開. 比如安裝了一個(gè)mysql到/usr/local/mysql目錄下, 其中有一大堆庫文件在/usr/local/mysql/lib下面, 則可以在.bashrc或.bash_profile或shell里加入以下語句即可:
export LD_LIBRARY_PATH=/usr/local/mysql/lib:$LD_LIBRARY_PATH
一般來講這只是一種臨時(shí)的解決方案, 在沒有權(quán)限或臨時(shí)需要的時(shí)候使用.
4)如果程序需要的庫文件比系統(tǒng)目前存在的村文件版本低,可以做一個(gè)鏈接
比如:
error while loading shared libraries: libncurses.so.4: cannot open shared
object file: No such file or directory
ls /usr/lib/libncu*
/usr/lib/libncurses.a /usr/lib/libncurses.so.5
/usr/lib/libncurses.so /usr/lib/libncurses.so.5.3
可見雖然沒有l(wèi)ibncurses.so.4,但有l(wèi)ibncurses.so.5,是可以向下兼容的
建一個(gè)鏈接就好了
ln -s /usr/lib/libncurses.so.5.3 /usr/lib/libncurses.so.4?
總結(jié)
以上是生活随笔為你收集整理的Coreseek安装测试配置指南(转)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解决关于登录校园网显示不在IP段的问题方
- 下一篇: 第一百三十期:14种常见编程语言的优缺点