SolrCloud 动态扩容方案
1:改变id的hash策略
使用 implicit 路由,参加: http://www.cnblogs.com/rcfeng/p/4287031.html
当没有匹配的shards时, 数据将会集中到一个shard
http://172.28.4.83:11060/solr/post_shard2_replica1/select?q=*%3A*&shards.info=true&shards.tolerant=true&shards=http://172.28.4.83:11050/solr/post_shard1_replica1
http://172.28.4.83:11060/solr/post_shard2_replica1/select?q=*%3A*&shards.info=true&shards.tolerant=true&shards=http://172.28.4.84:11090/solr/post_shard2_replica2
http://172.28.4.83:11060/solr/post_shard2_replica1/select?q=*%3A*&shards.info=true&shards.tolerant=true&shards=http://172.28.4.83:11040/solr/post_shard3_replica1
2:更改别名
collection2 500---1000万
alias:collection{collection1,collection2}
collection3 1000---1500万
alias:collection{collection1,collection2,collection3}
3:增加shard及拆分shard
发现问题:在内存溢出时, 无法继续,新增的shards一直处于construction状态,使用delete shards命令删不掉:
解决办法:
使用CoreAdmin API 去UNLOAD,注意不能使用 Collections API 去调用
http://172.28.4.83:11070/solr/admin/cores?action=REQUESTSTATUS&requestid=3
http://172.28.4.83:11010/solr/admin/collections?action=DELETESHARD&shard=shard1_0&collection=common
4:重建索引