Hadoop 2.x 快照
时间:2014-12-02 15:47来源:linux.it.net.cn 作者:IT
1 |
hdfs dfsadmin -allowSnapshot <path>
|
1 |
hdfs dfsadmin -disallowSnapshot <path>
|
1 |
hdfs dfs -createSnapshot <path> [<snapshotName>]
|
1 |
hdfs dfs -deleteSnapshot <path> <snapshotName>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 |
[hadoop@hadoop1 hadoop-2.5.0]$ ./bin/hdfs dfsadmin -allowSnapshot /
Allowing snaphot on / succeeded
[hadoop@hadoop1 hadoop-2.5.0]$ ./bin/hdfs dfs -put ../test1.txt /test1.txt
[hadoop@hadoop1 hadoop-2.5.0]$ ./bin/hdfs dfs -ls /
Found 1 items
-rw-r--r-- 1 hadoop supergroup 12 2014-08-31 23:26 /test1.txt
[hadoop@hadoop1 hadoop-2.5.0]$ ./bin/hdfs dfs -createSnapshot /
Created snapshot /.snapshot/s20140831-232654.464
[hadoop@hadoop1 hadoop-2.5.0]$ ./bin/hdfs dfs -ls /.snapshot
Found 2 items
drwxr-xr-x - hadoop supergroup 0 2014-08-31 23:24 /.snapshot/s20140831-232445.185
drwxr-xr-x - hadoop supergroup 0 2014-08-31 23:26 /.snapshot/s20140831-232654.464
#恢复快照
[hadoop@hadoop1 hadoop-2.5.0]$ ./bin/hdfs dfs -mkdir /tmp
[hadoop@hadoop1 hadoop-2.5.0]$ ./bin/hdfs dfs -cp /.snapshot/s20140831-232654.464 /tmp
[hadoop@hadoop1 hadoop-2.5.0]$ ./bin/hdfs dfs -cat /tmp/s20140831-232654.464/test1.txt
hello world
|
其他快照操作
列出所有可快照目录
1 |
hdfs lsSnapshottableDir
|
比较快照直接的差异
1 |
hdfs snapshotDiff <path> <fromSnapshot> <toSnapshot>
|
(责任编辑:IT) |
------分隔线----------------------------