美文网首页
Solr7中调用solrj给指定集合创建副本失败non lega

Solr7中调用solrj给指定集合创建副本失败non lega

作者: yuhan_sining | 来源:发表于2019-06-29 10:01 被阅读0次

【问题描述】

在solr7.7.1中调用solrj给指定集合创建副本

    private void addCore(CoreInfomation needTransferCore, HttpSolrClient HttpSolrClient,String collection)
            throws SolrServerException, IOException {
        Create req = new Create();
        String oldCoreName = needTransferCore.getCoreName();
        String newCoreName = oldCoreName + "_new";
        req.setCoreName(newCoreName);
        req.setInstanceDir(newCoreName);
        req.setCollection(collection);
        req.setShardId(needTransferCore.getShardName());

        log.info("begin to add core " + newCoreName + " to " + HttpSolrClient.getBaseURL());
        CoreAdminResponse coreAdminResponse = req.process(HttpSolrClient);
        log.info("addCoreResponse is : " + coreAdminResponse);
        if (0 != coreAdminResponse.getStatus()) {
            log.error("add core failed. exit and please check.");
            System.exit(1);
        }
    }

调用时,报如下错误:

org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://wkh183:8983/solr: Error CREATEing SolrCore 'coll4_shard1_0_0_replica_n7_new': non legacy mode coreNodeName missing {shard=shard1_0_0, collection=coll4}

【问题分析】

solr5时调用同样代码均无错误,估计是哪里的配置问题,因此只能寻找度娘的帮助。

最终查到了解决办法:
http://lucene.472066.n3.nabble.com/Migrating-from-Solr-6-X-to-Solr-7-X-quot-non-legacy-mode-coreNodeName-missing-quot-td4361128.html

You may have to set legacyCloud=true in your cluster properties. In
the Solr reference guide (7.0) there's a section "Changes to Default
Behaviors" that'll tell you a bit about that. Check your cluster
properties (top level znode in ZooKeeper).

参考《apache-solr-ref-guide-7.7》 P107,可以得知legacyCloud参数默认是false,如果一个replica在state.json中不存在时,replica将无法注册。
The legacyCloud parameter now defaults to false. If an entry for a replica does not exist in state.json, that replica will not get registered.

【问题解决】

因此,如果我们需要针对指定结合新增副本,那么我们需要在solr7中预置legacyCloud属性为true。
This may affect users who bring up replicas and they are automatically registered as a part of a shard. It is possible to fall back to the old behavior by setting the property legacyCloud=true, in the cluster properties using the following command:
./server/scripts/cloud-scripts/zkcli.sh -zkhost 127.0.0.1:2181 -cmd clusterprop -name
legacyCloud -val true

相关文章

  • Solr7中调用solrj给指定集合创建副本失败non lega

    【问题描述】 在solr7.7.1中调用solrj给指定集合创建副本 调用时,报如下错误: org.apache....

  • Chromium中Thread的创建

    在chromium中如何创建线程 创建线程对象后,可以调用Start,或者StartWithOptions指定创建...

  • Java反射 使用

    调用运行时类的指定结构 调用指定属性 调用指定的方法 创建运行时类对象 使用newInstance()来创建对象,...

  • 搜索学习--Solr全文搜索服务器的基本使用(二)——Sprin

    在上一篇搜索学习--Solr全文搜索服务器的基本使用(一)——SolrJ的使用中,我是直接使用的SolrJ来调用S...

  • 搭建MongoDB副本集&分片

    副本集 什么是副本集? 顾名思义,副本集是一个集合,即MongoDB实例的集合,集合中的每个成员拥有相同的数据集合...

  • Docker进阶-快速扩容

    1、命令方式 在创建好的Swarm集群中运行nginx服务,并使用--replicas参数指定启动的副本数。 或者...

  • mail

    -b<地址>:指定密件副本的收信人地址;-c<地址>:指定副本的收信人地址;-f<邮件文件>:读取指定邮件文件中的...

  • kafka-设计总结(上)

    整体架构 实现细节 队列创建 创建topic的时候指定分区(partition)的数量和副本的个数。 生产者发送 ...

  • map()函数 Python

    据提供的函数对指定序列做映射。把可迭代数据集合中每个元素调用function,返回值形成新的集合。 Referen...

  • 第十三篇:使用SolrJ管理集群

    1.在项目中使用SolrJ管理集群 使用步骤:第一步:把solrJ相关的jar包添加到工程中。第二步:创建一个So...

网友评论

      本文标题:Solr7中调用solrj给指定集合创建副本失败non lega

      本文链接:https://www.haomeiwen.com/subject/vxvucctx.html