恢复
编辑恢复
编辑actions: 1: action: restore description: >- Restore all indices in the most recent snapshot with state SUCCESS. Wait for the restore to complete before continuing. Do not skip the repository filesystem access check. Use the other options to define the index/shard settings for the restore. options: repository: # If name is blank, the most recent snapshot by age will be selected name: # If indices is blank, all indices in the snapshot will be restored indices: wait_for_completion: True max_wait: 3600 wait_interval: 10 filters: - filtertype: state state: SUCCESS exclude: - filtertype: ...
空值和注释行将使用默认值(如有)。如果设置了某个设置,但未被给定的操作使用,则将被忽略。
此操作将从指定的 仓库 恢复索引,从应用过滤器标识的最新快照或 名称 指定的快照恢复。
恢复时重命名索引
编辑您可以使用 rename_pattern 和 rename_replacement 选项在恢复时重命名索引。
actions: 1: action: restore description: >- Restore all indices in the most recent snapshot with state SUCCESS. Wait for the restore to complete before continuing. Do not skip the repository filesystem access check. Use the other options to define the index/shard settings for the restore. options: repository: # If name is blank, the most recent snapshot by age will be selected name: # If indices is blank, all indices in the snapshot will be restored indices: rename_pattern: 'index(.+)' rename_replacement: 'restored_index$1' wait_for_completion: True max_wait: 3600 wait_interval: 10 filters: - filtertype: state state: SUCCESS exclude: - filtertype: ...
在此配置中,Elasticsearch 将捕获 index
后出现的任何内容,并将其放在 restored_index
后。例如,如果我正在恢复 index-2017.03.01
,则生成的索引将重命名为 restored_index-2017.03.01
。
额外设置
编辑extra_settings 选项允许添加额外的设置,例如索引设置。如何使用这些设置更改正在恢复的索引设置的一个示例可能是:
actions: 1: action: restore description: >- Restore all indices in the most recent snapshot with state SUCCESS. Wait for the restore to complete before continuing. Do not skip the repository filesystem access check. Use the other options to define the index/shard settings for the restore. options: repository: # If name is blank, the most recent snapshot by age will be selected name: # If indices is blank, all indices in the snapshot will be restored indices: extra_settings: index_settings: number_of_replicas: 0 wait_for_completion: True max_wait: 3600 wait_interval: 10 filters: - filtertype: state state: SUCCESS exclude: - filtertype: ...
在这种情况下,副本数量将应用于恢复的索引。
更多信息,请参见 官方 Elasticsearch 文档。
必需设置
编辑可选设置
编辑- name(名称)
- include_aliases(包含别名)
- indices(索引)
- ignore_unavailable(忽略不可用)
- include_global_state(包含全局状态)
- partial(部分恢复)
- rename_pattern(重命名模式)
- rename_replacement(重命名替换)
- extra_settings(额外设置)
- wait_for_completion(等待完成)
- max_wait(最大等待时间)
- wait_interval(等待间隔)
- skip_repo_fs_check(跳过仓库文件系统检查)
- ignore_empty_list(忽略空列表)
- timeout_override(超时覆盖)
- continue_if_exception(异常时继续)
- disable_action(禁用操作)