码迷,mamicode.com
首页 > 其他好文 > 详细

Amabri:如何删除或停止指定的服务

时间:2016-12-26 18:38:26      阅读:263      评论:0      收藏:0      [点我收藏+]

标签:provided   move   before   rect   text   ade   cal   package   tar   

原文地址:https://cwiki.apache.org/confluence/display/AMBARI/Using+APIs+to+delete+a+service+or+all+host+components+on+a+host

From 1.4.3 onwards you need to add "X-Requested-By" header to all curl calls.

E.g. curl -i -uadmin:admin -H "X-Requested-By: ambari" -d ‘{"HostRoles": { "state": "STARTED"}}‘ -X PUT ‘http://localhost:8080/api/v1/clusters/c1/host_components?HostRoles/stale_configs=false

Removing a Service (2.1.0)

Verified against releases 2.1.0

Note: These API calls do not uninstall the packages associated with the service and neither they remove the config or temp folders associated with the service components. 

Before the PUT or DELETE calls, you can do a GET to ensure that the API is referring to a valid resource.

1. Note all the host components associated with the service.
curl -u admin:admin -H "X-Requested-By: ambari" -X GET  http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/services/SERVICENAME

2. Ensure the service is stopped (you can use the Ambari Web-UI to stop the service as well)

Stop the whole service (ensure correct values are provided for AMBARI_SERVER_HOST, SERVICE_NAME):
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d ‘{"RequestInfo":{"context":"Stop Service"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}‘ http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/services/SERVICE_NAME

Stop individual components (ensure correct values are provided for AMBARI_SERVER_HOST, HOSTNAME, COMPONENT_NAME):
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d ‘{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}‘ http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/hosts/HOSTNAME/host_components/COMPONENT_NAME

3. Delete the whole SERVICE

curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE  http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/services/SERVICENAME

Amabri:如何删除或停止指定的服务

标签:provided   move   before   rect   text   ade   cal   package   tar   

原文地址:http://www.cnblogs.com/huiy/p/6223255.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!