Elasticsearch数据备份与恢复(基于HDFS)

1.(所有机子上)安装es hdfs仓库插件repository-hdfs

# repository-hdfs一定要和es版本匹配
# 在线
bin/elasticsearch-plugin install repository-hdfs# 离线
bin/elasticsearch-plugin install file:///xxx/repository-hdfs-x.x.x.zip.zip

2. (所有机子上)设置ES-HDFS仓库安全策略

plugins/repository-hdfs/plugin-security.policy追加

permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.RuntimePermission "getClassLoader";
permission java.lang.RuntimePermission "shutdownHooks";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission javax.security.auth.AuthPermission "doAs";
permission javax.security.auth.AuthPermission "getSubject";
permission javax.security.auth.AuthPermission "modifyPrivateCredentials";
permission java.security.AllPermission;
permission java.util.PropertyPermission "*", "read,write";
permission javax.security.auth.PrivateCredentialPermission "org.apache.hadoop.security.Credentials * \"*\"", "read";

config/jvm.options追加

Djava.security.policy=file:xxx/plugins/repository-hdfs/plugin-security.policy

3.(所有机子上)设置JAVA安全管理器

$JAVA_HOME/jre/lib/security/java.policy追加

permission java.security.AllPermission;

重启Es集群

4. (一台机子上)创建HDFS仓库

# 创建远程仓库,目录为/user/xxx/es/repository/es_hdfs_repository
# 在HDFS 50070查看
# uri需要是active的namenode节点
curl -XPUT 'http://host:esPort/_snapshot/es_hdfs_repository' -d '
{"type":"hdfs","settings":{"uri":"hdfs://host:hdfsPort/","path":"es/repository/es_hdfs_repository"}
}'

5. (一台机子上)备份

# 对所有open的index进行备份,创建一个snapshot_1的备份
# wait_for_completion会堵塞到备份完成
curl -XPUT 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1?wait_for_completion=true'# 指定索引备份
curl -XPUT 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1?wait_for_completion=true' -d '
{"indices":["index1","index2"],"ignore_unavailable":true,"include_global_state":false,"partial":true
}'# 查看备份进度和结果
curl -XGET 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1?pretty'

6.(一台机子上)恢复

# 恢复指定索引
#include_global_state=true 集群状态也备份
#ignore_unavailable 部分索引不存在时也通过,否则认为不成功
#partial=true 部分失效也可以通过,否则认为不成功
curl -XPOST 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1/_restore?wait_for_completion=true' -d '
{"indices":["redisindex"],"ignore_unavailable":true,"include_global_state":false,"partial":true
}'# 恢复snapshot_1全部索引
curl -XPOST 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1/_restore?wait_for_completion=true'#恢复进度和结果
curl -XGET 'http://host:esPort/index1/_recovery?pretty'

Tips:

恢复之前最好先把所有close,防止恢复期间还有新数据产生

如果是不存在的索引,不在考虑范围

7.其他

# 关闭索引
curl -XPOST 'hhtp://host:esPort/eventindex/_close'# 打开索引
curl -XPOST 'http://host:esPort/eventindex/_open'# 删除备份
# 备份是增量备份的,所以不要轻易手动删,否则会出现索引损坏而无法恢复
# 正确的姿势
curl -XDELETE 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1'

转载于:https://www.cnblogs.com/xixisix/p/11023019.html

