Created 08-17-2017 05:41 PM
after adding new parameter and value to the ambari cluster , we need to restart the service to take affect
from ambari GUI restart the service is required , and we can see that because restart button is colored with orange
so my question is
we need API command that restart only the services that restart is required?
Created 08-17-2017 06:28 PM
Please pardon me 😞
The URL should end with "requests" instead of "request".
Example:
# curl -u admin:admin -H "X-Requested-By: ambari" -X POST -d '{"RequestInfo":{"command":"RESTART","context":"Restart all required services","operation_level":"host_component"},"Requests/resource_filters":[{"hosts_predicate":"HostRoles/stale_configs=true"}]}' http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/requests { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/requests/132", "Requests" : { "id" : 132, "status" : "Accepted" } }
.
Created 08-17-2017 05:48 PM
Please try this:
# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X POST -d '{"RequestInfo":{"command":"RESTART","context":"Restart all required services","operation_level":"host_component"},"Requests/resource_filters":[{"hosts_predicate":"HostRoles/stale_configs=true"}]}' http://$AMBARI_SERVER:8080/api/v1/clusters/$CLUSTER_NAME/reques
.
Please replace the $AMBARI_SERVER with ambari FQDN
$CLUSTER_NAME = clustername.
.
Created 08-17-2017 05:51 PM
thank you very much - I will test it on my ambari cluster
Created 08-17-2017 05:53 PM
btw - regarding my previews question , how to find the config type for the parameter , can we talk about this ?
Created 08-17-2017 05:59 PM
Created 08-17-2017 06:06 PM
from some reason I get - HTTP/1.1 404 Not Found
Created 08-17-2017 06:09 PM
The "Restart all required services" feature is available from ambari 2.5 onwards only.
If you are getting 404 in Ambari 2.5 then you might be doing something wrong in the URL.
In my case i missed "t" at the end of th URL. The "request" became "reques" Please correct it as following:
# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X POST -d '{"RequestInfo":{"command":"RESTART","context":"Restart all required services","operation_level":"host_component"},"Requests/resource_filters":[{"hosts_predicate":"HostRoles/stale_configs=true"}]}' http://$AMBARI_SERVER:8080/api/v1/clusters/$CLUSTER_NAME/request
.
Created 08-17-2017 06:08 PM
I change the hostname and the cluster name maybe something else in the syntax
Created 08-17-2017 06:15 PM
* Trying 109.164.35.62... * Connected to master.urns.com (109.164.35.62) port 8080 (#0) * Server auth using Basic with user 'admin' > POST /api/v1/clusters/HDP01/request HTTP/1.1 > Authorization: Basic YWRtaW46YWRtaW4= > User-Agent: curl/7.29.0 > Host: master.urns.com:8080 > Accept: */* > X-Requested-By: ambari > Content-Length: 195 > Content-Type: application/x-www-form-urlencoded > * upload completely sent off: 195 out of 195 bytes < HTTP/1.1 404 Not Found HTTP/1.1 404 Not Found < X-Frame-Options: DENY X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff X-Content-Type-Options: nosniff < Cache-Control: no-store Cache-Control: no-store < Pragma: no-cache Pragma: no-cache < Set-Cookie: AMBARISESSIONID=1kmyjqsidore28zeh3nxu88c5;Path=/;HttpOnly Set-Cookie: AMBARISESSIONID=1kmyjqsidore28zeh3nxu88c5;Path=/;HttpOnly < Expires: Thu, 01 Jan 1970 00:00:00 GMT Expires: Thu, 01 Jan 1970 00:00:00 GMT < User: admin User: admin < Content-Length: 0 Content-Length: 0 < Server: Jetty(8.1.19.v20160209) Server: Jetty(8.1.19.v20160209)
Created 08-17-2017 06:21 PM
as you can see from the log hostname is ok ans the cluster name