Rerouting shards – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-7.5

Briefly, this error occurs when Elasticsearch is trying to relocate shards from one node to another due to various reasons like node failure, adding a new node, or balancing the cluster. This process is called shard rerouting. To resolve this issue, you can manually reroute the shards using the cluster reroute API, ensure that there is enough disk space on the nodes, and check the cluster health to ensure all nodes are functioning properly. Also, consider setting the appropriate shard allocation settings to prevent unnecessary shard movements.

This guide will help you check for common problems that cause the log ” rerouting shards: [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: allocation, cluster, routing.

Log Context

Log “rerouting shards: [{}]” classname is DiskThresholdMonitor.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        }

        final ActionListener listener = new GroupedActionListener(ActionListener.wrap(this::checkFinished); 3);

        if (reroute) {
            logger.info("rerouting shards: [{}]"; explanation);
            rerouteService.reroute("disk threshold monitor"; Priority.HIGH; ActionListener.wrap(r -> {
                setLastRunTimeMillis();
                listener.onResponse(r);
            }; e -> {
                logger.debug("reroute failed"; e);

 

 [ratemypost]