由於任務需求要用到Solr,所以在對Solr使用做探究
運行環境:centOS6.5
Solr版本:5.5.2
準備好solr5.2.2的安裝包,下面開始安裝:
1. tar -zxvf solr-5.5.2.tgz
2.cd solr-5.5.2/bin;
執行命令:
./solr start -e cloud -noprompt可以看到
Welcome to the SolrCloud example! Starting up 2 Solr nodes for your example SolrCloud cluster. ... Started Solr server on port 8983 (pid=8404). Happy searching! ... Started Solr server on port 7574 (pid=8549). Happy searching! ... SolrCloud example running, please visit http://localhost:8983/solr3.瀏覽器訪問http://localhost:8983/solr/ 、localhost改爲linux機器的ip地址,如果訪問不到,檢查下linux的防火牆是不是關了。控制檯UI界面
Cloud Graph結果(new_core是我後面加的)
注意:這裏啓動了兩個節點,在再次啓動時可能只能啓動8983的節點。暫行解決辦法:把bin目錄下的solr-7574.pid刪掉,再執行
./solr start -e cloud -noprompt4.
./post -c gettingstarted docs/
java -classpath /solr-5.5.2/dist/solr-core-5.5.0.jar -Dauto=yes -Dc=gettingstarted -Ddata=files -Drecursive=yes org.apache.solr.util.SimplePostTool docs/5.對xml建索引
./post -c gettingstarted ../example/exampledocs/*.xml建立json文件索引
./post -c gettingstarted ../example/exampledocs/books.json建立csv文件索引
./post -c gettingstarted ../example/exampledocs/books.csv6.