How to Split solr shard in solr cloud

2019-04-12 23:06发布

问题:

I am using solr 4.10.3 in solrCloud mode. I have one shard and 3 replica. external zookeeper ensemble in being used. My document in one index has been increase too much. Now I want to create more shards. I tries to use

http://localhost:8983/solr/admin/collections?action=SPLITSHARD&collection=collection1&shard=shard1

But it gives following error

Error executing split operation for collection: collection1 parent shard: shard1
java.lang.NullPointerException
    at org.apache.solr.cloud.OverseerCollectionProcessor.splitShard(OverseerCollectionProcessor.java:1288)
    at org.apache.solr.cloud.OverseerCollectionProcessor.processMessage(OverseerCollectionProcessor.java:563)
    at org.apache.solr.cloud.OverseerCollectionProcessor$Runner.run(OverseerCollectionProcessor.java:2629)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Collection: collection1 operation: splitshard failed:org.apache.solr.common.SolrException
    at org.apache.solr.cloud.OverseerCollectionProcessor.splitShard(OverseerCollectionProcessor.java:1569)
    at org.apache.solr.cloud.OverseerCollectionProcessor.processMessage(OverseerCollectionProcessor.java:563)
    at org.apache.solr.cloud.OverseerCollectionProcessor$Runner.run(OverseerCollectionProcessor.java:2629)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
    at org.apache.solr.cloud.OverseerCollectionProcessor.splitShard(OverseerCollectionProcessor.java:1288)
null:org.apache.solr.common.SolrException
null:org.apache.solr.common.SolrException
    at org.apache.solr.handler.admin.CollectionsHandler.handleResponse(CollectionsHandler.java:364)
    at org.apache.solr.handler.admin.CollectionsHandler.handleSplitShardAction(CollectionsHandler.java:606)
    at org.apache.solr.handler.admin.CollectionsHandler.handleRequestBody(CollectionsHandler.java:172)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)

Where is the problem and what is its soultion?

回答1:

The property SPLITSHARD can only be used when you have defined -DnumShards=(some value) when you start you cluster first time.