Elasticsearch数据备份与恢复(基于HDFS)相关推荐

  1. elasticsearch数据备份与恢复(kibana操作)

    一.kibana操作 流程: 创建仓库--->创建策略(自动备份)--->生成快照--->还原 解决: 1.在所有es节点下的elasticsearch.yml中添加以下配置: pa ...

  2. elasticsearch 数据类型_基于 MySQL Binlog 的 Elasticsearch 数据同步实践

    来源;马蜂窝 一.背景 随着马蜂窝的逐渐发展,我们的业务数据越来越多,单纯使用 MySQL 已经不能满足我们的数据查询需求,例如对于商品.订单等数据的多维度检索. 使用 Elasticsearch 存 ...

  3. 基于 MySQL Binlog 的 Elasticsearch 数据同步实践

    一.为什么要做 随着马蜂窝的逐渐发展,我们的业务数据越来越多,单纯使用 MySQL 已经不能满足我们的数据查询需求,例如对于商品.订单等数据的多维度检索. 使用 Elasticsearch 存储业务数 ...

  4. hive 导入hdfs数据_将数据加载或导入运行在基于HDFS的数据湖之上的Hive表中的另一种方法。

    hive 导入hdfs数据 Preceding pen down the article, might want to stretch out appreciation to all the well ...

  5. 基于 MySQL Binlog 的 Elasticsearch 数据同步实践 原

    一.背景 随着马蜂窝的逐渐发展,我们的业务数据越来越多,单纯使用 MySQL 已经不能满足我们的数据查询需求,例如对于商品.订单等数据的多维度检索. 使用 Elasticsearch 存储业务数据可以 ...

  6. elasticsearch docker无法挂载_ElasticSearch数据备份与恢复

    记录下ElasticSearch数据的备份与迁移过程 1.指定备份文件地址 由于这里使用docker安装的es,所以指定备份文件到挂载的宿主机目录中,如果不是docker安装,直接指定为主机的目录即可 ...

  7. spark配置elasticsearch属性汇总(基于es7)

    必要设置 es.resource Elasticsearch资源位置,在该位置读取和写入数据.需要格式 <index>/<type> es.resource.read(默认为e ...

  8. eBay 大数据平台的 HDFS 性能优化实践

    导读 HDFS作为大数据的底层存储系统,其性能处理效率关乎着大量与集群数据相关的计算任务的运行.HDFS的性能效率主要由其内部的核心服务NameNode所决定.此次eBay Hadoop team将分 ...

  9. elasticsearch数据迁移备份还原

    需求一:elasticsearch中的数据需要每天备份 需求二:elasticsearch5.2中的数据要迁移到elasticsearch6.5.4中 方案:采用repository-hdfs插件进行 ...

最新文章

  1. MySQL自动化平台那些事-分秒必争
  2. Hibernate修改命名策略
  3. HMM模型和Viterbi算法
  4. 用Linux命令行生成随机密码的十种方法
  5. 趣话题:git三部曲(一)-bug之争,到底谁才是该背锅的那个人?
  6. win10企业版更新和安全中没有 “恢复”这个选项_通知:微软已强制对Windows 10更新升级...
  7. MongoDB 常用运算符
  8. windows环境下memcache服务器使用经验
  9. 高德地图时间和实际差多少_带着“高德地图”去工作
  10. Tensorflow2.0实战之GAN
  11. CSS简易导航列表样式
  12. 重装windows10系统自定义安装时未出现分区,解决方法之一
  13. 国五条催生末班车效应 郑州二手房交易量激增
  14. arcgis属性字段fid修改 修改出现bad value
  15. 谢烟客---------Linux之SELinux的基本应用
  16. 两个定律,给你找了一个换手机的借口
  17. Linux conda tensorflow-gpu安装及Not creating XLA devices, tf_xla_enable_xla_devices not set相关问题解决
  18. 浅谈单神经元网络PID控制算法及MATLAB仿真
  19. echarts堆叠图显示总数 tooltips处理
  20. 路由器fast服务器没响应,FAST路由器复位常见问题解决方法

热门文章

  1. Codeforces 994A. Fingerprints
  2. 每天一道LeetCode----从数组中选择若干不连续元素使得总和最大
  3. 1036 跟奥巴马一起编程 (15 分)(c++)C++
  4. 1007 素数对猜想 (20 分)(c语言)
  5. r8169驱动下载linux,CentOS自带R8169驱动与R8168网卡之间的烦恼
  6. 12.当效率至关重要时,请在map::operator[]与map::insert之间谨慎作出选择
  7. Redis的设计与实现之整数集合和压缩列表
  8. having and group by
  9. jsch 移动服务器上文件,jsch上传文件到服务器
  10. [BUUCTF-pwn]——picoctf_2018_are you root