curl   :

http://keenwon.com/1393.html

During snapshot initialization, information about all previous snapshots is loaded into the memory, which means that in large repositories it may take several seconds (or even minutes) for this command to return even if the wait_for_completion parameter is set to false.

这意味着创建快照时,会占用很大的内存(同时为了计算,也会占用很多CPU),原因如下段中描述:在创建快照时需要分析已有仓库中的索引

The index snapshot process is incremental. In the process of making the index snapshot Elasticsearch analyses the list of the index files that are already stored in the repository and copies only files that were created or changed since the last snapshot. That allows multiple snapshots to be preserved in the repository in a compact form. Snapshotting process is executed in non-blocking fashion.

快照本质上就是将索引(还有一些集群信息)复制,所谓增量式(incremental)就是仅复制自上次以来新增和改变的文件(索引)。

All indexing and searching operation can continue to be executed against the index that is being snapshotted. However, a snapshot represents the point-in-time view of the index at the moment when snapshot was created, so no records that were added to the index after the snapshot process was started will be present in the snapshot.

创建快照不会影响索引和查询操作。快照是索引的实时反映,所以在创建快照过程中新增的索引都不会在快照中出现。

The snapshot process starts immediately for the primary shards that has been started and are not relocating at the moment. Elasticsearch waits for relocation or initialization of shards to complete before snapshotting them.

Besides creating a copy of each index the snapshot process can also store global cluster metadata, which includes persistent cluster settings and templates. The transient settings and registered snapshot repositories are not stored as part of the snapshot.

快照进程在复制索引时也会存储集群的元信息,包括集群永久设置和模板。临时设置和快照仓库并不会作为快照的一部分存储。

蓝色部分表示怀疑

[root@datanode3 elasticsearch]# cd test/
[root@datanode3 test]# ll
总计
-rw-r--r-- root root - : .tgz
-rw-r--r-- root root - : .tgz
drwxr-xr-x root root - : repo
[root@datanode3 test]# cd repo/
[root@datanode3 repo]# ll
总计
-rw-r--r-- root root - : index
drwxr-xr-x root root - : indices
-rw-r--r-- root root - : metadata-snapshot_test5
-rw-r--r-- root root - : snapshot-snapshot_test5
[root@datanode3 repo]# cat metadata-snapshot_test5
{"meta-data":{"version":,"uuid":"IQXbkDFASIu_BlyerMYJcQ","templates":{},"repositories":{"my_backup":{"type":"fs","settings":{"compress":"true","location":"./mount/backups/my_backup"}},"testrepo":{"type":"fs","settings":{"location":"./test/repo"}}}}}

如上所示metadata-snapshot_test5文件中确实有快照仓库信息。

但是通过如下实验:

1.部署两个弹搜集群(两台单机),配置完全相同,一台A有索引(test5),并建立数据仓库(testrepo),创建了一个快照(snapshot_test5),另一台B没有任何数据。

2.把A快照仓库下的所有文件拷到B中相应的文件夹下,直接通过API做数据恢复,提示缺少快照仓库,说明快照中确实没有存储快照仓库信息(至少应该不全)

3.在B中创建相同名称和路径的快照仓库,把A中快照仓库路径(repo)下的所有文件拷贝到B中相同路径(repo)下,通过API做数据恢复,数据恢复成功,所以可以通过该方式做数据迁移。

虽然不知道这么操作是否安全可靠,但是至少成功了。

Only one snapshot process can be executed in the cluster at any time. While snapshot of a particular shard is being created this shard cannot be moved to another node, which can interfere with rebalancing process and allocation filtering. Elasticsearch will only be able to move a shard to another node (according to the current allocation filtering settings and rebalancing algorithm) once the snapshot is finished.

一个急群众只能有一个快照进程在执行

http://www.elasticsearch.org/blog/introducing-snapshot-restore/

However, while replication can protect a cluster from hardware failures, it doesn’t help when someone accidentally deletes an index. Anyone that relies on an Elasticsearch cluster needs to perform regular backups.

副本和备份有不同的目的:副本机制是为了防止硬盘故障,备份机制是为了防止误删索引。

The snapshot/restore mechanism can be also used to synchronize data between a “hot” cluster and a remote, “cold” backup cluster in a different geographic region for fast disaster recovery.

快照和恢复机制也用来同步“热”集群和远程“冷”备份集群

Java api

http://amsterdam.luminis.eu/2014/12/15/creating-elasticsearch-backups-with-snapshotrestore/

