Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Restart services in Ambari 2.7.1.0

Restart services in Ambari 2.7.1.0

Contributor

Hi,

I am currently using Hortonworks HDP 3.01 with ambari 2.7.1.0 but it seems that restarting all services can be a challenge because starting services/components must be done in a certain order to avoid timeouts and errors.... Is there a way to script the process? There is a section "Service Auto Start" in ambari but it doesn't seems that Ambari is smart enough to start services/componants while taking into consideration the dependencies... Could you please help?

 

Thank you

 

4 REPLIES 4

Re: Restart services in Ambari 2.7.1.0

Mentor

@Koffi 

Yes that true the startup order matters for components like Zk, ranger, etc who have specific tasks Having said that what you need is an Ambari REST  API and @jsensharma  has a good thread  on  REST API for stopping and starting all services on a node in Ambari and checking status  that should be a perfect tool.

 Happy hadooping 

Re: Restart services in Ambari 2.7.1.0

Contributor

Hi @Shelton,

Thank you for your answer. 

From the link you provided i saw the following command that is used to stop every components using the ambari api. 

curl -i -u admin:admin -H "X-Requested-By: ambari"  -X PUT  -d '{"RequestInfo":{"context":"Stop All Host Components","operation_level":{"level":"HOST","cluster_name":"Sandbox","host_names":"sandbox.hortonworks.com"},"query":"HostRoles/component_name.in(APP_TIMELINE_SERVER,DATANODE,HISTORYSERVER,METRICS_COLLECTOR,METRICS_GRAFANA,METRICS_MONITOR,NAMENODE,NFS_GATEWAY,NODEMANAGER,RANGER_ADMIN,RANGER_TAGSYNC,RANGER_USERSYNC,RESOURCEMANAGER,SECONDARY_NAMENODE,ZOOKEEPER_SERVER)"},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://localhost:8080/api/v1/clusters/Sandbox/hosts/sandbox.hortonworks.com/host_components

 I guess it gives me the order in which they will be executed... my question would be does it waits for the previous component to complete its stopping process before starting is own stopping process?

Exemple: APP_TIMELINE_SERVER, DATANODE

Does DATANODE starts its stopping process after the APP_TIMELINE_SERVER complete its process?

 

Thank you

Highlighted

Re: Restart services in Ambari 2.7.1.0

Super Mentor

@Koffi 

Each service *can* define its own role command order by including a role_command_order.json file in its service folder.

# find /var/lib/ambari-server/resources/common-services    -name "role_command_order.json"


This file also defines the order in which the dependent components should be stopped and started. It is controlled by the file "role_command_order.json" based on the version of HDP stack that you are using.


To know more about it please refer to:  https://cwiki.apache.org/confluence/display/AMBARI/Role+Command+Order

Example:

# grep 'APP_TIMELINE_SERVER' /var/lib/ambari-server/resources/stacks/HDP/3.0/role_command_order.json
    "APP_TIMELINE_SERVER-START": ["NAMENODE-START", "DATANODE-START"],

 

Example:

# grep 'DATANODE' /var/lib/ambari-server/resources/stacks/HDP/3.0/role_command_order.json
    "DATANODE-START" : ["RANGER_USERSYNC-START"],
    "DATANODE-STOP": ["RESOURCEMANAGER-STOP", "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
    .
    .
    "APP_TIMELINE_SERVER-START": ["NAMENODE-START", "DATANODE-START"],

.

 

Re: Restart services in Ambari 2.7.1.0

Mentor

@Koffi 

YES your guess is right !!!

The Ambari REST API grabs the list of components and loops over them all these components have dependencies like ie Zookeeper should be the last component shutdown because it synchronizes thee cluster HA, just like the ARM template in AZURE the "DependOn" variable so that ensure the dependencies are shut down before the component in question this is handled internally by Ambari logic.

HTH

Don't have an account?
Coming from Hortonworks? Activate your account here