Elasticsearch Index Monitoring(索引监控)之Index Stats API详解

},

其返回字段说明如下:

  • open_contexts

正在打开的查询上下文个数。

  • query_total

查询出来的总数据条数。

  • query_time_in_millis

查询阶段所耗费的时间。

  • query_current

当前正在查询个数。

  • fetch_total

Fetch操作的次数。

  • fetch_time_in_millis

Fetch阶段总耗时时间。

  • fetch_current

正在fetch的次数。

  • scroll_total

通过scroll api查询数据总条数。

  • scroll_time_in_millis

通过scroll api总耗时时间。

  • scroll_current

当前滚动API调用次数。

  • suggest_total

通过suggest api获取的推荐总数量。

  • suggest_time_in_millis

suggest总耗费时间。

  • suggest_current

正在执行suggest api的个数。

6、merges

合并相关的统计信息,其输出示例如下:

“merges” : {

“current” : 0,

“current_docs” : 0,

“current_size_in_bytes” : 0,

“total” : 0,

“total_time_in_millis” : 0,

“total_docs” : 0,

“total_size_in_bytes” : 0,

“total_stopped_time_in_millis” : 0,

“total_throttled_time_in_millis” : 0,

“total_auto_throttle_in_bytes” : 104857600

}

其返回字段说明如下:

  • current

总发生的合并次数。

  • current_docs

当前正在发生合并的文档数。

  • current_size_in_bytes

当前合并参与的文档总大小,单位字节。

  • total

总发生的合并次数。

  • total_time_in_millis

合并的总耗时(单位毫秒)。

  • total_docs

merge(合并)时总处理的文档个数。

  • total_size_in_bytes

merge(合并)时总处理的文档总大小(字节)。

  • total_stopped_time_in_millis

merge(合并)时总停止时间(吞吐率为0)。

  • total_throttled_time_in_millis

超过指定吞吐率而暂停的时间(节流)。

  • total_auto_throttle_in_bytes

自动进行流控的阔值,默认速率20m/s。

7、refresh

刷新索引相关的统计。

“refresh” : {

“total” : 15,

“total_time_in_millis” : 0,

“listeners” : 0

}

其返回字段说明如下:

  • total

执行刷新的总次数。

  • total_time_in_millis

执行刷新总耗时。

  • listeners

等待刷新侦听器的数量。

8、flush

刷盘的统计信息。

“flush” : {

“total” : 5,

“periodic” : 0,

“total_time_in_millis” : 0

}

其返回字段说明如下:

  • total

执行刷盘操作的次数。

  • periodic

当translog超过刷新阈值时周期性触发的刷新次数。

  • total_time_in_millis

刷盘操作总耗时时间。

9、warmer

索引分片(shard)预热统计信息,分片预热是指为索引创建一个分片节点时,是否对该索引预热(为索引创建一bitSet位图)。其统计示例如下:

“warmer” : {

“current” : 0,

“total” : 5,

“total_time_in_millis” : 0

}

其返回字段说明如下:

  • current

当前正在预热的个数。

  • total

总共发生的预热次数。

  • total_time_in_millis

分片预热总耗时。

10、query_cache

查询缓存统计信息,其示例如下:

“query_cache” : {

“memory_size_in_bytes” : 0,

“total_count” : 0,

“hit_count” : 0,

“miss_count” : 0,

“cache_size” : 0,

“cache_count” : 0,

“evictions” : 0

}

其返回字段说明如下:

  • memory_size_in_bytes

查询缓存占用的内存空间,单位为字节。

  • total_count

缓存中查询的总次数,等于hit_count + miss_count。

  • hit_count

查询缓存命中的次数。

  • miss_count

查询缓存未命中的次数。

  • cache_size

当前查询缓存中缓存文档的个数。

  • cache_count

查询缓存总缓存文档个数(包含已经被换出evictions的文档个数)。

  • evictions

查询缓存被逐出的总数。

11、fielddata

fielddata统计信息,fielddata主要用加快text字段排序与聚合的性能,存储词根与文档的映射关系存储在在内存,在内存中进行排序与聚合。

“fielddata” : {

“memory_size_in_bytes” : 0,

“evictions” : 0

}

其返回字段说明如下:

  • memory_size_in_bytes

当前占用内存的大小。

  • evictions

被逐出词根的个数。

12、completion

completion(自动填充)相关统计,其输出示例为:

“completion” : {

“size_in_bytes” : 0

},

其返回字段说明如下:

  • size_in_bytes

自动提示占用字节数。

13、segments

