缘来似你 发表于 2015-9-7 11:06:36

更新solrcloud+zookeeper的配置文件,要reload collection

  1、用的lib下的solr-core-4.3.1jar中的ZkCLI工具,命令在solr(web发布的)同级目录下运行。
  (1)upconfig 更新配置文件命令
  java -classpath ./solr/WEB-INF/lib/*org.apache.solr.cloud.ZkCLI       -cmd upconfig       -zkhost zk1:2181,zk2:2181,zk3:2181         -confdir./updateConf       -confname myConf
  其中,updateConf要更新的配置文件的父目录,myConf是集群上的配置文件的父目录
  (2)putfile上传单个文件命令
  java -classpath ./solr/WEB-INF/lib/*org.apache.solr.cloud.ZkCLI         -zkhostzk1:2181,zk2:2181,zk3:2181          -cmd putfile         /conf/schema.prefixTips.xml               example-shard1/solr/conf/schema.prefixTips.xml
其中,前者参数是zk集群上的存储路径,后者参数是要上传文件的本地路径;如果zk集群中该文件存在则会报错,不能覆盖。

  2、更新zookeeper集群的配置文件后,需要用命令reload,否则solr服务器实例还是用的原来那一套配置文件。
  The RELOAD action is used when you have changed a configuration in ZooKeeper.

  /admin/collections?action=RELOAD&name= name

  http://10.0.1.6:9090/solr/admin/collections?action=RELOAD&name=newCollection
  返回结果:
  

<response>
<lstname=&quot;responseHeader&quot;>
    <int name=&quot;status&quot;>0</int>
    <int name=&quot;QTime&quot;>1551</int>
</lst>
<lstname=&quot;success&quot;>
    <lstname=&quot;10.0.1.6:9090_solr&quot;>
      <lstname=&quot;responseHeader&quot;>
      <int name=&quot;status&quot;>0</int>
      <int name=&quot;QTime&quot;>761</int>
      </lst>
    </lst>
    <lstname=&quot;10.0.1.4:9090_solr&quot;>
      <lstname=&quot;responseHeader&quot;>
      <int name=&quot;status&quot;>0</int>
      <int name=&quot;QTime&quot;>1527</int>
      </lst>
    </lst>
</lst>
</response>
  
  

  
页: [1]
查看完整版本: 更新solrcloud+zookeeper的配置文件,要reload collection