【问题标题】:Solrcloud delete collection bug?Solrcloud 删除集合错误?
【发布时间】:2015-02-19 02:17:57
【问题描述】:

首先,我创建一个名为usercollection的集合:

http://xxxxx/solr/admin/collections?action=CREATE&name=usercollection&numShards=3&replicationFactor=3&maxShardsPerNode=3

然后我发现有问题,所以我把它删除了。

 http://xxxx/solr/admin/collections?action=DELETE&name=usercollection

最后,我想再次创建集合。而且我发现了一些问题。

`May 16, 2013 8:32:23 PM org.apache.solr.cloud.OverseerCollectionProcessor run
 INFO: Overseer Collection Processor: Get the message id:/overseer/collection-queue-    work/qn-0000000000 message:{
"operation":"createcollection",
"numShards":"3",
"maxShardsPerNode":"3",
"createNodeSet":null,
"name":"usercollection",
"replicationFactor":"3"}
May 16, 2013 8:32:23 PM org.apache.solr.common.SolrException log
SEVERE: Collection createcollection of createcollection           failed:org.apache.solr.common.SolrException: collection already exists: usercollection
    at org.apache.solr.cloud.OverseerCollectionProcessor.createCollection(OverseerCollectionProcessor.java:311)
    at org.apache.solr.cloud.OverseerCollectionProcessor.processMessage(OverseerCollectionProcessor.java:160)
    at org.apache.solr.cloud.OverseerCollectionProcessor.run(OverseerCollectionProcessor.java:112)
    at java.lang.Thread.run(Thread.java:662)`

所以,我认为删除时集合API有问题。因此,我怎样才能真正删除一个集合?

【问题讨论】:

  • 您使用哪个版本的 Solr,当您删除集合时,您会从日志中得到什么?

标签: solr solrj apache-zookeeper solr4 solrcloud


【解决方案1】:

遇到了同样的问题,最终通过使用 Solr 提供的 zkcli.sh 在 Zookeeper 中手动编辑和更新 clusterstate.json 来解决。

  1. 下载clusterstate.json:

    zkcli.sh -z zk-host-name -cmd getfile /clusterstate.json clusterstateLoca.json

  2. 编辑下载的clusterstateLocal.json,删除已删除集合的节点,将clusterstateLocal.json保存到本地。

  3. 从 ZK 中移除陈旧的 clusterstate.json

    zkcli.sh -z zk-host-name -cmd clear /clusterstate.json

  4. 将修改后的clusterstate.json上传到ZK:

    zkcli.sh -z zk-host-name -cmd putfile /clusterstate.json ./clusterstateLocal.json

【讨论】:

    【解决方案2】:

    删除集合后,您还应该提交(如果使用浏览器,您可以在不使用 curl 的情况下执行相同操作)

    curl http://localhost:8080/solr/update -H "Content-type: text/xml" --data-binary '<commit />'
    

    ...此时告诉 Solr 优化它的索引也是一个好主意:

    curl http://localhost:8080/solr/update -H "Content-type: text/xml" --data-binary '<optimize />'
    

    来源http://www.alphadevx.com/a/365-Clearing-a-Solr-search-index

    【讨论】:

      【解决方案3】:

      您需要更新 zookeeper ensemble 中的 clusterstate.json 文件。您的云收藏信息保存在那里。

      【讨论】:

        猜你喜欢
        • 2015-01-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多