ElasticSearch 升级过程中给涉及到的术语-2、API cat recovery

本文深入探讨了Elasticsearch中的分片恢复机制,包括无数据移动时的本地存储恢复、通过修改集群备份数和添加新节点进行的恢复、快照恢复以及详细的恢复过程监控。文中详细解释了recovery命令的使用,以及如何通过不同参数获取恢复状态的详细信息。

recovery命令用于查看索引分片的恢复情况,无论是正在进行中的还是已经完成的所有情况;它是JSON recovery API的更紧凑的显示;当集群中一个索引分片被移动到另一个不同的节点时,recovery事件就会发生;在闪照恢复、备份数改变、节点失败以及节点重启时也会发生;最后一个类型称为:本地存储恢复,这也是一种更常用的在节点重启时从磁盘加载分片数据的方式;

1)以下就是当没有分片数据从一个节点移动到另一个节点时集群恢复的状态:

GET _cat/recovery?v

index   shard time type  stage source_host source_node target_host target_node repository snapshot files files_recovered files_percent files_total bytes bytes_recovered bytes_percent bytes_total translog_ops translog_ops_recovered translog_ops_percent
twitter 0     13ms store done  n/a         n/a         127.0.0.1   node-0      n/a        n/a      0     0               100%          13          0     0               100%          9928        0            0                      100.0%

以上例子中:存储类型为 store,索引 源数据和目标数据在同一节点;也就是他们从启动节点的本地存储数据中读取;

2)接着我们来看看正在恢复中索引情况–通过修改集群的备份数和添加新的节点;

GET _cat/recovery?v&h=i,s,t,ty,st,shost,thost,f,fp,b,bp

返回数据如下:

i s t ty st shost thost f fp b bp
twitter 0 1252ms peer done 192.168.1.1 192.168.1.2 0 100.0% 0 100.0%

其中:i:索引;s:分片;t:用时;ty:类型;st:阶段;shost:源主;thost:目标主机;f:文件;fp:文件的百分比;b:字节;bp:字节百分比;
以上twitter分片由另一个节点来恢复的,且恢复类型为peer。文件和字节的copy是实时测量的;
3)闪照 恢复。假如之前做过索引的备份,那么可以通过 snapshot and restore API进行数据恢复;

GET _cat/recovery?v&h=i,s,t,ty,st,rep,snap,f,fp,b,bp

返回结果:

i s t ty st rep snap f fp b bp
twitter 0 1978ms snapshot done twitter snap_1 79 8.0% 12086 9.0%

4) curl -X GET “localhost:9200/_recovery?human&detailed=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.

输出选项:
Description of output fields:

字段名称描述
id分片id
typeRecovery type: 1) store ;2) snapshot;3) replica;4)relocating
stageRecovery stage: 1)init: Recovery has not started ;2) index: Reading index meta-data and copying bytes from source to destination;3) start: Starting the engine; opening the index for use;) translog: Replaying transaction log;)finalize: Cleanup;)done: Complete
primaryTrue if shard is primary, false otherwise
start_timeTimestamp of recovery start
stop_timeTimestamp of recovery finish
total_time_in_millisTotal time to recover shard in milliseconds
sourceRecovery source:1) repository description if recovery is from a snapshot;2)description of source node otherwise
targetDestination node
indexStatistics about physical index recovery
translogStatistics about translog recovery
startStatistics about time to open and start the index
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值