Header Ads

Header ADS

Comandos úteis para o elastichsearch

Introdução


Para quem não conhece, o Elasticsearch é um “servidor de buscas distribuído baseado no Apache Lucene”. Em outras palavras, pode-se dizer que o Elasticsearch é um banco de dados NoSQL, porém com esteroides, uma série de plugins e ferramentas auxiliares. E o melhor, opensource.
Abaixo está uma lista de comandos que podem ajudar na execução de solução de problemas do seu cluster elasticsearch.

substitua localhost pelo endereço IP de seus hosts elasticsearch se não estiver escutando em localhost.

Saúde do cluster

curl -XGET 'http://localhost:9200/_cluster/health?pretty'

{ "cluster_name" : "Shrunken Bones", "status" : "yellow", "timed_out" : false, "number_of_nodes" : 1, "number_of_data_nodes" : 1, "active_primary_shards" : 22, "active_shards" : 22, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 8, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 73.33333333333333}


Listar os indices 

[root@dev-instance logstash]# curl -X GET http://localhost:9200/_cat/indicesgreen open .kibana_task_manager dN7tdlvjSPKHAykjaBcSXg 1 0 2 0 55.8kb 55.8kbgreen open .monitoring-es-7-2019.09.02 hDDxQJzJTcyQIp8yxrUTyw 1 0 35646 41982 20.2mb 20.2mbgreen open .monitoring-es-7-2019.08.13 eKnlpsFiR4ynRqmg-jMtBQ 1 0 2609 1770 2.3mb 2.3mbyellow open filebeat-7.3.0-2019.08.07-000001 a948cy8SRCWJ7uAfiwxo1Q 1 1 318145 0 96.9mb 96.9mbgreen open .monitoring-kibana-7-2019.08.07 NW7G8vmsTfuugRO5JtwfgA 1 0 7849 0 2.6mb 2.6mbgreen open .monitoring-es-7-2019.08.10 Fd1jDZpCTh6PZZNS40vRLQ 1 0 124229 151116 79.5mb 79.5mbyellow open openvas_ec_aws wOuSo2SsSLa4uxhXiJ9tZw 1 1 3727 0 4.3mb 4.3mbgreen open .kibana_1 bVHZJQakQCu6R2f8Rtm_Cw 1 0 1814 42 993.4kb 993.4kbgreen open .monitoring-kibana-7-2019.08.09 Z6fD0NyFTQC6NjGE2XossQ 1 0 3771 0 1.3mb 1.3mbyellow open openvas_ec_nuvem J-nx9W84Q7OLCy9Th-UhWQ 1 1 0 0 283b 283bgreen open .monitoring-kibana-7-2019.08.08 yCcbDxqsSJWKi9_XNX8D0g 1 0 2970 0 1.1mb 1.1mbgreen open .monitoring-kibana-7-2019.08.13 qJccDaNKShKlvKti4yUiRA 1 0 94 0 215.3kb 215.3kbgreen open .monitoring-es-7-2019.08.09 L2YyGl7uQQaSx1a4QJhT3A 1 0 160097 186303 106mb 106mbyellow open nuvem QGXCEqPSRAer70eA_XI0yQ 1 1 449 0 672.4kb 672.4kbgreen open .monitoring-es-7-2019.08.08 gayUY_0aRRabGwcTWYiDSg 1 0 133472 150508 78.8mb 78.8mbgreen open .monitoring-kibana-7-2019.08.10 IU4rzwn2Sw2okEFBf4qrng 1 0 5399 0 1.8mb 1.8mbgreen open .monitoring-es-7-2019.08.07 OBHu8EQERYi5-2KMX9i9hg 1 0 96039 91084 48mb 48mbyellow open openvas- bHPxIGtdQdywfzzY1EG_OQ 1 1 16101 0 16.9mb 16.9mbgreen open .monitoring-kibana-7-2019.09.02 pYS-TE3JSy29QoWlSD4-dA 1 0 755 0 306.8kb 306.8kbyellow open openvas-ec-nuvem 0dfH5JSKQdibxBiDk6ZNeg 1 1 0 0 283b 283byellow open auditbeat-7.3.0-2019.08.06-000001 fsZPxRdgS4mOQbnzxMJK_Q 1 1 469626 0 212.7mb 212.7mbyellow open openvas_2_nuvem C4f3S-n1QOa8sWVni0mxvg 1 1 449 0 672.4kb 672.4kb[root@dev-instance logstash]#

Deletar indice 

[root@dev-instance logstash]# curl -X DELETE http://35.238.15.localhost:9200/metricbeat-7.3.0-2019.08.07-000001

 Encontrar shards não atribuídos

curl -XGET localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED

No comments

Theme images by sandsun. Powered by Blogger.