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.

How to get automatically services started when we restart the machine?

Solved Go to solution

How to get automatically services started when we restart the machine?

Hi,

When I restarted the machine due to some problem, all the services on that particular machine are getting stopped except SmartSense agent. The only SmartSense agent is getting automatically started as soon as the machine is up. In the same way, even I want other services also get started automatically like ambari-agent, services like DN, NM, AMS, etc..,

Now my questions are: Is it possible to get all the services automatically get started same as HST agent? If no, then why is only HST getting started automatically?

Any help is highly appreciated and Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to get automatically services started when we restart the machine?

Super Guru

@Sridhar Bandaru

I have written a utility(work is still in progress) which can be very helpful in your case.

1. Clone my repository

git clone https://github.com/crazyadmins/useful-scripts.git

2. Goto useful-scripts/ambari/

3. Edit ambari.properties according to your cluster environment

4. Start using script

Here is the usage screenshot:

4406-screen-shot-2016-05-22-at-123445-am.png

Happy Hadooping!!

View solution in original post

10 REPLIES 10
Highlighted

Re: How to get automatically services started when we restart the machine?

@Sridhar Bandaru

Ambari server and agent should start after OS reboot, as far as concern about hadoop services we recommend to use Ambari UI or API's. Also there are some services to collect metrics from OS and Hadoop will start automatically.

Hope that make sense. Thanks

Highlighted

Re: How to get automatically services started when we restart the machine?

@Jitendra Yadav:

FroFrom my understanding this is the summer you mean: Ambari-server and agent will start automatically when we start the server after stop, but services won't start automatically and we need to start manually each service. In that case I always see

Highlighted

Re: How to get automatically services started when we restart the machine?

I'm saying Ambari server and agent process will start by ini.d script and I think this has been implemented long back https://issues.apache.org/jira/browse/AMBARI-1492 . The rest HDP components services like NN,SNN DN etc should start manually through Ambari UI or API's.

Highlighted

Re: How to get automatically services started when we restart the machine?

@Sridhar Bandaru

In addition to what @Jitendra Yadav mentioned if you still wish to get all services up after reboot then below are 2 options -

  1. You can use ambari api to start the service. Just club all the services according to the order they needs to be started in a script/file and put the file in /etc/rc.local. refer below link - https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=41812517

Or you can create init script of the file too so that it will act as like existing(ssh) service where you can start/stop using command and enable after reboot using chkconfig.

Pls do refer this -

https://community.hortonworks.com/questions/825/how-to-write-cluster-startup-shutdown-order-and-sc.h...

Sample script -

===========

export $PASSWORD = ***** export $CLUSTER_NAME = {Your Cluster Name} curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Start HDFS via REST"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' http://`hostname -f`:8080/api/v1/clusters/$CLUSTER_NAME/services/HDFS curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Start YARN via REST"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' http://`hostname -f`:8080/api/v1/clusters/$CLUSTER_NAME/services/YARN curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Start MAPREDUCE2 via REST"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' http://`hostname -f`:8080/api/v1/clusters/$CLUSTER_NAME/services/MAPREDUCE2

==========

2. You can use ambari blueprint to start and stop the services.

Highlighted

Re: How to get automatically services started when we restart the machine?

Thanks @Sagar Shimpi and @Jitendra Yadav for valuable information, let me try and get back to you.

Highlighted

Re: How to get automatically services started when we restart the machine?

Explorer

Could you please provide examples according to :

< 2. You can use ambari blueprint to start and stop the services.>

Thanks

Highlighted

Re: How to get automatically services started when we restart the machine?

Super Guru

@Sridhar Bandaru

I have written a utility(work is still in progress) which can be very helpful in your case.

1. Clone my repository

git clone https://github.com/crazyadmins/useful-scripts.git

2. Goto useful-scripts/ambari/

3. Edit ambari.properties according to your cluster environment

4. Start using script

Here is the usage screenshot:

4406-screen-shot-2016-05-22-at-123445-am.png

Happy Hadooping!!

View solution in original post

Highlighted

Re: How to get automatically services started when we restart the machine?

Guru

FWIW, There is API info on how to determine and restart host components on a given host.

https://cwiki.apache.org/confluence/display/AMBARI/Restart+Host+Components

And this is the JIRA for Ambari to support auto-start of services + components:

https://issues.apache.org/jira/browse/AMBARI-2330

Highlighted

Re: How to get automatically services started when we restart the machine?

Expert Contributor

Thanks Jeff for posting this Ambari case. I had read the wiki as mentioned in this thread and found "The user has to enable auto start via the UI." But I couldn't find it. Then read the jira, and it states that "Reopening since in 2.4.0 we hid this from the UI as an experimental feature."

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