# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/data/zookeeper
# the port at which the clients will connect
clientPort=2181
2、zookeeper服务启动
bin 目录下 执行zkServer.cmd/zkServer.sh
5、 启动solr
大家应该在之前配置standalone与master/salve形式的solr时,注意到了solr example示例中solr.xml文件中的<solrcloud>配置结点,其实在上述两种形式下,该配置结点并不会生效。《Apache Solr Reference Guide》中的描述如下:
This element defines several parameters that relate so SolrCloud. This section is ignored unless the solr instance is started with either -DzkRun or –DzkHost
可见只有指定-DzkRun 或 –DzkHost参数时,才能使solrCloud生效。
修改solr.xml文件如下:
ls /live_nodes
返回结果如下
如上所示,zookeeper已经检测到了该solr服务了。
6、 replia与shard配置
solr 是使用restful,基于restful的,没想到replia与shard配置也是都通过http来的,反正我没找到还可文件或者web界面配置的方式。
访问solr的地址,执行solrcloud的CREATE命令:
http://199.155.122.32:8080/solr/admin/collections?action=CREATE&name=mycollection&numShards=2&replicationFactor=2&maxShardsPerNode=3
结果提示创建不成功 This requires 4 shards to be created (higher than the allowed number)
说明我们的solr运行实例还是不够。
我采用同一台机器上开始两个tomcat的方式模拟两个solr运行实例,读者条件允许的话,可以使用多台机器。在同一台solr服务器上,另外复制一个tomcat 端口为8081,并复制另一个solrhome为,我保存为solrhome1,