linux下安裝全文檢索索引引擎---sphinx(1)

來源:互聯網
上載者:User

標籤: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執行啟動,需四個步驟  

  • 編輯 /etc/sphinx/sphinx.conf

## 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/}





  • 管理索引 sudo –u  sphinx indexer –all --rotate

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/3E/4B/wKiom1PHOf7TIAJAAAIUS9eOZ24889.jpg" title="QQ20140717104427.png" alt="wKiom1PHOf7TIAJAAAIUS9eOZ24889.jpg" />

  • 啟動搜尋守護進程 service  searchd start

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/3E/4B/wKiom1PHOiawZThmAAE3b1vidDM577.jpg" title="QQ20140717104436.png" alt="wKiom1PHOiawZThmAAE3b1vidDM577.jpg" />

  • 使用mysql的查詢搜尋守護線程, 查詢包含關鍵字test的欄位

   
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/3E/4B/wKiom1PHOkGjQejqAAGhM2MY0B8504.jpg" title="QQ20140717104517.png" alt="wKiom1PHOkGjQejqAAGhM2MY0B8504.jpg" />


本文出自 “生如夏花” 部落格,謝絕轉載!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.