- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
API + restart the services that restart is required
- Labels:
-
Apache Ambari
-
Apache Hadoop
Created ‎08-17-2017 05:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you very much - I will test it on my ambari cluster
Created ‎08-17-2017 05:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎08-17-2017 06:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
from some reason I get - HTTP/1.1 404 Not Found
Created ‎08-17-2017 06:09 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I change the hostname and the cluster name maybe something else in the syntax
Created ‎08-17-2017 06:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
* 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
as you can see from the log hostname is ok ans the cluster name
