Skip to content

This python CLI program helps assigning shards in the nodes when a full cluster restart causes unassigments in the shards

License

Notifications You must be signed in to change notification settings

mtenrero/elastic-relocation-recovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elastic Cluster Unassgined Recovery

When you've performed or suffered a full cluster restart, it's probably many shards were set as unassigned because of CLUSTER_RECOVERED. This can be fixed with primary shard relocation, but this task can be turned tedious if you have a lot of shards to reallocate.

In my case, I had 400+ shards to reallocate, so I've created this Command Line Interface program in order to help in this task.

How it works

It's quite simply, you need to provide your ElasticSearch endpoint and that's all!.

The program will query the _cluster allocation REST in order to achieve the unassignment problems and it will try to solve it initilizing the primary shard to the first node which haves a copy on it.

IT WILL BE PERFORMED WITH THE POSSIBILTY OF LOSING DATA As the shard may be staled and we can't be sure which replica is the newest.

Program Arguments

  • -e/--endpoint http://<elastic_endpoint>:9200 URL of ElasticSearch instance
  • -f/--force delete unnasignable indexes
python Main.py --environment http://<elastic_endpoint>:9200

Getting dependencies

pipenv install
pipenv shell

And then run the Main.py file with arguments

About

This python CLI program helps assigning shards in the nodes when a full cluster restart causes unassigments in the shards

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages