Elasticsearch-Manager provides both a commandline utility and libraries for performing basic management activities on an Elasticsearch cluster.
For a list of all supported actions, please run: $ elasticsearch-manager --help
gem install elasticsearch-manager
$ elasticsearch-manager --cluster-hostname elasticsearch.example.com \
--port 9200 status \
list-nodes
10.0.0.3 -- master
10.0.0.1
10.0.0.2
$ elasticsearch-manager --cluster-hostname elasticsearch.example.com \
--port 9200 status \
shard-state
10.0.0.1: STARTED: 8 INITIALIZING: 0 RELOCATING: 0
10.0.0.2: STARTED: 8 INITIALIZING: 0 RELOCATING: 1
10.0.0.3: STARTED: 7 INITIALIZING: 1 RELOCATING: 0
$ elasticsearch-manager --cluster-hostname elasticsearch.example.com \
--port 9200 status \
status
The Elasticsearch cluster is currently: green
$ elasticsearch-manager --hostname localhost \
--port 9200 \
restart-node
If using a dns name, confirm that the dns resolves to a single host. If a record that references a load balancer is used, the behavior of this command is undefined.
$ elasticsearch-manager --cluster-hostname elasticsearch.example.com \
--port 9200 status \
rolling-restart
Continue with rolling restart of cluster? (y/n) y
Restarting Elasticsearch on node: 10.0.0.1
Elasticsearch restarted on node: 10.0.0.1
Waiting for node to become available...
Node back up!
Waiting for cluster to stabilize...
Waiting for cluster to stabilize...
Cluster stabilized!
Continue with rolling restart of cluster? (y/n) y
Restarting Elasticsearch on node: 10.0.0.2
Elasticsearch restarted on node: 10.0.0.2
Waiting for node to become available...
Waiting for node to become available...
Node back up!
Waiting for cluster to stabilize...
Waiting for cluster to stabilize...
Waiting for cluster to stabilize...
Waiting for cluster to stabilize...
Cluster stabilized!
Restarting current cluster master, continue? (y/n) y
Restarting Elasticsearch on node: 10.0.0.3
Elasticsearch restarted on node: 10.0.0.3
Waiting for node to become available...
Waiting for node to become available...
Waiting for node to become available...
Waiting for node to become available...
Node back up!
Waiting for cluster to stabilize...
Cluster stabilized!
$ elasticsearch-manager --cluster-hostname elasticsearch.example.com \
--port 9200 status \
disable-routing
Disabling shard routing allocation... disabled!
$ elasticsearch-manager --cluster-hostname elasticsearch.example.com \
--port 9200 status \
enable-routing
Enabling shard routing allocation... enabled!