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:
Step 1: Understand Ambari REST API restart syntax
Restart uses PUT with state set to INSTALLED to stop, then STARTED to start service.
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.
Final Answer:
PUT with state INSTALLED to restart service -> Option D
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
Master "Cluster Administration" in Hadoop
9 interactive learning modes - each teaches the same concept differently