標籤:linux sphinx 全文檢索索引
1. sphinx 全文檢索索引引擎,有分tar.gz包安裝和rpm包安裝
2. 目前本人用的是rpm包進行安裝,經過一番折騰,終於安裝成功。
3. 安裝rpm 時遇到的問題:
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/3E/49/wKioL1PHOlqx4q6XAAEATVRaqt0049.jpg" title="QQ20140717103012.png" alt="wKioL1PHOlqx4q6XAAEATVRaqt0049.jpg" />
解決方式: 下載依賴包。 曆時三個步驟下載安裝. 前兩個需要下載,第三個直接安裝
-
rpm -ivh MySQL-shared-compat-5.1.47-1.rhel5.x86_64.rpm
-
rpm -ivh perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm
-
yum -y installmysql-connector-odbc(libodbc.so)
4. 解決完問題,直接安裝sphinx,顯示安裝成功
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/3E/4A/wKioL1PHOnSj7d1WAAHbA1Jrxqk272.jpg" title="QQ20140717103056.png" alt="wKioL1PHOnSj7d1WAAHbA1Jrxqk272.jpg" />
5. sphinx執行啟動,需四個步驟
## Minimal Sphinx configuration sample (clean, simple,functional)# source src1{ type = mysql sql_host = 127.0.0.1//資料庫地址 sql_user = root //資料庫帳號 sql_pass = root//資料庫密碼 sql_db = test//資料庫 sql_port =3306 # optional, default is 3306//資料庫連接埠 sql_query = select id,group_id,UNIX_TIMESTAMP(date_added) as date_added,title,content fromdocuments //select所有你想要查詢的欄位從你的表裡 sql_query_info =SELECT * FROM documents WHERE id=$id//從你的表裡查詢出id} index test1{ source =src1//資料來源這裡指上門 path =/var/lib/sphinx/test1//簡曆索引後文檔存放位置 docinfo =extern charset_type = utf-8//資料編碼} indexer{ mem_limit = 256M//索引器最大使用記憶體} searchd//這裡基本不用動{ listen =9312 listen =9306:mysql41 log =/var/log/sphinx/searchd.log query_log =/var/log/sphinx/query.log read_timeout =5 max_children =30 pid_file =/var/run/sphinx/searchd.pid max_matches = 1000 seamless_rotate = 1 preopen_indexes = 1 unlink_old = 1 workers =threads # for RT to work binlog_path = /var/lib/sphinx/}
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/3E/4B/wKiom1PHOf7TIAJAAAIUS9eOZ24889.jpg" title="QQ20140717104427.png" alt="wKiom1PHOf7TIAJAAAIUS9eOZ24889.jpg" />
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/3E/4B/wKiom1PHOiawZThmAAE3b1vidDM577.jpg" title="QQ20140717104436.png" alt="wKiom1PHOiawZThmAAE3b1vidDM577.jpg" />
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/3E/4B/wKiom1PHOkGjQejqAAGhM2MY0B8504.jpg" title="QQ20140717104517.png" alt="wKiom1PHOkGjQejqAAGhM2MY0B8504.jpg" />
本文出自 “生如夏花” 部落格,謝絕轉載!