Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Are there APIs for HDFS snapshot operations?

Are there APIs for HDFS snapshot operations?

New Contributor

Hi all,

 
1: Is there a API to create snapshot? 
Now we can create snapshot for certain directories in HDFS by command, such as "hdfs dfs -createSnapshot /tmp/sntest snapshot3". 
 
2: Is there a API to read snapshot files?
After snapshot creation, there is a folder named .snapshot to store snapshot files. Currently I copy them to local then read them. Is there API to read snapshot file content directly without copy to local?
 
Thanks,
Jack Chen
1 REPLY 1

Re: Are there APIs for HDFS snapshot operations?

Master Guru

For (1): The documenation page at http://archive.cloudera.com/cdh5/cdh/5/hadoop/hadoop-project-dist/hadoop-hdfs/HdfsSnapshots.html#Sna... lists all CLI Operations along with an equivalent API call one can use to perform the same. The Java class specifically, is org.apache.hadoop.hdfs.client.HdfsAdmin.

 

For (2): These snapshot files can be queried like regular HDFS files, so you can run commands such as hadoop fs -cat, etc. on them.