REST API를 사용하여 서비스 확인 요청을 실행하면 ambari가 실행을 허용하고 json 응답이 즉시 제공됩니다 (서비스 확인 완료 전에). 따라서 응답 json은 요청 ID, 요청의 현재 상태 및 요청 상태를 모니터하기위한 URL을 나타냅니다.
{
"href" : "http://localhost:8080/api/v1/clusters/DEMO/requests/182",
"Requests" : {
"id" : 182,
"status" : "Accepted"
}
json 응답으로 반환 된 URL을 사용하여 서비스 확인 상태를 모니터링 할 수 있습니다. 서비스 점검이 성공적으로 완료되었는지 또는 실패했는지를 나타내는 예 "request_status" : "FAILED"
이 예입니다.
$ curl -u admin:admin -XGET http://localhost:8080/api/v1/clusters/DEMO/requests/182
{
"href" : "http://localhost:8080/api/v1/clusters/DEMO/requests/182",
"Requests" : {
"aborted_task_count" : 0,
"cluster_name" : "DEMO",
"completed_task_count" : 1,
"create_time" : 1505153613045,
"end_time" : 1505153724897,
"exclusive" : false,
"failed_task_count" : 1,
"id" : 182,
"inputs" : "{}",
"operation_level" : null,
"progress_percent" : 100.0,
"queued_task_count" : 0,
"request_context" : "HDFS Service Check",
"request_schedule" : null,
"request_status" : "FAILED",
"resource_filters" : [
{
"service_name" : "HDFS"
}
],
"start_time" : 1505153613139,
"task_count" : 1,
"timed_out_task_count" : 0,
"type" : "COMMAND"
},
"stages" : [
{
"href" : "http://localhost:8080/api/v1/clusters/DEMO/requests/182/stages/0",
"Stage" : {
"cluster_name" : "DEMO",
"request_id" : 182,
"stage_id" : 0
}
}
],
"tasks" : [
{
"href" : "http://localhost:8080/api/v1/clusters/DEMO/requests/182/tasks/1314",
"Tasks" : {
"cluster_name" : "DEMO",
"id" : 1314,
"request_id" : 182,
"stage_id" : 0
}
}
]
}
어떤 API를 사용 했습니까 (완료 REST 통화)? – Shubhangi
CURL 명령 : curl -ivk -H "X-Requested-By : ambari"-u : -X POST -d @payload http : // : 8080/api/v1/clusters// –
페이로드를 요청 : { "RequestInfo를": "HDFS 서비스 확인", "명령": { "컨텍스트" "HDFS_SERVICE_CHECK" }, "요청/resource_filters"[ { "SERVICE_NAME을": "HDFS를 " } ] –