检索打开段的内存使用情况。可选地,设置include_segment_file_size=true(默认为false),将输出每个Lucene索引文件的聚合磁盘使用情况,其返回示例如下:

“segments” : {

“count” : 32,

“memory_in_bytes” : 38078,

“terms_memory_in_bytes” : 23838,

“stored_fields_memory_in_bytes” : 9984,

“term_vectors_memory_in_bytes” : 0,

“norms_memory_in_bytes” : 2048,

“points_memory_in_bytes” : 32,

“doc_values_memory_in_bytes” : 2176,

“index_writer_memory_in_bytes” : 0,

“version_map_memory_in_bytes” : 0,

“fixed_bit_set_memory_in_bytes” : 0,

“max_unsafe_auto_id_timestamp” : -1,

“file_sizes” : { }

},

其返回字段说明如下:

  • count

该索引目前拥有的总段数。

  • memory_in_bytes

该索引缓存在内存中字节数。

  • terms_memory_in_bytes

倒排索引(term)缓存在内中所占字节数。

  • stored_fields_memory_in_bytes

该索引定义为stored_fields字段在内存中缓存的字节数。

  • term_vectors_memory_in_bytes

该索引term_vectors(词向量)在内存中所占字节数量。

  • norms_memory_in_bytes

该索引存储对应norms=true的字段当前在内存中缓存字节数。

  • points_memory_in_bytes

与地理位置相关的缓存数据。

  • doc_values_memory_in_bytes

设置为doc_values缓存在内存中的字节数(doc_values,列式存储)。

  • index_writer_memory_in_bytes

用于优化索引写的缓存(减少写磁盘的频率)。

  • version_map_memory_in_bytes

关于文档的版本映射所占内存大小。

  • fixed_bit_set_memory_in_bytes

fixed_bit_set内存,专门用来做nested查询的。

  • max_unsafe_auto_id_timestamp

es内部当前的自增ID。

  • file_sizes

其中如果设置为true,则file_sizes主要包含如下统计信息:

在这里插入图片描述

14、translog

translog统计信息(有点类似于Innodb的redo日志),其输出示例如下:

“translog” : {

“operations” : 0,

“size_in_bytes” : 1100,

“uncommitted_operations” : 0,

“uncommitted_size_in_bytes” : 1100,

“earliest_last_modified_age” : 0

}

其返回字段说明如下:

  • operations

写translog的次数(索引文档、更新文档、删除文档的总操作数量)。

  • size_in_bytes

translog实例管理的translog文件总大小。(一个索引引擎(InternalEngine)示例包含一个Translog实例)。

  • uncommitted_operations

当前还未提交到lucene中的操作次数(索引文档、更新文档、删除文档的操作数量)。

  • uncommitted_size_in_bytes

translog中未提交到Lucene中的字节数。

  • earliest_last_modified_age

以秒为单位返回translog文件中最老条目的年龄。

15、request_cache

请求缓存的统计信息,其输出示例如下:

“request_cache” : {

“memory_size_in_bytes” : 0,

“evictions” : 0,

“hit_count” : 0,

“miss_count” : 0

},

其返回字段说明如下:

  • memory_size_in_bytes

请求缓存占用内存总大小。

  • evictions

请求缓存被剔除出次数。

  • hit_count

请求缓存被命中次数。

  • miss_count

请求缓存未命中次数。

16、recovery

recovery(恢复)相关的统计信息,其输出示例:

“recovery” : {

“current_as_source” : 0,

“current_as_target” : 0,

“throttle_time_in_millis” : 0

}

其返回字段说明如下:

  • current_as_source

作为源分片,正在执行恢复的分片数量 。

  • current_as_target

作为目标分片,正在执行恢复的分片数量。

  • throttle_time_in_millis

恢复过程总等待时间。

Indices Stats返回的结果是在索引级别的聚合,包含三个维度:primaries(所有主节点进行聚合)、total(所有主节点、副本节点进行聚合)、indices(索引级别)。

下面给出在JAVA中使用Index Stats示例来结束本篇的讲解。

ElasticSearch Index Stats JAVA示例如下:(当前elasticsearch6.4.0 High Rest Client未提供对应API的封装)

public static final void test_Indices_StatsIndex() {

TransportClient client = EsClient.getTransportClient();

try {

IndicesStatsRequest request = new IndicesStatsRequest();

// request.indices(“aggregations_index02”);

// request.indices(“logs_write”);

// request.includeSegmentFileSizes(true);

ActionFuture responseFuture = client.admin().indices().stats(request);

IndicesStatsResponse response = responseFuture.get();

System.out.println(response);

// System.out.println(result);

} catch (Throwable e) {

e.printStackTrace();

} finally {

EsClient.close(client);

}

}

