Created on 07-07-2016 04:13 AM - edited 08-17-2019 11:34 AM
Story: From the documentation I was able to add a service to existing stack definition in Ambari.
Issue: But I was either not able to stop the service or delete the service just in case.
https://cwiki.apache.org/confluence/display/AMBARI/Defining+a+Custom+Stack+and+Services
How did I solve the problem?
cd /var/lib/ambari-server/resources/stacks/HDP/2.4/services
mkdir /var/lib/ambari-server/resources/stacks/HDP/2.4/services/SAMPLESRV
cd /var/lib/ambari-server/resources/stacks/HDP/2.4/services/SAMPLESRV
mkdir –p /var/lib/ambari-server/resources/stacks/HDP/2.4/services/SAMPLESRV/package/scriptscd /var/lib/ambari-server/resources/stacks/HDP/2.4/services/SAMPLESRV/package/scripts
Master.py and slave.py
here was the issue: in the documentation it doesn’t mention about the dummy.pid that needs to be created. Since we have not installed a real service, there is no PID file created by it. Therefore, we are going to artificially create the PID, remove the PID and check the process status of the dummy pid.
Hope this helps....
Created on 01-18-2017 10:25 AM
Hello.
I did the similar stuff and it works fine when starting\stopping service.
But for restart it fails. Looks like it runs status check after stop and status check fails because pid file is already deleted:
Traceback (most recent call last): File "/var/lib/ambari-agent/cache/stacks/HDP/2.5/services/CATALOGER/package/scripts/application.py", line 28, in <module> Master().execute() File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 280, in execute method(env) File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 709, in restart self.status(env) File "/var/lib/ambari-agent/cache/stacks/HDP/2.5/services/CATALOGER/package/scripts/application.py", line 25, in status Execute ( format("cat {pid_file}") ); File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 155, in __init__ self.env.run() File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 160, in run self.run_action(resource, action) File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 124, in run_action provider_action() File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 273, in action_run tries=self.resource.tries, try_sleep=self.resource.try_sleep) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 71, in inner result = function(command, **kwargs) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 93, in checked_call tries=tries, try_sleep=try_sleep) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 141, in _call_wrapper result = _call(command, **kwargs_copy) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 294, in _call raise Fail(err_msg) resource_management.core.exceptions.Fail: Execution of 'cat /opt/app/application.pid' returned 1. cat: /opt/app/application.pid: No such file or directory