Bird
0
0

Which of the following is the correct command to restart a service using Ambari's REST API?

easy📝 Syntax Q3 of 15
Hadoop - Cluster Administration
Which of the following is the correct command to restart a service using Ambari's REST API?
Acurl -u admin:admin -X POST http://ambari-server:8080/api/v1/clusters/cluster1/services/HDFS -d '{"RequestInfo":{"context":"Restart HDFS"}}'
Bcurl -u admin:admin -X DELETE http://ambari-server:8080/api/v1/clusters/cluster1/services/HDFS
Ccurl -u admin:admin -X GET http://ambari-server:8080/api/v1/clusters/cluster1/services/HDFS/restart
Dcurl -u admin:admin -X PUT http://ambari-server:8080/api/v1/clusters/cluster1/services/HDFS -d '{"RequestInfo":{"context":"Restart HDFS"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}'
Step-by-Step Solution
Solution:
  1. Step 1: Understand Ambari REST API restart syntax

    Restart uses PUT with state set to INSTALLED to stop, then STARTED to start service.
  2. Step 2: Analyze options

    curl -u admin:admin -X PUT http://ambari-server:8080/api/v1/clusters/cluster1/services/HDFS -d '{"RequestInfo":{"context":"Restart HDFS"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' uses PUT with correct JSON to change service state, which is correct. POST and GET are incorrect methods here. DELETE removes service, not restart.
  3. Final Answer:

    PUT with state INSTALLED to restart service -> Option D
  4. Quick Check:

    Restart service = PUT with state change [OK]
Quick Trick: Use PUT with state change to restart service in Ambari API [OK]
Common Mistakes:
  • Using GET or POST instead of PUT
  • Deleting service instead of restarting

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Hadoop Quizzes