Elasticsearch::Client::Direct::Cluster - A client for running cluster-level requests
version 0.75
This module provides methods to make cluster-level requests, such as getting and setting cluster-level settings, manually rerouting shards, and retrieving for monitoring purposes.
It does Elasticsearch::Role::Client::Direct.
health()
$response = $e->cluster->health( %qs_params )
The health() method is used to retrieve information about the cluster health, returning red, yellow or green to indicate the state of the cluster, indices or shards.
red
yellow
green
Query string parameters: level, local, master_timeout, timeout, wait_for_active_shards, wait_for_nodes, wait_for_relocating_shards, wait_for_status
level
local
master_timeout
timeout
wait_for_active_shards
wait_for_nodes
wait_for_relocating_shards
wait_for_status
See the cluster health docs for more information.
node_info()
$response = $e->cluster->node_info( node_id => $node_id | \@node_ids # optional );
The node_info() method returns static information about the nodes in the cluster, such as the configured maximum number of file handles, the maximum configured heap size or the threadpool settings.
Query string parameters: all, clear, http, jvm, network, os, plugin, process, settings, thread_pool, timeout, transport
all
clear
http
jvm
network
os
plugin
process
settings
thread_pool
transport
See the node_info docs for more information.
node_stats()
$response = $e->cluster->node_stats( node_id => $node_id | \@node_ids # optional );
The node_stats() method returns statistics about the nodes in the cluster, such as the number of currently open file handles, the current heap memory usage or the current number of threads in use.
Stats can be returned for all nodes, or limited to particular nodes with the node_id parameter. The indices_stats information can also be retrieved on a per-node basis with the node_stats() method:
node_id
$response = $e->cluster->node_stats( node_id => 'node_1', indices => 1, metric => 'docs' );
Query string parameters: all, clear, fields, fs, http, indices, jvm, network, os, process, thread_pool, transport
fields
fs
indices
See the node_stats docs for more information.
hot_threads()
$response = $e->cluster->hot_threads( node_id => $node_id | \@node_ids # optional )
The hot_threads() method is a useful tool for diagnosing busy nodes. It takes a snapshot of which threads are consuming the most CPU.
Query string parameters: interval, snapshots, threads, type
interval
snapshots
threads
type
See the hot_threads docs for more information.
get_settings()
$response = $e->cluster->get_settings()
The get_settings() method is used to retrieve cluster-wide settings that have been set with the "put_settings()" method.
See the cluster settings docs for more information.
put_settings()
$response = $e->cluster->put_settings( %settings );
The put_settings() method is used to set cluster-wide settings, either transiently (which don't survive restarts) or permanently (which do survive restarts).
For instance:
$response = $e->cluster->put_settings( body => { transient => { "discovery.zen.minimum_master_nodes" => 5 } } );
state()
$response = $e->cluster->state();
The state() method returns the current cluster state from the master node, or from the responding node if local is set to true.
true
Query string parameters: filter_blocks, filter_index_templates, filter_indices, filter_metadata, filter_nodes, filter_routing_table, local, master_timeout
filter_blocks
filter_index_templates
filter_indices
filter_metadata
filter_nodes
filter_routing_table
See the cluster state docs for more information.
reroute()
$e->cluster->reroute( body => { commands } # required );
The reroute() method is used to manually reallocate shards from one node to another. The body should contain the commands indicating which changes should be made. For instance:
body
commands
$e->cluster->reroute( body => { commands => [ { move => { index => 'test', shard => 0, from_node => 'node_1', to_node => 'node_2 }}, { allocate => { index => 'test', shard => 1, node => 'node_3' }} ] } );
Query string parameters: dry_run, filter_metadata
dry_run
See the reroute docs for more information.
shutdown()
$e->cluster->shutdown( node_id => $node_id | \@node_ids # optional );
The shutdown() method is used to shutdown one or more nodes, or the whole cluster.
Query string parameters: delay, exit
delay
exit
See the shutdown docs for more information.
Clinton Gormley <drtech@cpan.org>
This software is Copyright (c) 2013 by Elasticsearch BV.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Elasticsearch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Elasticsearch
CPAN shell
perl -MCPAN -e shell install Elasticsearch
For more information on module installation, please visit the detailed CPAN module installation guide.