Support Questions
Find answers, ask questions, and share your expertise

Creating Linux file named 'timestamp_epoch time' & saving FSI Image

Creating Linux file named 'timestamp_epoch time' & saving FSI Image

New Contributor

How to create a file in Linux named 'timestamp_epoch time' & uploading this file to hdfs and saving the latest fsimage to Linux filesystem in such a way that it should contain the file with epoch time created earlier.

4 REPLIES 4

Re: Creating Linux file named 'timestamp_epoch time' & saving FSI Image

Champion
I couldnt understand the requirement , whats the need to put in hdfs ? Could you be more specific about the issue

Re: Creating Linux file named 'timestamp_epoch time' & saving FSI Image

New Contributor

how to create file with epoch timestamp in linux , take fsi image into it ?. I hope it makes more clearer.  

Re: Creating Linux file named 'timestamp_epoch time' & saving FSI Image

Super Guru

@Girish1980,

 

Sorry, but it is still hard to understand what you want to do and why.

 

So you create a file on linux with a filename that is an epoch timestamp:

 

1535175604

 

Then you use hdfs dfs -put 1535175604 /some/dir

 

Then you want to know when that new file written to hdfs will be on disk in the fsimage file?

If so, then on the standby or secondary namenode that update file metadata would be merged from edit to fsimage during the next checkpoint.

 

This blog entry is older, but it still explains the checkpointing pretty well:

 

https://blog.cloudera.com/blog/2014/03/a-guide-to-checkpointing-in-hadoop/

 

Re: Creating Linux file named 'timestamp_epoch time' & saving FSI Image

New Contributor

@Girish1980:

 

Please follow the below steps :

 

1. Create the file with timestamp :

>  touch timestamp_`date +"%s"`

2. upload the file in hdfs location.

> hdfs dfs -put timestamp_1615114389 /data

3. To save the latest fsimage add the namenode in safemode

> hdfs dfsadmin -safemode enter

4. save the latest fsimage

> hdfs dfsadmin -saveNamespace

5. After saving the latest fsimage safemode disable

>hdfs dfsadmin -safemode leave

6. download the latest fsimage to local system directory

>hdfs dfsadmin –fetchImage /data

7. Read the fsimage file to check timestamp_file by converting into xml file

> hdfs oiv -p XML -i fsimage_0000000000000055633 -o fsimage.xml