CDH 中solrcloud 關於shard副本問題

version CDH5.4.4
the number of nodes:3
想實現個節點直接互相備份:node

命令:apache

      solrctl instancedir --create myCollection /home/test
      solrctl collection --create myCollection  -s 1 -r 2 (It was successful)
      
      but :solrctl collection --create myCollection  -s 3 -r 2:
      it is an error:Cannot create collection mycollection. Value of maxShardsPerNode is 1服務器

能夠看看官方這個帖子:https://community.cloudera.com/t5/Cloudera-Search-Apache-SolrCloud/Indexing-files-on-HDFS-using-solrcloud-on-cloudera-and-searching/td-p/30656curl

也能夠看官方文檔:http://wiki.apache.org/solr/SolrCloudide


其實 默認狀況下:每一個節點的最大分片是1(maxShardsPerNode=1),oop

可是咱們能夠:however, you can override this by overriding the value of the "maxShardsPerNode" parameter, as you did with the curl command. (即用過URL命令來實現)this


步驟:solrctl instancedir --create myCollection /home/testurl

能夠點開CDH的solrcloud管理界面:spa

http://hadoopnamenode:8983/solr/admin/collections?action=CREATE&name=myCollection&numShards=3&replicationFactor=3&maxShardsPerNode=3 
code

注意: 這裏是管理collection,因此用collections?

在node1上建立core,以下:

 'http://node1:8983/solr/admin/cores?action=CREATE&name=mycore&collection=collection1&shard=shard2'


而後用:solrctl  collection --list 發現咱們建立成功


注意:當咱們用cdh作分片備份的時候,創建collection的時候必須maxShardsPerNode大於1,好比這裏爲3,之後當一個服務器掛了,新添加的服務器,咱們才能用建立core的URL,若是使用默認的maxShardsPerNode=1,儘管建立成功,可是查詢的時候依然會失敗,當建立備份以後,新的core會自動複製索引。

相關文章
相關標籤/搜索