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

why curl localhost does not work for hdp 2.6.3 ,hdp 2.5?

Hi ,
i was trying to work on hdp services
just to try for a long time i was trying to check whether curl is working or not hdp 2.6.3 + hdp2.5

i tried random commands to check network connectivity.
below are the command which i tried :-

[root@sandbox-hdp knox-server]# curl localhost curl localhost curl: (7) couldn't connect to host

[root@sandbox-hdp knox-server]# curl 127.0.0.1 curl: (7) couldn't connect to host

[root@sandbox-hdp knox-server]# curl google.com

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>302 Moved</TITLE></HEAD><BODY> <H1>302 Moved</H1> The document has moved <A HREF="http://www.google.co.in/?gfe_rd=cr&dcr=0&ei=UTFnWsWoD8-L8Qes5J3IBw">here</A>. </BODY></HTML>

How to resolve curl localhost for hdp or is it intentionally kept it that way.? ping is working for localhost and private ip addresses but curl is not working for localhost and private ip addresses in the hdp host-vm network.

1 REPLY 1

Super Mentor

@Sharda b

The Curl will work when you enter the correct syntax and the correct resource passed to it.

For example curl does not know which port on "localhost" it should communcate and which default app it should access.

So please try something like following:

#  curl -u admin:admin -H 'X-Requested-By: ambari' -X GET  http://localhost:8080/api/v1/clusters/Sandbox 


; ;