Snapshot 创建的时间 复杂度为O(1),但是不包括INode 的寻找时间
只有当修改SnapShot时,才会有额外的内存占用,内存使用量为O(M),M 为修改的文件或者目录数
在datanode 上面的blocks 不会复制,做Snapshot 的文件是纪录了block的信息
Snapshot 并不会影响HDFS 的正常操作
产生了以下新的概念:
Snapshot table:Snapshots 会存储在snapshottable的目录下。snapshottable下存储的snapshots 最多为65535个
Snapshot 路径:举例,假设/foo 是snapshottable,/foo/bar 是文件目录,/foo 拥有一个s0的snapshot,那么路径会是 /foo/.snapshot/s0/bar,我们可以通过 hdfs dfs -ls /foo/.snapshot
hdfs dfs -ls /foo/.snapshot/s0
hdfs dfs -cp /foo/.snapshot/s0/bar /tmp
来操作与查看副本文件。
Snapshot 基本操作:
对一个路径开启Snapshot: hdfs dfsadmin -allowSnapshot
关闭 Snapsshots: hdfs dfsadmin -disallowSnapshot
创建Snapshosts:hdfs dfs -createSnapsshot
删除Snapshots:hdfs dfs -deleteSnaphost
修改Snapshots的名字:hdfs dfs -renameSnapshot
获取Snapshot 列表:hdfs lsSnapshottableDir
获取两个Snapshot的不同:hdfs snapsshotDiff
官方首页:http://hadoop.apache.org/
免费下载:http://hadoop.apache.org/releases.html
来自:开源中国社区

