Support Questions

Find answers, ask questions, and share your expertise

How can I get fsimage with curl command?

avatar
Contributor

I authenticated with hadoop-admin user.

 

hdfs dfsadmin -fetchImage ./output

 

command works well.

 

However, when I try to do this with curl command, 

 

curl https://{namenode_address}:9470/imagetransfer?getimage=1&txid=latest

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 401 Authentication required</title>
</head>
<body><h2>HTTP ERROR 401</h2>
<p>Problem accessing /imagetransfer. Reason:
<pre> Authentication required</pre></p>
</body>
</html>

 

Which authentication is needed additionally?

2 REPLIES 2

avatar
Expert Contributor

Hi @sipocootap2 ,

 

AFAIK "/getimage" is deprecated in CDH and we suggest this not to be used. Instead you can use the command "hdfs dfsadmin -fetchImage <dir>" to download & save the latest fsimage.

 

Based on research, in earlier versions of CDH, the getImage method was available after which a need was realized to provide a proper command/utility to download the FSimage and as a result of which "hdfs dfsadmin -fetchImage" was born. Once that was put in place, the getImage was removed.

 

Does that answers your questions ? If yes, feel free to mark this post as "accept as solution"

 

Regards,

 

 

avatar
Contributor

Hi @kingpin.

Thanks for the reply.

Is there an official document that "/getimage" is deprecated? Cause I couldn't find it.

When I run "hdfs dfsadmin -fetchImage" command, it also calls the same curl command.

I could get fsimage with hdfs command, but I want to figure out the reason why curl fails.