Recovering Elasticsearch 7 after power outage

In case you encounted power outage or just blindly pressed restart button on your machine, there is high chance you will have some issues with your cluster. Mine has only one node, so there is no redundancy. If I lose indices then data is gone. Fortunately starting Elasticsearch and having red indicators not necessarily means data lose. I recently went that path. Log says that primary shards was missing. In such case you need to check if there are those indices listed:

curl -s 'localhost:9200/_cat/indices?v'

With that command look for red statuses. Internal mechanisms have this delay rule, so check every minute if count decreases. If not then instead od “indices” write “allocations” and you may have some unassigned indices. Now you can try this one:

url -X PUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d'
{
    "transient" : {
        "cluster.routing.allocation.enable" : "all"
    }
}
'

It possible could re-enable allocation. Other failure factor could be low free space. You need to keep it above 15%. If you have more than one node, please check whether it is available and working.

WordPress Appliance - Powered by TurnKey Linux