Elasticsearch 集群数据备份到 HDFS
安装 hdfs 插件
sudo bin/elasticsearch-plugin install file:///data/repository-hdfs-7.16.1.zip- shell
PUT _snapshot/my_repository { "type": "hdfs", "settings": { "uri": "hdfs://namenode:8020/", "path": "elasticsearch/repositories/my_hdfs_repository", "conf.dfs.client.read.shortcircuit": "true" } }
手动创建快照
创建快照
# 在后台运行 # PUT _snapshot/my_repository/<my_snapshot_{now/d}> PUT _snapshot/my_repository/%3Cmy_snapshot_%7Bnow%2Fd%7D%3E # 非后台运行 PUT _snapshot/my_repository/%3Cmy_snapshot_%7Bnow%2Fd%7D%3E?wait_for_completion=true查看运行快照
GET _snapshot/my_repository/_current GET _snapshot/_status删除 或 取消快照
DELETE _snapshot/my_repository/my_snapshot_2099.05.06
自动创建快照
创建快照
# PUT _snapshot/my_repository/<my_index_snapshot_{now/d}> PUT _snapshot/my_repository/%3Cmy_index_snapshot_%7Bnow%2Fd%7D%3E创建 SLM policy
PUT _slm/policy/nightly-snapshots { "schedule": "0 30 1 * * ?", "name": "<my_index_snapshot_{now/d}>", "repository": "my_repository", "config": { "indices": "*", "include_global_state": true }, "retention": { "expire_after": "30d", "min_count": 5, "max_count": 50 } }手动执行 SLM policy
POST _slm/policy/nightly-snapshots/_execute