elasticsearch-equilibrium

Shard allocation plugin for ElasticSearch

License

License

Categories

Categories

Search Business Logic Libraries Elasticsearch
GroupId

GroupId

com.sonian
ArtifactId

ArtifactId

elasticsearch-equilibrium
Last Version

Last Version

0.20.0
Release Date

Release Date

Type

Type

jar
Description

Description

elasticsearch-equilibrium
Shard allocation plugin for ElasticSearch
Project URL

Project URL

http://github.com/sonian/elasticsearch-equilibrium
Source Code Management

Source Code Management

http://github.com/sonian/elasticsearch-equilibrium

Download elasticsearch-equilibrium

How to add to project

<!-- https://jarcasting.com/artifacts/com.sonian/elasticsearch-equilibrium/ -->
<dependency>
    <groupId>com.sonian</groupId>
    <artifactId>elasticsearch-equilibrium</artifactId>
    <version>0.20.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.sonian/elasticsearch-equilibrium/
implementation 'com.sonian:elasticsearch-equilibrium:0.20.0'
// https://jarcasting.com/artifacts/com.sonian/elasticsearch-equilibrium/
implementation ("com.sonian:elasticsearch-equilibrium:0.20.0")
'com.sonian:elasticsearch-equilibrium:jar:0.20.0'
<dependency org="com.sonian" name="elasticsearch-equilibrium" rev="0.20.0">
  <artifact name="elasticsearch-equilibrium" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.sonian', module='elasticsearch-equilibrium', version='0.20.0')
)
libraryDependencies += "com.sonian" % "elasticsearch-equilibrium" % "0.20.0"
[com.sonian/elasticsearch-equilibrium "0.20.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.elasticsearch : elasticsearch jar 0.20.2

runtime (1)

Group / Artifact Type Version
log4j : log4j Optional jar 1.2.16

test (5)

Group / Artifact Type Version
com.sonian » elasticsearch-test-helper jar 0.19.0
org.testng : testng jar 6.3.1
org.hamcrest : hamcrest-core jar 1.3.RC2
org.hamcrest : hamcrest-library jar 1.3.RC2
org.easymock : easymock jar 3.1

Project Modules

There are no modules declared in this project.

Elasticsearch Equilibrium

Why not?

Because in Elasticsearch 0.90.4 a new disk-based shard allocator was added. If you are running a version of Elasticsearch greater than 0.90.4, then you should use that instead.

Why?

Depending on how you have ES nodes allocated across the system, and the way the your data goes across indices, it is possible to end up with a cluster that is weighted (in terms of disk) towards certain physical nodes. ES-equilibrium was created to ensure that the disk limit wasn't accidentally reached when creating new shards, and to allow the ability to balance disk usage across nodes in the cluster.

A good rule of thumb is: If you don't know whether you need this, you probably don't need it.

Installation

The elasticsearch-equilibrium plugin can be installed as any other ES plugin using bin/plugin utility:

% bin/plugin -url https://oss-es-plugins.s3.amazonaws.com/elasticsearch-equilibrium/elasticsearch-equilibrium-0.90.0.zip -install elasticsearch-equilibrium-0.90.0

In elasticsearch.yml:

sonian.elasticsearch.equilibrium:
  enabled: true
  minimumAvailablePercentage: 20.0
  minimumSwapDifferencePercentage: 5.0
  minimumSwapShardRelativeDifferencePercentage: 75.0

This plugin currently keeps ES from allocating shards to a node with less than minimumAvailablePercentage percentage available disk space on the ES data mount points.

minimumAvailablePercentage

If a node goes beneath this amount of free disk space percentage, no more shards will be relocated or assigned to this node. Defaults to 20.0%

minimumSwapDifferencePercentage

If two nodes have a percentage difference of at least this amount in used disk space, a shard swap will be initiated. Defaults to 5.0%

minimumSwapShardRelativeDifferencePercentage

Minimum difference in percentage between two shards to consider them viable for swapping. For example, if set to 50.0%, the smaller shard must be <= 50% the size of the largest shard candidate for swapping. Defaults to 75.0%

Manual rebalancing

% curl -s "http://localhost:9200/_rebalance"

Manual rebalancing looks through the cluster to discover the node with the highest disk usage (as a percentage), and the node with the lowers disk usage (also as a percentage). It then finds the largest shard on the largest node and swaps it with the smallest shard on the smallest node.

In this way, disk usage that may be uneven across a cluster can be evened out.

Note: this should only be done under supervision of someone that knows what they are doing, and only one rebalance should be run at a time. Wait for the rebalance to finish before starting another.

Notes

Note that elasticsearch-equilibrium will fail open in the event a nodeFsStats request times out.

POM

If you need to add elasticsearch-equilibrium to your pom.xml (for some reason), you can use:

<dependency>
  <groupId>com.sonian</groupId>
  <artifactId>elasticsearch-equilibrium</artifactId>
  <version>0.90.0</version>
</dependency>

Licence

Copyright 2012 Lee Hinman & Sonian

Released under the Apache License, 2.0. See LICENSE.txt

com.sonian

Sonian

Versions

Version
0.20.0
0.19.4