Showing posts with label Elasticsearch. Show all posts
Showing posts with label Elasticsearch. Show all posts

Wednesday, March 12, 2014

Install Bigdesk Plugin for elasticsearch.

Bigdesk




        Live charts and statistics for elasticsearch cluster.

        This plugin works only for elasticsearch 1.0.0 or higher:
  • Go to elastic search home directory: 
  • Generally ES_HOME is /usr/share/elasticsearch
    cd  /usr/share/elasticsearch  
                                                                                                                            
  • Navigate to the node installation folder and run the following command: 
  • $  ./bin/plugin -install lukas-vlcek/bigdesk                                                                                                     
  • To install a specific version (for example 2.4.0) run: 
  • $  ./bin/plugin -install lukas-vlcek/bigdesk/2.4.0                                                                                                
  • Then you can navigate your web browser to http://<elasticsearch_REST_endpoint>/_plugin/bigdesk/

  • for example in case of localhost:

    http://localhost:9200/_plugin/bigdesk/#cluster
             









     

Tuesday, March 11, 2014

Nodes shutdown commands in elasticsearch.

nodes shutdown

The nodes shutdown API allows to shutdown one or more (or all) nodes in the cluster. Here is an example of shutting the _local node the request is directed to:
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown'
Specific node(s) can be shutdown as well using their respective node ids (or other selective options as explained here .):
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/nodeId1,nodeId2/_shutdown'
The master (of the cluster) can also be shutdown using:
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_master/_shutdown'
Finally, all nodes can be shutdown using one of the options below:
$ curl -XPOST 'http://localhost:9200/_shutdown'

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_shutdown'

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_all/_shutdown'

delay

By default, the shutdown will be executed after a 1 second delay (1s). The delay can be customized by setting the delay parameter in a time value format. For example:
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown?delay=10s'

disable shutdown

The shutdown API can be disabled by setting action.disable_shutdown in the node configuration.

cluster health in elasticsearch

cluster health

The cluster health API allows to get a very simple status on the health of the cluster.
$ curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'
{
  "cluster_name" : "testcluster",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 2,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 5,
  "active_shards" : 10,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0
}
The API can also be executed against one or more indices to get just the specified indices health:
$ curl -XGET 'http://localhost:9200/_cluster/health/test1,test2'
The cluster health status is: greenyellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
One of the main benefits of the API is the ability to wait until the cluster reaches a certain high water-mark health level. For example, the following will wait for 50 seconds for the cluster to reach the yellow level (if it reaches the green or yellow status before 50 seconds elapse, it will return at that point):
$ curl -XGET 'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=50s'

request parameters

The cluster health API accepts the following request parameters:
level
Can be one of clusterindices or shards. Controls the details level of the health information returned. Defaults to cluster.
wait_for_status
One of greenyellow or red. Will wait (until the timeout provided) until the status of the cluster changes to the one provided. By default, will not wait for any status.
wait_for_relocating_shards
A number controlling to how many relocating shards to wait for. Usually will be 0 to indicate to wait till all relocation have happened. Defaults to not to wait.
wait_for_nodes
The request waits until the specified number N of nodes is available. It also accepts >=N<=N>N and <N. Alternatively, it is possible to use ge(N)le(N)gt(N) and lt(N)notation.
timeout
A time based parameter controlling how long to wait if one of the wait_for_XXX are provided. Defaults to 30s.
The following is an example of getting the cluster health at the shards level:
$ curl -XGET 'http://localhost:9200/_cluster/health/twitter?level=shards'
Ref: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-health.html

Nodes info in elasticsearch

nodes info

