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

Before you dig into reading this guide, have you tried asking OpsGPT what this log means? You’ll receive a customized analysis of your log.

Try OpsGPT now for step-by-step guidance and tailored insights into your Elasticsearch operation.

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.

For a complete solution to your to your search operation, try for free AutoOps for Elasticsearch & OpenSearch . With AutoOps and Opster’s proactive support, you don’t have to worry about your search operation – we take charge of it. Get improved performance & stability with less hardware.

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?