Created 01-31-2020 02:11 AM
Hello
I have got strange permission problem with Ambari.
I have 2 stages, both have same configs.
Only difference in config are information about Postgres DB server.
I'm trying to stop services with curl.
Curl command:
curl -i -u admin:password -H "X-Requested-By: ambari" -X PUT -d "{"HostRoles": {"state": "INSTALLED"}}" https://ambari_server:8443/api/v1/clusters/DEV/hosts/slave01/host_components/NODEMANAGER
In Dev stage it all working.
But in test stage Ambari throws following message whet ansible triggers service stop:
INFO [ambari-client-thread-1456334] HostComponentResourceProvider:668 - Ignoring ServiceComponentHost as operation is not allowed,
What option in ambari is causing this "not allowed"?
Created on 02-10-2020 06:57 AM - edited 02-10-2020 07:02 AM
I have found a solution.
I have forgot to mention that before service is in Maintenance Mode.
To perform action with service in Maintenance Mode, it is needed to use one more parameter in rest API call.
Created 01-31-2020 02:29 AM
Your API call does not look correct... the JSON data which you are posting is not right.
Please try this kind of request.
# curl -k -i -u admin:password -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop NodeManager","operation_level":{"level":"HOST_COMPONENT","cluster_name":"DEV","host_name":"slave01","service_name":"YARN"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' https://ambari_server:8443/api/v1/clusters/DEV/hosts/slave01/host_components/NODEMANAGER
.
If it still fails in one of the env then please share the exact details about those envs:
1. Exact ambari server version from both the Envs:
# ambari-server --version
# ambari-server --hash
2. The Before making the API call on the failing cluster please make sure to put the ambari-server.log in "tail" mode so that we can see what kind of logging is appearing in amabri logs when you get following kind of INFO message
Ignoring ServiceComponentHost as operation is not allowed,
3. Are you running this API call on both the envs as Ambari Admin user?
Created on 01-31-2020 04:23 AM - edited 01-31-2020 05:10 AM
1) Ambari version is the same: 2.7.3.0-139
2) API call that you provided produces same message in ambari-server.log.
Here is log message that happens in while api call:
2020-01-31 13:03:03,939 WARN [ambari-client-thread-1469010] HostComponentResourceProvider:1014 - Can not determine request operation level. Operation level property should be specified for this request. 2020-01-31 13:03:03,940 INFO [ambari-client-thread-1469010] HostComponentResourceProvider:969 - Received a updateHostComponent request, clusterName=DEV, serviceName=YARN, componentName=NODEMANAGER, hostname=slave01, request={ clusterName=DEV, serviceName=YARN, componentName=NODEMANAGER, hostname=slave01, publicHostname=null, desiredState=INSTALLED, state=null, desiredStackId=null, staleConfig=null, adminState=null, maintenanceState=null}
2020-01-31 13:03:03,940 INFO [ambari-client-thread-1469010] HostComponentResourceProvider:668 - Ignoring ServiceComponentHost as operation is not allowed, clusterName=DEV, serviceName=YARN, componentName=NODEMANAGER, hostname=slave01, currentState=STARTED, newDesiredState=INSTALLED
2020-01-31 13:03:03,941 INFO [ambari-client-thread-1469010] AmbariManagementControllerImpl:2745 - Created 0 stages
2020-01-31 13:03:04,336 INFO [ambari-client-thread-1469010] MetricsCollectorHAManager:63 - Adding collector host : ambari_server to cluster : DEV
3) Yes, i'm using same command like i mentioned in my first message.
Only differences are cluster name, hostname for ambari server and slave hostname.
Created on 02-10-2020 06:57 AM - edited 02-10-2020 07:02 AM
I have found a solution.
I have forgot to mention that before service is in Maintenance Mode.
To perform action with service in Maintenance Mode, it is needed to use one more parameter in rest API call.