zoukankan      html  css  js  c++  java
  • solr 创建指定路由的collection

    1.登录solr其中一个实例所在的主机

    2.生成配置文件
    $ solrctl instancedir --generate $HOME/solr_configs
    修改solrconfig.xml 和 schema.xml
    3.上传配置到zk
    $ solrctl instancedir --create <collection_name> $HOME/solr_configs
    查看
    $ solrctl instancedir --list
    4.创建collections

    隐式路由
    $ solrctl collection --create <collection_name> -s <shard_count> -r <replica_count> -m <count>

    solrctl instancedir --generate $HOME/suggest
    solrctl instancedir --create suggest $HOME/suggest
    solrctl collection --create suggest -s 2 -r 2 -m 2
    solrctl instancedir --update suggest  $HOME/suggest
    solrctl collection --reload suggest
    

      

    或者:

    显式路由的

    http://10.90.16.156:8983/solr/admin/collections?action=CREATE&name=goods&router.name=implicit&shards=shard1&replicationFactor=2&router.field=category&maxShardsPerNode=2

    maxShardsPerNode默认为1,需要根据实际情况调整,如果只有2台服务器,那么会出现如下错误:

      <?xml version="1.0" encoding="UTF-8" ?> 
     <response>
     <lst name="responseHeader">
      <int name="status">400</int> 
      <int name="QTime">25</int> 
      </lst>
      <str name="Operation createshard caused exception:">org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Cannot create collection goods. No live Solr-instances</str> 
     <lst name="exception">
      <str name="msg">Cannot create collection goods. No live Solr-instances</str> 
      <int name="rspCode">400</int> 
      </lst>
     <lst name="error">
     <lst name="metadata">
      <str name="error-class">org.apache.solr.common.SolrException</str> 
      <str name="root-error-class">org.apache.solr.common.SolrException</str> 
      </lst>
      <str name="msg">Cannot create collection goods. No live Solr-instances</str> 
      <int name="code">400</int> 
      </lst>
      </response>

    5.增加shard

    http://10.90.16.156:8983/solr/admin/collections?action=CREATESHARD&shard=shard2&collection=goods&replicationFactor=2

  • 相关阅读:
    js异步编程思想【node的精华】
    python偏函数
    软工划水日报-安卓端侧部署(1) 4/23
    软工划水日报-模型预测 4/22
    软工划水日报-《构建之法》阅读笔记SONO.5 4/21
    软工划水日报-paddle模型训练(3) 4/20
    软工划水日报-paddle模型训练(2) 4/19
    软工划水日报-paddle模型训练(1) 4/18
    软工划水日报-CUDA下载与安装 4/17
    软工划水日报-AIchallager数据集下载及处理 4/16
  • 原文地址:https://www.cnblogs.com/treehesoft/p/7773434.html
Copyright © 2011-2022 走看看