首页   快速返回

elasticsearch5.0索引监控     所属分类 elasticsearch
根据原文翻译整理
https://www.elastic.co/guide/en/elasticsearch/reference/5.0/indices-stats.html

statistics on different operations happening on an index
索引上的各种操作统计
 
http://127.0.0.1:9200/_stats

http://127.0.0.1:9200/bank/_stats

GET /index1,index2/_stats



docs
The number of docs / deleted docs (docs not yet merged out). 
Note, affected by refreshing the index.
文档数和删除的文档数

store
The size of the index.
索引的大小

indexing
Indexing statistics, can be combined with a comma separated list of types to provide document type level stats.

get
Get statistics, including missing stats.
GET操作统计

search
Search statistics including suggest statistics. 
You can include statistics for custom groups by adding an extra groups parameter 
(search operations can be associated with one or more groups). 
The groups parameter accepts a comma separated list of group names. 
Use _all to return statistics for all groups.
搜索操作统计



segments
Retrieve the memory use of the open segments. 
Optionally, setting the include_segment_file_sizes flag, 
report the aggregated disk usage of each one of the Lucene index files.

completion
Completion suggest statistics.

fielddata
Fielddata statistics.

flush
Flush statistics.

merge
Merge statistics.

request_cache
Shard request cache statistics.

refresh
Refresh statistics.

warmer
Warmer statistics.

translog
Translog statistics.



# Get back stats for merge and refresh only for all indices
GET /_stats/merge,refresh
# Get back stats for type1 and type2 documents for the my_index index
GET /my_index/_stats/indexing?types=type1,type2
# Get back just search stats for group1 and group2
GET /_stats/search?groups=group1,group2


primaries are the values for only the primary shards
total are the cumulated values for both primary and replica shards.


In order to get back shard level stats, set the level parameter to shards.

Note, as shards move around the cluster, 
their stats will be cleared as they are created on other nodes. 
On the other hand, even though a shard "left" a node, 
that node will still retain the stats that shard contributed to.

分片会在集群中移动, 分片在其他节点创建时,统计信息会清除

segments information 段信息

http://localhost:9200/test/_segments'
http://localhost:9200/test1,test2/_segments'
http://localhost:9200/_segments

http://localhost:9200/bank/_segments

索引默认5个分片


_0
The key of the JSON document is the name of the segment. 
This name is used to generate file names: 
all files starting with this segment name in the directory of the shard belong to this segment.
generation
A generation number that is basically incremented when needing to write a new segment. 
The segment name is derived from this generation number.
num_docs
The number of non-deleted documents that are stored in this segment.

deleted_docs
The number of deleted documents that are stored in this segment. 
It is perfectly fine if this number is greater than 0, 
space is going to be reclaimed when this segment gets merged.

被删除文档只是被标记,段文件合并时会回收删除的文档空间

size_in_bytes
The amount of disk space that this segment uses, in bytes.

memory_in_bytes
Segments need to store some data into memory in order to be searchable efficiently. 
This number returns the number of bytes that are used for that purpose. 
A value of -1 indicates that Elasticsearch was not able to compute this number.
段需要存储一些数据到内存中,以便有效地搜索。


committed
Whether the segment has been sync’ed on disk. 
Segments that are committed would survive a hard reboot. 
No need to worry in case of false, 
the data from uncommitted segments is also stored in the transaction log 
so that Elasticsearch is able to replay changes on the next start.

段是否已同步写入磁盘。
如果没有写入磁盘,重启时会使用 transaction log  重放变更操作

search
Whether the segment is searchable. 
A value of false would most likely mean that the segment has been written to disk 
but no refresh occurred since then to make it searchable.
段是否对搜索可见,文档写入段后,只有刷新了才对搜索可见

version
The version of Lucene that has been used to write this segment.

compound
Whether the segment is stored in a compound file. 
When true, this means that Lucene merged all files 
from the segment in a single one in order to save file descriptors.

段是否存储在复合文件中。 如果为true 说明段文件合并过了,
段合并可以节省文件描述符


http://localhost:9200/bank/_segments?verbose=true


Indices Recovery

http://localhost:9200/bank/_recovery

http://localhost:9200/bank/_recovery?detailed=true
 
the timings in milliseconds of the various stages of recovery: index retrieval, translog replay, and index start time.

各个恢复阶段的计时:索引检索、translog重放和索引启动时间。

active_only=true will cause only on-going recoveries to be reported.
active_only=true  只显示正在恢复中的数据
http://localhost:9200/bank/_recovery?active_only=true

detailed
Display a detailed view. This is primarily useful for viewing the recovery of physical index files. Default: false.

active_only
Display only those recoveries that are currently on-going. Default: false.

id
Shard ID

type
Recovery type:

store
snapshot
replica
relocating
stage

Recovery stage:
init: Recovery has not started
index: Reading index meta-data and copying bytes from source to destination
start: Starting the engine; opening the index for use
translog: Replaying transaction log
finalize: Cleanup
done: Complete

恢复阶段



primary
True if shard is primary, false otherwise

start_time
Timestamp of recovery start

stop_time
Timestamp of recovery finish

total_time_in_millis
Total time to recover shard in milliseconds

source
Recovery source:

repository description if recovery is from a snapshot
description of source node otherwise

target
Destination node

index
Statistics about physical index recovery

translog
Statistics about translog recovery

start
Statistics about time to open and start the index


Indices Shard Stores 

Provides store information for shard copies of indices. 
副本分片存储信息

http://localhost:9200/test/_shard_stores
http://localhost:9200/test1,test2/_shard_stores
http://localhost:9200/_shard_stores

http://localhost:9200/bank/_shard_stores

集群状态
yellow   
at least one unassigned replica
至少有一个副本没有分配
red
有主分片没有分配

http://localhost:9200/_shard_stores?status=green
http://localhost:9200/_shard_stores?status=yellow

green yellow red

{
    "stores": [
        {
            "LQbdFV4aQOq90c0Y0R7Ivw": {
                "name": "node-1",
                "ephemeral_id": "Kh7xm-1VQpKIQzIo73tkFA",
                "transport_address": "127.0.0.1:9300",
                "attributes": {}
            },
            "allocation_id": "TvZFFH9GTXuuLeQxveA9yA",
            "allocation": "primary"
        }
    ]
}


"allocation" : "primary" | "replica" | "unused"

store_exception
Any exception encountered while opening the shard index or from earlier engine failure

上一篇     下一篇
elasticsearch5.0索引别名

elasticsearch5.0索引映射管理

elasticsearch5.0索引设置

elasticsearch5.0索引状态管理

线上故障处理

elasticsearch aerospike kafka副本数设置