Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

curl command give no output on https connection

avatar
Explorer

curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET -k https://ambariserver1.cloudapp.net:8440/api/v1/clusters/hdptest

HTTP/1.1 200 OK Content-Length: 0 Server: Jetty(8.1.19.v20160209)

No output other than 200 code.

1 ACCEPTED SOLUTION

avatar
Master Mentor

@JJ

You seems to be hitting the Cloud Manager URL. https://ambariserver1.cloudapp.net:8440

1. Please check if your ambari is actually running on HTTPS or not? And what is the SSL Port.

# grep 'ssl' /etc/ambari-server/conf/ambari.properties
api.ssl=true
client.api.ssl.port=8443

If the grep 'ssl' does not return any value then it means your ambari server is not listening on Secure Port.

2. Check on which port the ambari server listening to:

# netstat -tnlpa | grep `cat /var/run/ambari-server/ambari-server.pid`
tcp6       0      0 :::8080                 :::*                    LISTEN      27953/java          
tcp6       0      0 :::8440                 :::*                    LISTEN      27953/java          
tcp6       0      0 :::8441                 :::*                    LISTEN      27953/java  

.

Ambari Server uses the following ports:

8440 (https): Handshake Port for Ambari Agents to Ambari Server.

8441 (https): Registration and Heartbeat Port for Ambari Agents to Ambari Server

8080 (http): Interface to Ambari Web and Ambari REST API

3. So please check what is the client API port. Usually it is 8080.

4. Now try accessing the Rest Call on Rest Port.

Try using Hostname:

# curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET  http://ambariserver1.cloudapp.net:8080/api/v1/clusters/hdptest
(OR)
# curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET -k https://ambariserver1.cloudapp.net:8443/api/v1/clusters/hdptest

Try using IP Address of Ambari Server as well.

# curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET  http://10.10.10.10:8080/api/v1/clusters/hdptest
(OR)
# curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET -k https://10.10.10.10:8443/api/v1/clusters/hdptest

.

Assuming that 10.10.10.10 is your ambari server ip address.

If your Ambari Server is running on 8443 port (https) for Rest APIs then replace 8080 with 8443 and then try.

View solution in original post

4 REPLIES 4

avatar
Master Guru

Is that the correct port? Are you running SSL? Do you have a firewall?

when I run that against mine

curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET -k http://princeton0.field.hortonworks.com:8080/api/v1/clusters/princeton0

I get a ton of JSON

...

}, { "href" : "http://princeton0.field.hortonworks.com:8080/api/v1/clusters/princeton0/alert_definitions/83", "AlertDefinition" : { "cluster_name" : "princeton0", "id" : 83, "label" : "Ambari Server Alerts", "name" : "ambari_server_stale_alerts" } } ], "artifacts" : [ ]

avatar
Explorer

Answer to your question

Is that the correct port? yes its correct

Are you running SSL? yes ( cluster created from cloudbreak)

Do you have a firewall? yes, ports are opened

i am not able to trace the issue

avatar
Master Mentor

@JJ

You seems to be hitting the Cloud Manager URL. https://ambariserver1.cloudapp.net:8440

1. Please check if your ambari is actually running on HTTPS or not? And what is the SSL Port.

# grep 'ssl' /etc/ambari-server/conf/ambari.properties
api.ssl=true
client.api.ssl.port=8443

If the grep 'ssl' does not return any value then it means your ambari server is not listening on Secure Port.

2. Check on which port the ambari server listening to:

# netstat -tnlpa | grep `cat /var/run/ambari-server/ambari-server.pid`
tcp6       0      0 :::8080                 :::*                    LISTEN      27953/java          
tcp6       0      0 :::8440                 :::*                    LISTEN      27953/java          
tcp6       0      0 :::8441                 :::*                    LISTEN      27953/java  

.

Ambari Server uses the following ports:

8440 (https): Handshake Port for Ambari Agents to Ambari Server.

8441 (https): Registration and Heartbeat Port for Ambari Agents to Ambari Server

8080 (http): Interface to Ambari Web and Ambari REST API

3. So please check what is the client API port. Usually it is 8080.

4. Now try accessing the Rest Call on Rest Port.

Try using Hostname:

# curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET  http://ambariserver1.cloudapp.net:8080/api/v1/clusters/hdptest
(OR)
# curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET -k https://ambariserver1.cloudapp.net:8443/api/v1/clusters/hdptest

Try using IP Address of Ambari Server as well.

# curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET  http://10.10.10.10:8080/api/v1/clusters/hdptest
(OR)
# curl -u admin:admin -H "X-Requested-By: ambari" -i -X GET -k https://10.10.10.10:8443/api/v1/clusters/hdptest

.

Assuming that 10.10.10.10 is your ambari server ip address.

If your Ambari Server is running on 8443 port (https) for Rest APIs then replace 8080 with 8443 and then try.

avatar
Explorer

Its my bad, you are correct

8080 (http): Interface to Ambari Web and Ambari REST API its work to me

correct i am earlier hitting cloud manager url.