Support Questions

Find answers, ask questions, and share your expertise

rest api via knox will get 404 error

avatar
Contributor

Hi All,

i want use curl command to access HDFS via Knox, but always response

HTTP/1.1 404 Not Found error.

command example:

curl -u admin:admin-password -i -v -k "https://KnoxHostName:8443/gateway/default/webhdfs/v1/user/hdfs&op=GETFILESTATUS"

and i know how to use curl to create/modify folder or file when url host is Name node with 50070 port, just don't know how to via knox,

if any other configs need to setting?

My Knox version is 0.12

Thanks.

1 ACCEPTED SOLUTION

avatar
Super Guru

Hi @Sen Ke,

Do you have webhdfs defined in your topology file?

If you are using sandbox, open /usr/hdp/current/knox-server/conf/topologies/knox_sample.xml and add

<service>
  <role>WEBHDFS</role>
  http://sandbox.hortonworks.com:50070/webhdfs
</service>

If you are not using a sandbox, go to Knox->Configs->Advanced Config->Advanced topology and add

 <service>
     <role>WEBHDFS</role>
    http://<namenode-host>:<namenode-port>/webhdfs
</service>

Thanks,

Aditya

View solution in original post

3 REPLIES 3

avatar
Super Guru

Hi @Sen Ke,

Do you have webhdfs defined in your topology file?

If you are using sandbox, open /usr/hdp/current/knox-server/conf/topologies/knox_sample.xml and add

<service>
  <role>WEBHDFS</role>
  http://sandbox.hortonworks.com:50070/webhdfs
</service>

If you are not using a sandbox, go to Knox->Configs->Advanced Config->Advanced topology and add

 <service>
     <role>WEBHDFS</role>
    http://<namenode-host>:<namenode-port>/webhdfs
</service>

Thanks,

Aditya

avatar
Contributor

i'm not using sandbox, and after install knox, ambari has auto create default.xml include

<service>
<role>WEBHDFS</role>
{{webhdfs_service_urls}}
</service>

because not work, i tried modified to

<service>
<role>WEBHDFS</role>
<url>http://My_NameNode:50070</url>
</service>

still not work,

now, i tried modify to

<service>
<role>WEBHDFS</role>
<url>http://My_NameNode:50070/webhdfs</url>
</service>

i got another error, anywhere, seens passed 404 not found now,

problem is service url wrong.

Very Thanks for your information.

avatar
Super Guru

@Sen Ke,

can you please accept the answer if it worked for you. This will be helpful for the community.

Thanks,

Aditya