Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here. Want to know more about what has changed? Check out the Community News blog.

I got 500 server error when i tried to start the host component using REST API.what is the reason? Can anyone explain?

Highlighted

I got 500 server error when i tried to start the host component using REST API.what is the reason? Can anyone explain?

Expert Contributor

I tried to start hdfs client component on a host. Initially, i changed state to installed using REST API. Now, i am unable to put the state to STARTED. These are the REST APIs i used.

curl -u admin:password-i -H 'X-Requested-By:ambari'-X PUT -d '{"HostRoles":
{"state": "INSTALLED"}}'
http://localhost:8080/api/v1/clusters/et_cluster/hosts/serf010ext.etops.tllsc.net/host_components/HD...

Status check

curl
-u admin:password -H "X-Requested-By:ambari" -i -X GET http://localhost:8080/api/v1/clusters/et_cluster/hosts/serf010ext.etops.tllsc.net/host_components/HD... 

To start the host component :

curl -u admin:password -H 'X-Requested-By:ambari'-X PUT -d '{"HostRoles":
{"state": "STARTED"}}'
http://localhost:8080/api/v1/clusters/et_cluster/hosts/ serf010ext.etops.tllsc.net/host_components/HDFS_CLIENT
Error :
HTTP/1.1 500 Server Error 
User: admin
Set-Cookie: AMBARISESSIONID=i3xktymirjhbjtrenyi7gcvs;Path=/;HttpOnly
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: 48
Server: Jetty(8.1.17.v20150415)
{
  "status": 500,
  "message": "Server Error"
}
8 REPLIES 8

Re: I got 500 server error when i tried to start the host component using REST API.what is the reason? Can anyone explain?

Mentor

was hdfs client already installed there? perhaps it was downloading and installing the client at the time you ran start command. Try starting again after you confirm client is installed. @Ram D

Re: I got 500 server error when i tried to start the host component using REST API.what is the reason? Can anyone explain?

Expert Contributor

It was installed earlier. I am trying to stop and start the host component.I checked the status, it is in INSTALLED state. Now ran the curl command again, got the same error. What is the reason?

Re: I got 500 server error when i tried to start the host component using REST API.what is the reason? Can anyone explain?

@Ram D

Please tail /var/log/ambari-server/ambari-server.log while doing this operation to check the actual error. If you can't fix that error, post the error here please.

Re: I got 500 server error when i tried to start the host component using REST API.what is the reason? Can anyone explain?

Expert Contributor

I need to know here, does client components such as HDFS_CLIENT,ZOOKEEPER_CLIENT, MAPREDUCE2_CLIENT on hosts will have "STARTED" state?

I ran same commands to start and stop DATANODE process. Worked properly. Only for clients, i am getting error.

Re: I got 500 server error when i tried to start the host component using REST API.what is the reason? Can anyone explain?

Mentor

you don't start clients, you start services. clients are just libraries to communicate with services. @Ram D

Re: I got 500 server error when i tried to start the host component using REST API.what is the reason? Can anyone explain?

Expert Contributor

How can i install client components through REST API on particular host? Can you give example for HDFS_CLIENT?

Re: I got 500 server error when i tried to start the host component using REST API.what is the reason? Can anyone explain?

Mentor
curl -k -u admin:admin -H "X-Requested-By:ambari" -i -X PUT 
-d '{"RequestInfo":{"context":"Install YARN_CLIENT"},
"Body":{"HostRoles":{"state":"INSTALLED"}}}' 
http://<HOST>:8080/api/v1/clusters/<CLUSTER_NAME>/hosts/<HOST_FQDN>/host_components/YARN_CLIENT

here's the reference link @Ram D http://henning.kropponline.de/2015/06/07/services-and-state-with-ambari-rest-api/

Re: I got 500 server error when i tried to start the host component using REST API.what is the reason? Can anyone explain?

New Contributor