【solr】【zookeeper】win10下solr7.2.1+tomcat9.0.33+zookeeper3.5.6集群

1、安装包等工具:

solr7.2.1下载地址:http://archive.apache.org/dist/lucene/solr/7.2.1/solr-7.2.1.zip

tomcat9.0.33下载地址:http://mirrors.hust.edu.cn/apache/tomcat/tomcat-9/v9.0.33/bin/apache-tomcat-9.0.33-windows-x64.zip

zookeeper3.5.6下载地址:https://archive.apache.org/dist/zookeeper/zookeeper-3.5.6/apache-zookeeper-3.5.6-bin.tar.gz

solr分词器ik-analyzer-solr8.3.0下载地址:https://search.maven.org/remotecontent?filepath=com/github/magese/ik-analyzer/8.3.0/ik-analyzer-8.3.0.jar

分词类型

<!-- 分词类型 -->
<fieldType name="text_ik" class="solr.TextField">
  <analyzer type="index">
    <tokenizer class="org.wltea.analyzer.lucene.IKTokenizerFactory" conf="ik.conf" useSmart="false"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="org.wltea.analyzer.lucene.IKTokenizerFactory" conf="ik.conf" useSmart="false"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

2、搭建zookeeper并且开启

 

tickTime=2000
initLimit=10
syncLimit=5
dataDir=D:\test\zookeeper\apache-zookeeper-3.5.6-bin\data
clientPort=2181


server.1=localhost:2888:3888
server.2=localhost:2889:3889
server.3=localhost:2890:3890
dataLogDir=D:\test\zookeeper\apache-zookeeper-3.5.6-bin\logs

 

 

 

 

 

 

 

 启动一个时会报错,是因为还没有全部启动

 

 

3、配置solr+tomcat

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4、集群配置

 

 

 

 

zkcli.bat -zkhost 127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183 -cmd upconfig -confdir D:	estsolrhomecloudhomeconf -confname myconf

 

 

 

 

set JAVA_OPTS=-Dbootstrap_confdir=D:	estsolrhomecloudhome -Dcollection.configName=clusterconf -DzkRun -DzkHost=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183 -DnumShards=2

set JAVA_OPTS= -DzkHost=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183

 

 

<str name="zkHost">127.0.0.1:2181</str>

 

 

 

 

 

 

 

 

至此集群部署完成,然后每个solrhhome的配置文件是可以删除的,集群是读取cloudhome,这里的配置是单机的时候读取。

 

5、分词,先停止3个tomcat

 

 

 

 

再重新启动tomcat

 

 

参考文章:https://www.cnblogs.com/Lxiaojiang/p/6756616.html

原文地址:https://www.cnblogs.com/xiaostudy/p/12743958.html