solr数据分片相关

solr操作url

使用正常的core,使用命令生成coillection

solr create_collection -c students2 -d ../server/solr/my/conf -shards 2 -replicationFactor 2  -router implicit  -routerField name
## 等价于调用以下url
http://localhost:8081/solr/admin/collections?action=CREATE&name=students&numShards=2&replicationFactor=2&maxShardsPerNode=2&collection.configName=students

1:所有shard上查询数据
http://localhost:8081/solr/mycollection/select?q=*%3A*
2:指定shard查询数据
http://localhost:8081/solr/mycollection/select?q=*%3A*&shard=shard1
3:当shard没有启动时,为了能正常查询需如下:
http://localhost:8081/solr/mycollection/select?q=*%3A*&shards.tolerant=true
4:添加集合
http://localhost:8081/solr/admin/collections?action=CREATE&name=mycollection&numShards=2&replicationFactor=2
参数名 说明
Name 要创建的集合名称
numShards 指定集合Shard的数量
replicationFactor 指定每个Shard副本数量
maxShardsPerNode 每个Solr服务器节点上最大Shard数量
5:删除集合
http://localhost:8081/solr/admin/collections?action=DELETE&name=mycollection
6:重新加载
http://localhost:8081/solr/admin/collections?action=RELOAD&name=mycollection

原文地址:https://www.cnblogs.com/faunjoe88/p/7127931.html