- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to get automatically services started when we restart the machine?
- Labels:
-
Apache Ambari
Created ‎05-21-2016 01:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created on ‎05-21-2016 07:02 PM - edited ‎08-18-2019 04:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
Happy Hadooping!! 🙂
Created ‎05-21-2016 01:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Created ‎05-21-2016 02:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Created ‎05-21-2016 02:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎05-21-2016 02:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In addition to what @Jitendra Yadav mentioned if you still wish to get all services up after reboot then below are 2 options -
- 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 -
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.
Created ‎05-21-2016 02:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @Sagar Shimpi and @Jitendra Yadav for valuable information, let me try and get back to you.
Created ‎01-27-2017 04:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you please provide examples according to :
< 2. You can use ambari blueprint to start and stop the services.>
Thanks
Created on ‎05-21-2016 07:02 PM - edited ‎08-18-2019 04:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
Happy Hadooping!! 🙂
Created ‎05-23-2016 12:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
Created ‎10-11-2016 04:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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."
