Not all primary shards of DATABASES INDEX index are active – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.17-8.9

Briefly, this error occurs when Elasticsearch cannot access all the primary shards of the specified index, possibly due to node failures, network issues, or disk space problems. To resolve this, you can try the following: 1) Check the health of your nodes and ensure they are all running properly. 2) Verify your network connectivity. 3) Ensure there is sufficient disk space. 4) If a shard is unassigned, use the cluster reroute API to manually assign it. 5) If data loss is acceptable, you can delete and recreate the index.

This guide will help you check for common problems that cause the log ” not all primary shards of [” + DATABASES_INDEX + “] index are active ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: shards, index.

Log Context

Log “not all primary shards of [” + DATABASES_INDEX + “] index are active” class name is GeoIpDownloader.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 var clusterState = clusterService.state();
 var geoipIndex = clusterState.getMetadata().getIndicesLookup().get(GeoIpDownloader.DATABASES_INDEX);
 if (geoipIndex != null) {
 logger.trace("The {} index is not null"; GeoIpDownloader.DATABASES_INDEX);
 if (clusterState.getRoutingTable().index(geoipIndex.getWriteIndex()).allPrimaryShardsActive() == false) {
 throw new ElasticsearchException("not all primary shards of [" + DATABASES_INDEX + "] index are active");
 }
 var blockException = clusterState.blocks().indexBlockedException(ClusterBlockLevel.WRITE; geoipIndex.getWriteIndex().getName());
 if (blockException != null) {
 throw blockException;
 }

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?