elasticsearch 备份和恢复的更多相关文章

  1. 【ELK】Elasticsearch的备份和恢复

    非原创,只是留作自己查询使用,转自http://keenwon.com/1393.html Elasticsearch的备份和恢复 备份 Elasticsearch的一大特点就是使用简单,api也比较 ...

  2. 【linux】【gitlab】gitlab安装、备份、恢复、升级、内存消耗问题

    前言 GitLab:GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务.功能:Gitlab 是一个提供代码托管.提交审核和问题跟踪的代码管理平 ...

  3. elasticsearch备份和还原(基于hdfs)

    备份和还原,为什么elasticsearch还需要备份呢,明明可以设置副本做到高可用,那怕啥呢? 其实在实际的生产环境中,一般最终的结果数据都是要备份的,这样的做的目的,就是能够以最快的速度还原数据, ...

  4. 我的MYSQL学习心得(十四) 备份和恢复

    我的MYSQL学习心得(十四) 备份和恢复 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) ...

  5. postgresql数据库备份和恢复

    PostgreSQL自带一个客户端pgAdmin,里面有个备份,恢复选项,也能对数据库进行备份 恢复(还原),但最近发现数据库慢慢庞大的时候,经常出错,备份的文件过程中出错的几率那是相当大,手动调节灰 ...

  6. Sql Server数据库备份和恢复:原理篇

    本文与您探讨为什么Sql Server有完整备份.差异备份和事务日志备份三种备份方式,以及为什么数据库又有简单模式.完整模式和大容量日志模式这三种恢复模式.本文内容适用于2005以上所有版本的Sql ...

  7. 云与备份之(1):VMware虚机备份和恢复

    本系列文章会介绍云与备份之间的关系,包括: (1)VMware 虚机备份和恢复 (2)KVM 虚机备份和恢复 (3)云与备份 (4)OpenStack 与备份 (5)公有云与备份 1. 与备份有关的V ...

  8. c# 备份数据库恢复数据库

    /// <summary> /// 对数据库的备份和恢复操作,Sql语句实现 /// </summary> /// <param name="cmdText&q ...

  9. sql server远程备份和恢复

    sql server远程备份和恢复 SQLSERVER服务实例名称:192.168.0.2需要备份的数据库名称: a备份机器名称(Client端):192.168.0.3备份机用户:zf 密码:123 ...

随机推荐

  1. HDFS HBase Solr Which one?

    从访问模式角度决策 HDFS 压缩性能最优.扫描速度最快:不支持随机访问,仅支持昂贵.复杂的文件查询 HBase适合随机访问 Solr 适合检索需求 HBase访问单个记录的时间为毫秒级别,而HDFS ...

  2. 初识代码封装工具SWIG(回调Python函数)

    这不是我最早使用swig了,之前在写Kynetix的时候就使用了swig为python封装了C语言写的扩展模块.但是当时我对C++还不是很了解,对其中的一些概念也只是拿来直接用,没有理解到底是什么,为 ...

  3. Android笔记之manifestPlaceholders

    有时根据项目需要,AndroidManifest.xml中的meta-data的值分测试和正式 为了能自动地更换meta-data值,就需要用到manifestPlaceholders 语法:mani ...

  4. virtualBox 不能开启一个新任务的错误

    2016.06.05 这两天想在virtualbox上安装CentOS7.0玩,遇到一个问题: 不能为虚拟电脑 CentOS7 打开一个新任务. The virtual machine 'CentOS ...

  5. CRM 安装不规范,亲人两行泪

    安装CRM需要严格按照CRM部署文档的要求进行,比如设置CRM服务的服务账号一定要加入到CRM所在组织库用户里,不然会遇到下面错误.这个就是传递到SQL 的账号,在SQL那边不识别 <s:Env ...

  6. Struts多个文件上传

    Struts2多个文件上传 10级学员 韩晓爽课堂笔记 多个文件上传分为List集合和数组,下面我们着重介绍一下list集合的上传.都大同小异. 一 介绍 1. 在struts2文件上传的时候要先导入 ...

  7. const位置上的不同代表哪些不同的意义

    const位置上的不同代表哪些不同的意义 exern的用法 这个可以引用在程序编译过程中编译进去的常量数据.换句话说正能在.h文件的声明赋值的常量才可以.并且常量的名字不能相同,如果相同会报错. 全局 ...

  8. SystemV和BSD的区别

    目前,Unix操作系统不管其内核如何,其操作风格上主要分为SystemV(目前一般采用其第4个版本SVR4)和BSD两种.其代表操作系统本别是Solaris和FreeBSD.当然,在SunOS4(So ...

  9. SVG-Android开源库——SVG生成Vector资源文件的编辑预览工具

    Vector矢量图在Android项目中的应用越来越广泛,但是如果你想用Android Studio自带的工具将SVG图片转化成Vector资源文件却是相当麻烦,首先能支持的SVG规范较少,其次操作流 ...

  10. 自建 AppRTC

    自建 AppRTC 字数3158 阅读1718 评论2 喜欢2 AppRTC 是 webrtc 的一个 demo.自建 AppRTC 可以苦其心志劳其筋骨饿其体肤,更重要的是能学会 webrtc 服务 ...