Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

What is the correct way to add a Service to Ambari via REST API while each worker node should have the service

avatar

we have ambari cluster and HDP version 2.6.5

 

we want to add the service OOZIE on specific nodes in our cluster

 

for example - we have 10 workers machines in the HDP cluster

 

so we want to add he service OOZIE on each worker machine

 

from documentation we found the following API that really add the service to ambari

 

curl --user admin:admin -H "X-Requested-By: ambari" -i -X POST -d '{"ServiceInfo":{"service_name":"OOZIE"}}' http://localhost:8080/api/v1/clusters/HDP/services

 

but we not succeeded to improve the API in order to install the service OOZIE on each worker node

 

the final target is to add the service to amabri while each worker node in amabri should have the service OOZIE

 

any ideas how to continue from this stage?

Michael-Bronson
7 REPLIES 7

avatar
Master Collaborator

@mike_bronson7 

Follow the below steps to install Oozie through api 

- Add service component:

# curl -u admin:<password> -iv -H 'X-Requested-By: ambari' -X POST http://<Ambari Host>:<Port>/api/v1/clusters/<Cluster Name>/services/OOZIE/components/OOZIE_SERVER

# curl -u admin:<password> -iv -H 'X-Requested-By: ambari' -X POST http://<Ambari Host>:<Port>/api/v1/clusters/<Cluster Name>/services/OOZIE/components/OOZIE_CLIENT

- Add host component:

# curl -u admin:<password> -iv -H 'X-Requested-By:ambari' -i -X POST -d '{'host_components' : [{'HostRoles':{'component_name':'OOZIE_CLIENT'}}] }' http://<Ambari Host>:<Port>/api/v1/clusters/<Cluster Name>/hosts?Hosts/host_name=<HOST NAME>


# curl -u admin:<password> -iv -H 'X-Requested-By:ambari' -i -X POST -d '{'host_components' : [{'HostRoles':{'component_name':'OOZIE_SERVER'}}] }' http://<Ambari Host>:<Port>/api/v1/clusters/<Cluster Name>/hosts?Hosts/host_name=<HOST NAME>

- Install service:

# curl -u admin:<password> -iv -H 'X-Requested-By: ambari' -X PUT -d '{'ServiceInfo': {'state' : 'INSTALLED'}}' http://<Ambari Host>:<Port>/api/v1/clusters/<Cluster name>/services/OOZIE

avatar

I have another issue that is related but it happens when I install component from amabri 

 

from host I do --> Add --> install hbase master

 

but I get the following 

 

Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/hook.py", line 37, in <module>
    BeforeInstallHook().execute()
  File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py", line 375, in execute
    method(env)
  File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/hook.py", line 28, in hook
    import params
  File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/params.py", line 110, in <module>
    hbase_user_dirs = format("/home/{hbase_user},/tmp/{hbase_user},/usr/bin/{hbase_user},/var/log/{hbase_user},{hbase_tmp_dir}")
  File "/usr/lib/ambari-agent/lib/resource_management/libraries/functions/format.py", line 95, in format
    return ConfigurationFormatter().format(format_string, args, **result)
  File "/usr/lib/ambari-agent/lib/resource_management/libraries/functions/format.py", line 59, in format
    result_protected = self.vformat(format_string, args, all_params)
  File "/usr/lib64/python2.7/string.py", line 549, in vformat
    result = self._vformat(format_string, args, kwargs, used_args, 2)
  File "/usr/lib64/python2.7/string.py", line 582, in _vformat
    result.append(self.format_field(obj, format_spec))
  File "/usr/lib64/python2.7/string.py", line 599, in format_field
    return format(value, format_spec)
  File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/config_dictionary.py", line 73, in __getattr__
    raise Fail("Configuration parameter '" + self.name + "' was not found in configurations dictionary!")
resource_management.core.exceptions.Fail: Configuration parameter 'hbase-env' was not found in configurations dictionary!

 

Michael-Bronson

avatar
Master Collaborator

@mike_bronson7  Can you try reinstall hbase service if it is a freshly installed service OR try copying hbase-env under /etc/hbase/conf/

avatar

I have already the files

 

ls /etc/hbase/conf/
hadoop-metrics2-hbase.properties hbase-env.cmd hbase-env.sh hbase-policy.xml hbase-site.xml log4j.properties regionservers

Michael-Bronson

avatar

actually what I want to do is to use API to install HBASE , with all hbase component

so when you wrote the OOZIE procedure , what is the API to add HBASE insted OOZIE? 

Michael-Bronson

avatar

this is what I have now in ambari

 

Capture.PNG

Michael-Bronson

avatar

now I want to add the component as HBASE master and RegionServers and Phoenix Query Servers

Michael-Bronson