Skip to content

Instantly share code, notes, and snippets.

@janhoy
Created March 4, 2021 13:12
Show Gist options
  • Save janhoy/2b1cd85756ad06d1dd39cc357a701c9b to your computer and use it in GitHub Desktop.
Save janhoy/2b1cd85756ad06d1dd39cc357a701c9b to your computer and use it in GitHub Desktop.
Splitting a shard in Solr

Splitting a shard in Solr

  1. Split the old shard [1] This will split the shard in two on the existing node. Note you need enough disk space.

     https://solr1/admin/collections?action=SPLITSHARD&collection=name&shard=shardID&async=9999
    
  2. Poll for completion [2]

     https://solr1/admin/collections?action=REQUESTSTATUS&requestid=9999
    
  3. Move one of the replicas to the other host (solr2) [3]

     https://solr1/admin/collections?action=MOVEREPLICA&collection=name&shard=shardID&replica=replicaID&sourceNode=solr1:8983_solr&targetNode=solr2:8983_solr&async=8888
    
  4. Poll for completion [2]

     https://solr1/admin/collections?action=REQUESTSTATUS&requestid=8888
    
  5. Remove old, inactive replica [4]

     https://solr1/admin/collections?action=DELETEREPLICA&collection=name&shard=shardID&replica=replicaID
    

[1] https://solr.apache.org/guide/8_4/shard-management.html#splitshard
[2] https://solr.apache.org/guide/8_4/collections-api.html#requeststatus
[3] https://solr.apache.org/guide/8_4/replica-management.html#movereplica
[4] https://solr.apache.org/guide/8_4/replica-management.html#deletereplica

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment