【概述】
Solr是一個獨立的[企業(yè)級搜索應用服務器泪幌,它對外提供類似于Web-service的API接口。用戶可以通過http請求,向搜索引擎服務器提交一定格式的XML文件,生成索引片部;也可以通過Http Get操作提出查找請求,并得到XML格式的返回結果
【特點】
Solr是一個高性能霜定,采用Java5開發(fā)吞琐,Solr基于Lucene的全文搜索服務器。同時對其進行了擴展然爆,提供了比Lucene更為豐富的查詢語言,同時實現(xiàn)了可配置黍图、可擴展并對查詢性能進行了優(yōu)化曾雕,并且提供了一個完善的功能管理界面
【理念】
04.png
solr會同步數(shù)據(jù)庫建立自己的索引庫,是的用戶的查詢方式一索引的方式檢索數(shù)據(jù)而更加高效助被,并且減少了對數(shù)據(jù)庫的訪問
【安裝】
準備:solr.tar.gz
環(huán)境:jdk環(huán)境(solr基于java)
1:下載solr-4.10.3.tar.gz
http://archive.apache.org/dist/lucene/solr/
2:解壓
tar -xzvf solr-4.10.3.tar.gz
cp /usr/local/
3:部署至tomcat(復制solr.tar至tomcat的webapps下)
cp /usr/local/solr-4.10.3/example/webapps/solr.war /opt/tomcat/webapps
解壓war包并刪除war文件
4:復制相關jar到solr項目
cp /usr/local/solr-4.10.3/example/lib/ext/* /opt/tomcat/webapps/solr/WEB-INFI/lib/
5:修改tomcat下solr項目的solr_home
vim /opt/tomcat/webapps/solr/WEB-INF/web.xml
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>/usr/local/solr-4.10.3/example/solr</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
6:啟動tomcat并訪問檢查
./tomcat/bin/startup.sh
http://192.168.1.201:8080/solr
7:配置搜索索引(solr_home/collection1/conf/schema.xml)
這里注意:默認的已經(jīng)配置了常用的索引名稱剖张,如果業(yè)務需求其他的 繼續(xù)添加即可
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="sku" type="text_en_splitting_tight" indexed="true" stored="true" omitNorms="true"/>
<field name="name" type="text_general" indexed="true" stored="true"/>
<field name="manu" type="text_general" indexed="true" stored="true" omitNorms="true"/>
<field name="cat" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="features" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="includes" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
2017-05-24_111323.png
【solr目錄】
2017-05-24_112521.png
Bin:solr的腳本
Contrib:solr為了增強自身的功能,所添加的擴展依賴包
Dist:solr build過程時產(chǎn)生的war包和jar包揩环,還有它的一些依賴包
Docs:文檔
Example:例子目錄
Solr:配置了solr運行時的信息搔弄,它是一個標準的solrhome目錄
Multicore:可以配置多個SolrCore實例
Webapps:solr.war的目錄
Licenes:版本信息
【SolrCore的安裝配置】
Solrhome是一個目錄,它是solr運行的主目錄丰滑,它包括多個SolrCore目錄顾犹,SolrCore目錄中就solr實例的運行配置文件和數(shù)據(jù)文件。
Solrhome中可以包括多個SolrCore褒墨,每個SolrCore互相獨立炫刷,而且可以單獨對外提供搜索和索引服務。
solrhome目錄
solrhome目錄.png
solrCore目錄
solrCore目錄.png
【可視化界面操作crud】
... ...