The cluster nodes info API allows to retrieve one or more (or all) of the cluster nodes information.
curl -XGET 'http://localhost:9200/_nodes'
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2'
The first command retrieves information of all the nodes in the cluster. The second command selectively retrieves nodes information of only nodeId1 and nodeId2. All the nodes selective options are explained here.
By default, it just returns all attributes and core settings for a node. It also allows to get only information on settingsosprocessjvmthread_poolnetworktransporthttpand plugins:
curl -XGET 'http://localhost:9200/_nodes/process'
curl -XGET 'http://localhost:9200/_nodes/_all/process'
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2/jvm,process'
# same as above
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2/info/jvm,process'

curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2/_all
The _all flag can be set to return all the information - or you can simply omit it.
plugins - if set, the result will contain details about the loaded plugins per node:
  • name: plugin name
  • description: plugin description if any
  • sitetrue if the plugin is a site plugin
  • jvmtrue if the plugin is a plugin running in the JVM
  • url: URL if the plugin is a site plugin
The result will look similar to:
{
  "cluster_name" : "test-cluster-MacBook-Air-de-David.local",
  "nodes" : {
    "hJLXmY_NTrCytiIMbX4_1g" : {
      "name" : "node4",
      "transport_address" : "inet[/172.18.58.139:9303]",
      "hostname" : "MacBook-Air-de-David.local",
      "version" : "0.90.0.Beta2-SNAPSHOT",
      "http_address" : "inet[/172.18.58.139:9203]",
      "plugins" : [ {
        "name" : "test-plugin",
        "description" : "test-plugin description",
        "site" : true,
        "jvm" : false
      }, {
        "name" : "test-no-version-plugin",
        "description" : "test-no-version-plugin description",
        "site" : true,
        "jvm" : false
      }, {
        "name" : "dummy",
        "description" : "No description found for dummy.",
        "url" : "/_plugin/dummy/",
        "site" : false,
        "jvm" : true
      } ]
    }
  }
}
if your plugin data is subject to change use plugins.info_refresh_interval to change or disable the caching interval:
# Change cache to 20 seconds
plugins.info_refresh_interval: 20s
# Infinite cache
plugins.info_refresh_interval: -1
# Disable cache
plugins.info_refresh_interval: 0
Ref: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-info.html

Nodes stats in elasticsearch


nodes stats

nodes statistics

The cluster nodes stats API allows to retrieve one or more (or all) of the cluster nodes statistics.
curl -XGET 'http://localhost:9200/_nodes/stats'
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2/stats'
The first command retrieves stats of all the nodes in the cluster. The second command selectively retrieves nodes stats of only nodeId1 and nodeId2. All the nodes selective options are explainedhere.
By default, all stats are returned. You can limit this by combining any of indicesosprocessjvmnetworktransporthttpfsbreaker and thread_pool. For example:
indices
Indices stats about size, document count, indexing and deletion times, search times, field cache size , merges and flushes
fs
File system information, data path, free disk space, read/write stats
http
HTTP connection information
jvm
JVM stats, memory pool information, garbage collection, buffer pools
network
TCP information
os
Operating system stats, load average, cpu, mem, swap
process
Process statistics, memory consumption, cpu usage, open file descriptors
thread_pool
Statistics about each thread pool, including current size, queue and rejected tasks
transport
Transport statistics about sent and received bytes in cluster communication
breaker
Statistics about the field data circuit breaker
# return indices and os
curl -XGET 'http://localhost:9200/_nodes/stats/os'
# return just os and process
curl -XGET 'http://localhost:9200/_nodes/stats/os,process'
# specific type endpoint
curl -XGET 'http://localhost:9200/_nodes/stats/process'
curl -XGET 'http://localhost:9200/_nodes/10.0.0.1/stats/process'
The all flag can be set to return all the stats.

field data statistics

You can get information about field data memory usage on node level or on index level.
# Node Stats
curl localhost:9200/_nodes/stats/indices/field1,field2?pretty
# Indices Stat
curl localhost:9200/_stats/fielddata/field1,field2?pretty
# You can use wildcards for field names
curl localhost:9200/_stats/fielddata/field*?pretty
curl localhost:9200/_nodes/stats/indices/field*?pretty
Ref: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html