內建jetty server下solrcloud6.2.1和Zookeeper叢集的安裝和配置過程詳解
環境介紹:
兩臺虛擬機器:192.168.0.1和192.168.0.2
系統和軟體版本:centos6.8 zookeeper-3.4.10 solr-6.2.1
一.zookeeper叢集安裝
下載 zookeeper-3.4.10並解壓
# cd /data/solrcloud/
# tar zxvf zookeeper-3.4.10.tar.gz
在zookeeper目錄裡建立 data和log目錄用於存放資料
# cd /data/solrcloud/zookeeper-3.4.10
# mkdir -p data log
複製zookeeper的配置檔案zoo_sample.cfg為zoo.cfg
# cp conf/zoo_sample.cfg conf/zoo.cfg
編輯配置檔案zoo.cfg,並加入如下內容:
vi conf/zoo.cfg
dataDir=/data/solrcloud/zookeeper-3.4.10/data
dataLogDir=/data/solrcloud/zookeeper-3.4.10/log
server.1=192.168.0.1:2888:3888
server.2=192.168.0.2:2888:3888
儲存退出
在zookeeper中的data目錄裡需要建立myid檔案,並寫入對應的數字
conf/zoo.cfg裡:
server.1對應的機器上寫入1
server.2對應的機器上寫入2
192.168.0.1上寫入1
#cd /data/solrcloud/zookeeper-3.4.10/data
# echo 1 > myid
同理,另外一臺寫入2:
# echo 2 > myid
分別在兩臺機器上啟動zookeeper叢集
# cd /data/solrcloud/zookeeper-3.4.10/bin
# ./zkServer.sh start
檢視叢集狀態
# ./zkServer.sh status
安裝成功應該是一個為leader,1個為follower
# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/solrcloud/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: leader
另外一臺:
]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/solrcloud/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: follower
solrcould安裝
解壓solr-6.2.1.tgz並重新命名為solr,然後修改bin目錄下的solr.in.sh檔案內容:
SOLR_JAVA_MEM="-Xms10G -Xmx10G" (此處根據記憶體大小做適當修改,本例為10G)
加入ZK_HOST
ZK_HOST="192.168.0.1:2181,192.168.0.2:2181"
去掉 ZK_CLIENT_TIMEOUT 的註釋
ZK_CLIENT_TIMEOUT="15000"
配置solr中文分詞器
複製IKAnalyzer-2016_FS.jar檔案到solr/server/solr-webapp/webapp/WEB-INF/lib目錄下
建立用於存放上傳的配置檔案的solrhome目錄,然後複製配置檔案
# mkdir -p /data/solrcloud/solrhome/myconf
# cp -r /data/solrcloud/solr/example/example-DIH/solr/solr/conf /data/solrcloud/solrhome/myconf
myconf中conf下的solrconfig.xml及managed-schema內容需要修改,具體內容可以參考以下配置:
managed-schema內容:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Solr managed schema - automatically generated - DO NOT EDIT -->
<schema name="nutch" version="1.6">
<uniqueKey>kvUuid</uniqueKey>
<defaultSearchField>kvTitle</defaultSearchField>
<solrQueryParser defaultOperator="AND"/>
<fieldType name="ancestor_path" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/"/>
</analyzer>
</fieldType>
<fieldType name="binary" class="solr.BinaryField"/>
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
<fieldType name="booleans" class="solr.BoolField" sortMissingLast="true" multiValued="true"/>
<fieldType name="currency" class="solr.CurrencyField" currencyConfig="currency.xml" defaultCurrency="USD" precisionStep="8"/>
<fieldType name="date" class="solr.TrieDateField" positionIncrementGap="0" docValues="true" precisionStep="0"/>
<fieldType name="dates" class="solr.TrieDateField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="0"/>
<fieldType name="descendent_path" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
</analyzer>
</fieldType>
<fieldType name="double" class="solr.TrieDoubleField" positionIncrementGap="0" docValues="true" precisionStep="0"/>
<fieldType name="doubles" class="solr.TrieDoubleField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="0"/>
<fieldType name="float" class="solr.TrieFloatField" positionIncrementGap="0" docValues="true" precisionStep="0"/>
<fieldType name="floats" class="solr.TrieFloatField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="0"/>
<fieldType name="ignored" class="solr.StrField" indexed="false" stored="false" docValues="false" multiValued="true"/>
<fieldType name="int" class="solr.TrieIntField" positionIncrementGap="0" docValues="true" precisionStep="0"/>
<fieldType name="ints" class="solr.TrieIntField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="0"/>
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType" geo="true" maxDistErr="0.001" distErrPct="0.025" distanceUnits="kilometers"/>
<fieldType name="long" class="solr.TrieLongField" positionIncrementGap="0" docValues="true" precisionStep="0"/>
<fieldType name="longs" class="solr.TrieLongField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="0"/>
<fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="phonetic_en" class="solr.TextField" indexed="true" stored="false">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/>
</analyzer>
</fieldType>
<fieldType name="point" class="solr.PointType" subFieldSuffix="_d" dimension="2"/>
<fieldType name="random" class="solr.RandomSortField" indexed="true"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" docValues="true"/>
<fieldType name="strings" class="solr.StrField" sortMissingLast="true" docValues="true" multiValued="true"/>
<fieldType name="tdate" class="solr.TrieDateField" positionIncrementGap="0" docValues="true" precisionStep="6"/>
<fieldType name="tdates" class="solr.TrieDateField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="6"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" positionIncrementGap="0" docValues="true" precisionStep="8"/>
<fieldType name="tdoubles" class="solr.TrieDoubleField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="8"/>
<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_en_splitting" class="solr.TextField" autoGeneratePhraseQueries="true" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
<filter class="solr.WordDelimiterFilterFactory" catenateNumbers="1" generateNumberParts="1" splitOnCaseChange="1" generateWordParts="1" catenateAll="0" catenateWords="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
<filter class="solr.WordDelimiterFilterFactory" catenateNumbers="0" generateNumberParts="1" splitOnCaseChange="1" generateWordParts="1" catenateAll="0" catenateWords="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_en_splitting_tight" class="solr.TextField" autoGeneratePhraseQueries="true" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" expand="false" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
<filter class="solr.WordDelimiterFilterFactory" catenateNumbers="1" generateNumberParts="0" generateWordParts="0" catenateAll="0" catenateWords="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.EnglishMinimalStemFilterFactory"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_general_rev" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ReversedWildcardFilterFactory" maxPosQuestion="2" maxFractionAsterisk="0.33" maxPosAsterisk="3" withOriginal="true"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_zh" class="solr.TextField">
<analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
</fieldType>
<fieldType name="tfloat" class="solr.TrieFloatField" positionIncrementGap="0" docValues="true" precisionStep="8"/>
<fieldType name="tfloats" class="solr.TrieFloatField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="8"/>
<fieldType name="tint" class="solr.TrieIntField" positionIncrementGap="0" docValues="true" precisionStep="8"/>
<fieldType name="tints" class="solr.TrieIntField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="8"/>
<fieldType name="tlong" class="solr.TrieLongField" positionIncrementGap="0" docValues="true" precisionStep="8"/>
<fieldType name="tlongs" class="solr.TrieLongField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="8"/>
<field name="ARTICLEID" type="string" indexed="true" stored="true"/>
<field name="ARTICLESITE" type="text_zh" indexed="true" stored="true"/>
<field name="ARTICLESITEID" type="string" indexed="true" stored="true"/>
<field name="CLASSLYID" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="DATATYPE" type="string" indexed="true" stored="true"/>
<field name="FILEPATH" type="string" indexed="false" stored="true"/>
<field name="JZ" type="string" indexed="true" stored="true"/>
<field name="MUTISITE" type="text_zh" indexed="true" stored="true"/>
<field name="_version_" type="long" indexed="true" stored="false"/>
<field name="copy_cday" type="string" indexed="true" stored="false"/>
<field name="copy_chour" type="string" indexed="true" stored="false"/>
<field name="copy_cmonth" type="string" indexed="true" stored="false"/>
<field name="copy_cyear" type="string" indexed="true" stored="false"/>
<field name="copy_site" type="string" indexed="true" stored="false"/>
<field name="copy_source" type="string" indexed="true" stored="false"/>
<field name="copy_title" type="string" indexed="true" stored="false"/>
<field name="ismyattention" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="isread" type="int" indexed="true" stored="true"/>
<field name="isyj" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="keyword" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="krInfotype" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="krIslocal" type="int" indexed="true" stored="true"/>
<field name="krKeywordid" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="krState" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="krUid" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="kvAbstract" type="text_zh" indexed="true" stored="true"/>
<field name="kvAuthor" type="text_zh" indexed="true" stored="true"/>
<field name="kvCollection" type="int" indexed="true" stored="true"/>
<field name="kvContent" type="text_zh" indexed="true" stored="true"/>
<field name="kvCtime" type="string" indexed="true" stored="true"/>
<field name="kvDkTime" type="string" indexed="true" stored="true"/>
<field name="kvISYJ" type="int" indexed="false" stored="true"/>
<field name="kvOrienLevel" type="int" indexed="true" stored="true"/>
<field name="kvOrientation" type="int" indexed="true" stored="true"/>
<field name="kvReply" type="int" indexed="true" stored="true"/>
<field name="kvSite" type="text_zh" indexed="true" stored="true"/>
<field name="kvSource" type="text_zh" indexed="true" stored="true"/>
<field name="kvSourcetype" type="int" indexed="true" stored="true"/>
<field name="kvState" type="string" indexed="true" stored="true"/>
<field name="kvTitle" type="text_zh" indexed="true" stored="true"/>
<field name="kvUrl" type="string" indexed="false" stored="true"/>
<field name="kvUserPic" type="string" indexed="false" stored="true"/>
<field name="kvUuid" type="string" indexed="true" stored="true"/>
<field name="kvVisitcount" type="int" indexed="true" stored="true"/>
<field name="retweetedStatusUrl" type="string" indexed="true" stored="true"/>
<field name="text" type="string" indexed="true" stored="true"/>
<field name="wechatInfoType" type="int" indexed="true" stored="true"/>
<dynamicField name="*_txt_en_split_tight" type="text_en_splitting_tight" indexed="true" stored="true"/>
<dynamicField name="*_descendent_path" type="descendent_path" indexed="true" stored="true"/>
<dynamicField name="*_ancestor_path" type="ancestor_path" indexed="true" stored="true"/>
<dynamicField name="*_txt_en_split" type="text_en_splitting" indexed="true" stored="true"/>
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false" useDocValuesAsStored="false"/>
<dynamicField name="ignored_*" type="ignored" multiValued="true"/>
<dynamicField name="*_txt_rev" type="text_general_rev" indexed="true" stored="true"/>
<dynamicField name="*_phon_en" type="phonetic_en" indexed="true" stored="true"/>
<dynamicField name="*_s_lower" type="lowercase" indexed="true" stored="true"/>
<dynamicField name="random_*" type="random"/>
<dynamicField name="*_txt_en" type="text_en" indexed="true" stored="true"/>
<dynamicField name="*_txt_zh" type="text_zh" indexed="true" stored="true"/>
<dynamicField name="*_point" type="point" indexed="true" stored="true"/>
<dynamicField name="*_srpt" type="location_rpt" indexed="true" stored="true"/>
<dynamicField name="*_tdts" type="tdates" indexed="true" stored="true"/>
<dynamicField name="attr_*" type="text_general" multiValued="true" indexed="true" stored="true"/>
<dynamicField name="*_txt" type="text_general" indexed="true" stored="true"/>
<dynamicField name="*_dts" type="date" multiValued="true" indexed="true" stored="true"/>
<dynamicField name="*_tis" type="tints" indexed="true" stored="true"/>
<dynamicField name="*_tls" type="tlongs" indexed="true" stored="true"/>
<dynamicField name="*_tfs" type="tfloats" indexed="true" stored="true"/>
<dynamicField name="*_tds" type="tdoubles" indexed="true" stored="true"/>
<dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/>
<dynamicField name="*_is" type="ints" indexed="true" stored="true"/>
<dynamicField name="*_ss" type="strings" indexed="true" stored="true"/>
<dynamicField name="*_ls" type="longs" indexed="true" stored="true"/>
<dynamicField name="*_bs" type="booleans" indexed="true" stored="true"/>
<dynamicField name="*_fs" type="floats" indexed="true" stored="true"/>
<dynamicField name="*_ds" type="doubles" indexed="true" stored="true"/>
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
<dynamicField name="*_ti" type="tint" indexed="true" stored="true"/>
<dynamicField name="*_tl" type="tlong" indexed="true" stored="true"/>
<dynamicField name="*_tf" type="tfloat" indexed="true" stored="true"/>
<dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/>
<dynamicField name="*_ws" type="text_ws" indexed="true" stored="true"/>
<dynamicField name="*_i" type="int" indexed="true" stored="true"/>
<dynamicField name="*_s" type="string" indexed="true" stored="true"/>
<dynamicField name="*_l" type="long" indexed="true" stored="true"/>
<dynamicField name="*_t" type="text_general" indexed="true" stored="true"/>
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
<dynamicField name="*_f" type="float" indexed="true" stored="true"/>
<dynamicField name="*_d" type="double" indexed="true" stored="true"/>
<dynamicField name="*_p" type="location" indexed="true" stored="true"/>
<dynamicField name="*_c" type="currency" indexed="true" stored="true"/>
<copyField source="kvSite" dest="copy_site"/>
<copyField source="kvSource" dest="copy_source"/>
<copyField source="kvTitle" dest="copy_title"/>
</schema>
啟動solrcloud
# # cd /data/solrcloud/solr/bin
./solr start -cloud -z 192.168.0.1:2181,192.168.0.2:2181 -p 8080
建立帶有三分片和1個副本的topic和chenfeng集合:
./solr create_collection -c topic -shards 3 -replicationFactor 1 -p 8080
./solr create_collection -c chenfeng -shards 3 -replicationFactor 1 -p 8080
進入cloud-scripts目錄並上傳配置檔案到zookeeper:
# cd /data/solrcloud/solr/server/scripts/cloud-scripts
# ./zkcli.sh -zkhost 192.168.0.1:2281,192.168.0.2:2181 -cmd upconfig -confdir /data/solrcloud/solr/server/solr/configsets/basic_configs/conf -confname topic
# ./zkcli.sh -zkhost 192.168.0.1:2281,192.168.0.2:2181 -cmd upconfig -confdir /data/solrcloud/solr/server/solr/configsets/basic_configs/conf -confname chenfeng
登陸zookeeper叢集檢視上傳的檔案:
# cd /data/solrcloud/zookeeper-3.4.10/bin
# ./zkCli.sh
Connecting to localhost:2181
2018-01-25 17:13:33,212 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
2018-01-25 17:13:33,216 [myid:] - INFO [main:Environment@100] - Client environment:host.name=<NA>
2018-01-25 17:13:33,216 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_161
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-3.b14.el6_9.x86_64/jre
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=/data/solrcloud/zookeeper-3.4.10/bin/../build/classes:/data/solrcloud/zookeeper-3.4.10/bin/../build/lib/*.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/slf4j-log4j12-1.6.1.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/slf4j-api-1.6.1.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/netty-3.10.5.Final.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/log4j-1.2.16.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/jline-0.9.94.jar:/data/solrcloud/zookeeper-3.4.10/bin/../zookeeper-3.4.10.jar:/data/solrcloud/zookeeper-3.4.10/bin/../src/java/lib/*.jar:/data/solrcloud/zookeeper-3.4.10/bin/../conf:
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:os.version=2.6.32-642.el6.x86_64
2018-01-25 17:13:33,219 [myid:] - INFO [main:Environment@100] - Client environment:user.name=root
2018-01-25 17:13:33,219 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/root
2018-01-25 17:13:33,219 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/data/solrcloud/zookeeper-3.4.10/bin
2018-01-25 17:13:33,220 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@277050dc
Welcome to ZooKeeper!
2018-01-25 17:13:33,240 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2018-01-25 17:13:33,297 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@876] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2018-01-25 17:13:33,305 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server localhost/0:0:0:0:0:0:0:1:2181, sessionid = 0x1612c33f9f2000a, negotiated timeout = 30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0] ls /configs
[topic, chenfeng]
[zk: localhost:2181(CONNECTED) 1] ls /configs/topic
[currency.xml, protwords.txt, managed-schema, solrconfig.xml, synonyms.txt, elevate.xml, stopwords.txt, lang, params.json]
[zk: localhost:2181(CONNECTED) 2] ls /configs/chenfeng
[currency.xml, protwords.txt, managed-schema, solrconfig.xml, synonyms.txt, elevate.xml, stopwords.txt, lang, params.json]
[zk: localhost:2181(CONNECTED) 3] quit
Quitting...
2018-01-25 17:13:51,512 [myid:] - INFO [main:ZooKeeper@684] - Session: 0x1612c33f9f2000a closed
2018-01-25 17:13:51,514 [myid:] - INFO [main-EventThread:ClientCnxn$EventThread@519] - EventThread shut down for session: 0x1612c33f9f2000a
檢視solr叢集頁面:
http://192.168.0.1:8080/solr/#/~collections/chenfeng
http://192.168.0.1:8080/solr/#/~collections/topic
在介面上點reload重新載入配置檔案,然後重新整理頁面。
至此solrcloud安裝完畢。
兩臺虛擬機器:192.168.0.1和192.168.0.2
系統和軟體版本:centos6.8 zookeeper-3.4.10 solr-6.2.1
一.zookeeper叢集安裝
下載 zookeeper-3.4.10並解壓
# cd /data/solrcloud/
# tar zxvf zookeeper-3.4.10.tar.gz
在zookeeper目錄裡建立 data和log目錄用於存放資料
# cd /data/solrcloud/zookeeper-3.4.10
# mkdir -p data log
複製zookeeper的配置檔案zoo_sample.cfg為zoo.cfg
# cp conf/zoo_sample.cfg conf/zoo.cfg
編輯配置檔案zoo.cfg,並加入如下內容:
vi conf/zoo.cfg
dataDir=/data/solrcloud/zookeeper-3.4.10/data
dataLogDir=/data/solrcloud/zookeeper-3.4.10/log
server.1=192.168.0.1:2888:3888
server.2=192.168.0.2:2888:3888
儲存退出
在zookeeper中的data目錄裡需要建立myid檔案,並寫入對應的數字
conf/zoo.cfg裡:
server.1對應的機器上寫入1
server.2對應的機器上寫入2
192.168.0.1上寫入1
#cd /data/solrcloud/zookeeper-3.4.10/data
# echo 1 > myid
同理,另外一臺寫入2:
# echo 2 > myid
分別在兩臺機器上啟動zookeeper叢集
# cd /data/solrcloud/zookeeper-3.4.10/bin
# ./zkServer.sh start
檢視叢集狀態
# ./zkServer.sh status
安裝成功應該是一個為leader,1個為follower
# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/solrcloud/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: leader
另外一臺:
]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/solrcloud/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: follower
solrcould安裝
解壓solr-6.2.1.tgz並重新命名為solr,然後修改bin目錄下的solr.in.sh檔案內容:
SOLR_JAVA_MEM="-Xms10G -Xmx10G" (此處根據記憶體大小做適當修改,本例為10G)
加入ZK_HOST
ZK_HOST="192.168.0.1:2181,192.168.0.2:2181"
去掉 ZK_CLIENT_TIMEOUT 的註釋
ZK_CLIENT_TIMEOUT="15000"
配置solr中文分詞器
複製IKAnalyzer-2016_FS.jar檔案到solr/server/solr-webapp/webapp/WEB-INF/lib目錄下
建立用於存放上傳的配置檔案的solrhome目錄,然後複製配置檔案
# mkdir -p /data/solrcloud/solrhome/myconf
# cp -r /data/solrcloud/solr/example/example-DIH/solr/solr/conf /data/solrcloud/solrhome/myconf
myconf中conf下的solrconfig.xml及managed-schema內容需要修改,具體內容可以參考以下配置:
managed-schema內容:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Solr managed schema - automatically generated - DO NOT EDIT -->
<schema name="nutch" version="1.6">
<uniqueKey>kvUuid</uniqueKey>
<defaultSearchField>kvTitle</defaultSearchField>
<solrQueryParser defaultOperator="AND"/>
<fieldType name="ancestor_path" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/"/>
</analyzer>
</fieldType>
<fieldType name="binary" class="solr.BinaryField"/>
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
<fieldType name="booleans" class="solr.BoolField" sortMissingLast="true" multiValued="true"/>
<fieldType name="currency" class="solr.CurrencyField" currencyConfig="currency.xml" defaultCurrency="USD" precisionStep="8"/>
<fieldType name="date" class="solr.TrieDateField" positionIncrementGap="0" docValues="true" precisionStep="0"/>
<fieldType name="dates" class="solr.TrieDateField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="0"/>
<fieldType name="descendent_path" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
</analyzer>
</fieldType>
<fieldType name="double" class="solr.TrieDoubleField" positionIncrementGap="0" docValues="true" precisionStep="0"/>
<fieldType name="doubles" class="solr.TrieDoubleField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="0"/>
<fieldType name="float" class="solr.TrieFloatField" positionIncrementGap="0" docValues="true" precisionStep="0"/>
<fieldType name="floats" class="solr.TrieFloatField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="0"/>
<fieldType name="ignored" class="solr.StrField" indexed="false" stored="false" docValues="false" multiValued="true"/>
<fieldType name="int" class="solr.TrieIntField" positionIncrementGap="0" docValues="true" precisionStep="0"/>
<fieldType name="ints" class="solr.TrieIntField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="0"/>
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType" geo="true" maxDistErr="0.001" distErrPct="0.025" distanceUnits="kilometers"/>
<fieldType name="long" class="solr.TrieLongField" positionIncrementGap="0" docValues="true" precisionStep="0"/>
<fieldType name="longs" class="solr.TrieLongField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="0"/>
<fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="phonetic_en" class="solr.TextField" indexed="true" stored="false">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/>
</analyzer>
</fieldType>
<fieldType name="point" class="solr.PointType" subFieldSuffix="_d" dimension="2"/>
<fieldType name="random" class="solr.RandomSortField" indexed="true"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" docValues="true"/>
<fieldType name="strings" class="solr.StrField" sortMissingLast="true" docValues="true" multiValued="true"/>
<fieldType name="tdate" class="solr.TrieDateField" positionIncrementGap="0" docValues="true" precisionStep="6"/>
<fieldType name="tdates" class="solr.TrieDateField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="6"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" positionIncrementGap="0" docValues="true" precisionStep="8"/>
<fieldType name="tdoubles" class="solr.TrieDoubleField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="8"/>
<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_en_splitting" class="solr.TextField" autoGeneratePhraseQueries="true" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
<filter class="solr.WordDelimiterFilterFactory" catenateNumbers="1" generateNumberParts="1" splitOnCaseChange="1" generateWordParts="1" catenateAll="0" catenateWords="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
<filter class="solr.WordDelimiterFilterFactory" catenateNumbers="0" generateNumberParts="1" splitOnCaseChange="1" generateWordParts="1" catenateAll="0" catenateWords="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_en_splitting_tight" class="solr.TextField" autoGeneratePhraseQueries="true" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" expand="false" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
<filter class="solr.WordDelimiterFilterFactory" catenateNumbers="1" generateNumberParts="0" generateWordParts="0" catenateAll="0" catenateWords="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.EnglishMinimalStemFilterFactory"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_general_rev" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ReversedWildcardFilterFactory" maxPosQuestion="2" maxFractionAsterisk="0.33" maxPosAsterisk="3" withOriginal="true"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
</analyzer>
</fieldType>
<fieldType name="text_zh" class="solr.TextField">
<analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
</fieldType>
<fieldType name="tfloat" class="solr.TrieFloatField" positionIncrementGap="0" docValues="true" precisionStep="8"/>
<fieldType name="tfloats" class="solr.TrieFloatField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="8"/>
<fieldType name="tint" class="solr.TrieIntField" positionIncrementGap="0" docValues="true" precisionStep="8"/>
<fieldType name="tints" class="solr.TrieIntField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="8"/>
<fieldType name="tlong" class="solr.TrieLongField" positionIncrementGap="0" docValues="true" precisionStep="8"/>
<fieldType name="tlongs" class="solr.TrieLongField" positionIncrementGap="0" docValues="true" multiValued="true" precisionStep="8"/>
<field name="ARTICLEID" type="string" indexed="true" stored="true"/>
<field name="ARTICLESITE" type="text_zh" indexed="true" stored="true"/>
<field name="ARTICLESITEID" type="string" indexed="true" stored="true"/>
<field name="CLASSLYID" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="DATATYPE" type="string" indexed="true" stored="true"/>
<field name="FILEPATH" type="string" indexed="false" stored="true"/>
<field name="JZ" type="string" indexed="true" stored="true"/>
<field name="MUTISITE" type="text_zh" indexed="true" stored="true"/>
<field name="_version_" type="long" indexed="true" stored="false"/>
<field name="copy_cday" type="string" indexed="true" stored="false"/>
<field name="copy_chour" type="string" indexed="true" stored="false"/>
<field name="copy_cmonth" type="string" indexed="true" stored="false"/>
<field name="copy_cyear" type="string" indexed="true" stored="false"/>
<field name="copy_site" type="string" indexed="true" stored="false"/>
<field name="copy_source" type="string" indexed="true" stored="false"/>
<field name="copy_title" type="string" indexed="true" stored="false"/>
<field name="ismyattention" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="isread" type="int" indexed="true" stored="true"/>
<field name="isyj" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="keyword" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="krInfotype" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="krIslocal" type="int" indexed="true" stored="true"/>
<field name="krKeywordid" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="krState" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="krUid" type="string" multiValued="true" indexed="true" stored="true"/>
<field name="kvAbstract" type="text_zh" indexed="true" stored="true"/>
<field name="kvAuthor" type="text_zh" indexed="true" stored="true"/>
<field name="kvCollection" type="int" indexed="true" stored="true"/>
<field name="kvContent" type="text_zh" indexed="true" stored="true"/>
<field name="kvCtime" type="string" indexed="true" stored="true"/>
<field name="kvDkTime" type="string" indexed="true" stored="true"/>
<field name="kvISYJ" type="int" indexed="false" stored="true"/>
<field name="kvOrienLevel" type="int" indexed="true" stored="true"/>
<field name="kvOrientation" type="int" indexed="true" stored="true"/>
<field name="kvReply" type="int" indexed="true" stored="true"/>
<field name="kvSite" type="text_zh" indexed="true" stored="true"/>
<field name="kvSource" type="text_zh" indexed="true" stored="true"/>
<field name="kvSourcetype" type="int" indexed="true" stored="true"/>
<field name="kvState" type="string" indexed="true" stored="true"/>
<field name="kvTitle" type="text_zh" indexed="true" stored="true"/>
<field name="kvUrl" type="string" indexed="false" stored="true"/>
<field name="kvUserPic" type="string" indexed="false" stored="true"/>
<field name="kvUuid" type="string" indexed="true" stored="true"/>
<field name="kvVisitcount" type="int" indexed="true" stored="true"/>
<field name="retweetedStatusUrl" type="string" indexed="true" stored="true"/>
<field name="text" type="string" indexed="true" stored="true"/>
<field name="wechatInfoType" type="int" indexed="true" stored="true"/>
<dynamicField name="*_txt_en_split_tight" type="text_en_splitting_tight" indexed="true" stored="true"/>
<dynamicField name="*_descendent_path" type="descendent_path" indexed="true" stored="true"/>
<dynamicField name="*_ancestor_path" type="ancestor_path" indexed="true" stored="true"/>
<dynamicField name="*_txt_en_split" type="text_en_splitting" indexed="true" stored="true"/>
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false" useDocValuesAsStored="false"/>
<dynamicField name="ignored_*" type="ignored" multiValued="true"/>
<dynamicField name="*_txt_rev" type="text_general_rev" indexed="true" stored="true"/>
<dynamicField name="*_phon_en" type="phonetic_en" indexed="true" stored="true"/>
<dynamicField name="*_s_lower" type="lowercase" indexed="true" stored="true"/>
<dynamicField name="random_*" type="random"/>
<dynamicField name="*_txt_en" type="text_en" indexed="true" stored="true"/>
<dynamicField name="*_txt_zh" type="text_zh" indexed="true" stored="true"/>
<dynamicField name="*_point" type="point" indexed="true" stored="true"/>
<dynamicField name="*_srpt" type="location_rpt" indexed="true" stored="true"/>
<dynamicField name="*_tdts" type="tdates" indexed="true" stored="true"/>
<dynamicField name="attr_*" type="text_general" multiValued="true" indexed="true" stored="true"/>
<dynamicField name="*_txt" type="text_general" indexed="true" stored="true"/>
<dynamicField name="*_dts" type="date" multiValued="true" indexed="true" stored="true"/>
<dynamicField name="*_tis" type="tints" indexed="true" stored="true"/>
<dynamicField name="*_tls" type="tlongs" indexed="true" stored="true"/>
<dynamicField name="*_tfs" type="tfloats" indexed="true" stored="true"/>
<dynamicField name="*_tds" type="tdoubles" indexed="true" stored="true"/>
<dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/>
<dynamicField name="*_is" type="ints" indexed="true" stored="true"/>
<dynamicField name="*_ss" type="strings" indexed="true" stored="true"/>
<dynamicField name="*_ls" type="longs" indexed="true" stored="true"/>
<dynamicField name="*_bs" type="booleans" indexed="true" stored="true"/>
<dynamicField name="*_fs" type="floats" indexed="true" stored="true"/>
<dynamicField name="*_ds" type="doubles" indexed="true" stored="true"/>
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
<dynamicField name="*_ti" type="tint" indexed="true" stored="true"/>
<dynamicField name="*_tl" type="tlong" indexed="true" stored="true"/>
<dynamicField name="*_tf" type="tfloat" indexed="true" stored="true"/>
<dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/>
<dynamicField name="*_ws" type="text_ws" indexed="true" stored="true"/>
<dynamicField name="*_i" type="int" indexed="true" stored="true"/>
<dynamicField name="*_s" type="string" indexed="true" stored="true"/>
<dynamicField name="*_l" type="long" indexed="true" stored="true"/>
<dynamicField name="*_t" type="text_general" indexed="true" stored="true"/>
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
<dynamicField name="*_f" type="float" indexed="true" stored="true"/>
<dynamicField name="*_d" type="double" indexed="true" stored="true"/>
<dynamicField name="*_p" type="location" indexed="true" stored="true"/>
<dynamicField name="*_c" type="currency" indexed="true" stored="true"/>
<copyField source="kvSite" dest="copy_site"/>
<copyField source="kvSource" dest="copy_source"/>
<copyField source="kvTitle" dest="copy_title"/>
</schema>
啟動solrcloud
# # cd /data/solrcloud/solr/bin
./solr start -cloud -z 192.168.0.1:2181,192.168.0.2:2181 -p 8080
建立帶有三分片和1個副本的topic和chenfeng集合:
./solr create_collection -c topic -shards 3 -replicationFactor 1 -p 8080
./solr create_collection -c chenfeng -shards 3 -replicationFactor 1 -p 8080
進入cloud-scripts目錄並上傳配置檔案到zookeeper:
# cd /data/solrcloud/solr/server/scripts/cloud-scripts
# ./zkcli.sh -zkhost 192.168.0.1:2281,192.168.0.2:2181 -cmd upconfig -confdir /data/solrcloud/solr/server/solr/configsets/basic_configs/conf -confname topic
# ./zkcli.sh -zkhost 192.168.0.1:2281,192.168.0.2:2181 -cmd upconfig -confdir /data/solrcloud/solr/server/solr/configsets/basic_configs/conf -confname chenfeng
登陸zookeeper叢集檢視上傳的檔案:
# cd /data/solrcloud/zookeeper-3.4.10/bin
# ./zkCli.sh
Connecting to localhost:2181
2018-01-25 17:13:33,212 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
2018-01-25 17:13:33,216 [myid:] - INFO [main:Environment@100] - Client environment:host.name=<NA>
2018-01-25 17:13:33,216 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_161
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-3.b14.el6_9.x86_64/jre
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=/data/solrcloud/zookeeper-3.4.10/bin/../build/classes:/data/solrcloud/zookeeper-3.4.10/bin/../build/lib/*.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/slf4j-log4j12-1.6.1.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/slf4j-api-1.6.1.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/netty-3.10.5.Final.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/log4j-1.2.16.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/jline-0.9.94.jar:/data/solrcloud/zookeeper-3.4.10/bin/../zookeeper-3.4.10.jar:/data/solrcloud/zookeeper-3.4.10/bin/../src/java/lib/*.jar:/data/solrcloud/zookeeper-3.4.10/bin/../conf:
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64
2018-01-25 17:13:33,218 [myid:] - INFO [main:Environment@100] - Client environment:os.version=2.6.32-642.el6.x86_64
2018-01-25 17:13:33,219 [myid:] - INFO [main:Environment@100] - Client environment:user.name=root
2018-01-25 17:13:33,219 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/root
2018-01-25 17:13:33,219 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/data/solrcloud/zookeeper-3.4.10/bin
2018-01-25 17:13:33,220 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@277050dc
Welcome to ZooKeeper!
2018-01-25 17:13:33,240 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2018-01-25 17:13:33,297 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@876] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2018-01-25 17:13:33,305 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server localhost/0:0:0:0:0:0:0:1:2181, sessionid = 0x1612c33f9f2000a, negotiated timeout = 30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0] ls /configs
[topic, chenfeng]
[zk: localhost:2181(CONNECTED) 1] ls /configs/topic
[currency.xml, protwords.txt, managed-schema, solrconfig.xml, synonyms.txt, elevate.xml, stopwords.txt, lang, params.json]
[zk: localhost:2181(CONNECTED) 2] ls /configs/chenfeng
[currency.xml, protwords.txt, managed-schema, solrconfig.xml, synonyms.txt, elevate.xml, stopwords.txt, lang, params.json]
[zk: localhost:2181(CONNECTED) 3] quit
Quitting...
2018-01-25 17:13:51,512 [myid:] - INFO [main:ZooKeeper@684] - Session: 0x1612c33f9f2000a closed
2018-01-25 17:13:51,514 [myid:] - INFO [main-EventThread:ClientCnxn$EventThread@519] - EventThread shut down for session: 0x1612c33f9f2000a
檢視solr叢集頁面:
http://192.168.0.1:8080/solr/#/~collections/chenfeng
http://192.168.0.1:8080/solr/#/~collections/topic
在介面上點reload重新載入配置檔案,然後重新整理頁面。
至此solrcloud安裝完畢。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2150530/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 安裝Zookeeper和Kafka叢集Kafka
- Jetty的安裝、配置和使用Jetty
- Zookeeper-3.4.10 叢集的安裝配置
- 搭建kubernetes 叢集的安裝過程和方法
- CentOS上zookeeper叢集模式安裝配置CentOS模式
- Zookeeper 安裝和配置
- 安裝配置 zookeeper (單機非叢集模式)模式
- 3 安裝配置oracle叢集和RACOracle
- Nginx實現叢集的負載均衡配置過程詳解Nginx負載
- pycharm中安裝和使用sqlite過程詳解PyCharmSQLite
- CentOS6.5 安裝Zookeeper叢集CentOS
- hadoop叢集內lzo的安裝與配置Hadoop
- Jetty的配置、部署與API使用——(1)下載安裝JettyJettyAPI
- SQL Server 2005詳細安裝過程及配置SQLServer
- SQL Server 2000詳細安裝過程及配置SQLServer
- Zookeeper 在Windows下的安裝過程及測試Windows
- Git server安裝和配置GitServer
- ZooKeeper叢集安裝和部署
- RabbitMQ安裝過程詳解MQ
- WAS叢集安裝配置過程
- Jstorm叢集搭建過程/Jstorm叢集一鍵安裝部署JSORM
- FastDFS 叢集 安裝 配置AST
- 4 zookeeper叢集和基本命令
- linux下安裝zsh和p10k的詳細過程Linux
- Windows下Jekyll配置過程詳解Windows
- hbase和zookeeper的安裝和部署
- linux下搭建ZooKeeper叢集(偽叢集)Linux
- Solaris本地叢集VCS安裝過程(試用License)
- FreeBSD下安裝配置Hadoop叢集(三)Hadoop
- LumaQQ安裝過程詳解(轉)
- kafka和zookeeper安裝Kafka
- Zookeeper3.4.14(單叢集)、Kafka_2.12-2.2.2(叢集)安裝Kafka
- RAC安裝配置和使用過程的問題解決方法總結一
- RAC安裝配置和使用過程的問題解決方法總結二
- Webpack安裝配置及打包詳細過程Web
- hadoop叢集多節點安裝詳解Hadoop
- Zookeeper叢集 + Kafka叢集Kafka
- Linux下搭建ZooKeeper叢集Linux