其返回的结果:

{

“_shards” : {

“total” : 172,

“successful” : 86,

“failed” : 0

},

“_all” : {

“primaries” : {

“docs” : {

“count” : 4166,

“deleted” : 0

},

“store” : {

“size_in_bytes” : 929840

},

// … 省略部分选项

},

“total” : {

总结

如果你选择了IT行业并坚定的走下去,这个方向肯定是没有一丝问题的,这是个高薪行业,但是高薪是凭自己的努力学习获取来的,这次我把P8大佬用过的一些学习笔记(pdf)都整理在本文中了

《Java中高级核心知识全面解析》

小米商场项目实战,别再担心面试没有实战项目:

esStatsResponse response = responseFuture.get();

System.out.println(response);

// System.out.println(result);

} catch (Throwable e) {

e.printStackTrace();

} finally {

EsClient.close(client);

}

}

其返回的结果:

{

“_shards” : {

“total” : 172,

“successful” : 86,

“failed” : 0

},

“_all” : {

“primaries” : {

“docs” : {

“count” : 4166,

“deleted” : 0

},

“store” : {

“size_in_bytes” : 929840

},

// … 省略部分选项

},

“total” : {

总结

如果你选择了IT行业并坚定的走下去,这个方向肯定是没有一丝问题的,这是个高薪行业,但是高薪是凭自己的努力学习获取来的,这次我把P8大佬用过的一些学习笔记(pdf)都整理在本文中了

《Java中高级核心知识全面解析》

[外链图片转存中…(img-HNhxdzg0-1721133543001)]

小米商场项目实战,别再担心面试没有实战项目:

[外链图片转存中…(img-u46dTAN5-1721133543002)]

  • 12
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ey Features Understand common performance and reliability pitfalls in ElasticSearch Use popular monitoring tools such as ElasticSearch-head, BigDesk, Marvel, Kibana, and more This is a step-by-step guide with lots of case studies on solving real-world ElasticSearch cluster issues Book Description ElasticSearch is a distributed search server similar to Apache Solr with a focus on large datasets, a schema-less setup, and high availability. This schema-free architecture allows ElasticSearch to index and search unstructured content, making it perfectly suited for both small projects and large big data warehouses with petabytes of unstructured data. This book is your toolkit to teach you how to keep your cluster in good health, and show you how to diagnose and treat unexpected issues along the way. You will start by getting introduced to ElasticSearch, and look at some common performance issues that pop up when using the system. You will then see how to install and configure ElasticSearch and the ElasticSearch monitoring plugins. Then, you will proceed to install and use the Marvel dashboard to monitor ElasticSearch. You will find out how to troubleshoot some of the common performance and reliability issues that come up when using ElasticSearch. Finally, you will analyze your cluster's historical performance, and get to know how to get to the bottom of and recover from system failures. This book will guide you through several monitoring tools, and utilizes real-world cases and dilemmas faced when using ElasticSearch, showing you how to solve them simply, quickly, and cleanly. What you will learn Explore your cluster with ElasticSearch-head and BigDesk Access the underlying data of the ElasticSearch monitoring plugins using the ElasticSearch API Analyze your cluster's performance with Marvel Troubleshoot some of the common performance and reliability issues that come up when using ElasticSearch Analyze a cluster's historical performance, and get to the bottom of and recover from system failures Use and install various other tools and plugins such as Kibana and Kopf, which is helpful to monitor ElasticSearch About the Author Dan Noble is a software engineer with a passion for writing secure, clean, and articulate code. He enjoys working with a variety of programming languages and software frameworks, particularly Python, Elasticsearch, and frontend technologies. Dan currently works on geospatial web applications and data processing systems. Dan has been a user and advocate of Elasticsearch since 2011. He has given talks about Elasticsearch at various meetup groups, and is the author of the Python Elasticsearch client rawes. Dan was also a technical reviewer for the Elasticsearch Cookbook, Second Edition, by Alberto Paro. Table of Contents Chapter 1. Introduction to Monitoring Elasticsearch Chapter 2. Installation and the Requirements for Elasticsearch Chapter 3. Elasticsearch-head and Bigdesk Chapter 4. Marvel Dashboard Chapter 5. System Monitoring Chapter 6. Troubleshooting Performance and Reliability Issues Chapter 7. Node Failure and Post-Mortem Analysis Chapter 8. Looking Forward

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值