Altering the default shard allocation behavior
In Elasticsearch Server Second Edition, published by Packt Publishing, we talked about a number of things related to the shard allocation functionality provided by Elasticsearch. We discussed the Cluster Reroute API, shard rebalancing, and shard awareness. Although now very commonly used, these topics are very important if you want to be in full control of your Elasticsearch cluster. Because of that, we decided to extend the examples provided in Elasticsearch Server Second Edition and provide you with guidance on how to use Elasticsearch shards awareness and alter the default shard allocation mechanism.
Let's start with a simple example. We assume that we have a cluster built of four nodes that looks as follows:
As you can see, our cluster is built of four nodes. Each node was bound to a specific IP address, and each node was given the tag
property and a group
property (added to elasticsearch.yml
as node.tag
and node.group
properties). This cluster...