Support Questions

Find answers, ask questions, and share your expertise

How to add dependencies on the custom services

avatar
Contributor

Hello,

I am following the documentation to add a custom service to the Ambari. So far, I am able to understand and create a custom service and was able to successfully add to the Ambari.

Next, I need to add the dependencies which needs to be installed prior to the custom service. For example, before deploying custom service it will install the dependencies such as SPARK, KAFKA, YARN, HDFS. For this purpose I was looking into HIVE:metainfo.xml file and could understand the below portions needs to be added in order to add the dependencies

<dependencies>
  <dependency>
    <name>ZOOKEEPER/ZOOKEEPER_SERVER</name>
    <scope>cluster</scope>
    <auto-deploy>
      <enabled>true</enabled>
      <co-locate>HIVE/HIVE_SERVER</co-locate>
    </auto-deploy>
  </dependency>
  <dependency>
    <name>YARN/YARN_CLIENT</name>
    <scope>host</scope>
    <auto-deploy>
      <enabled>true</enabled>
    </auto-deploy>
  </dependency>
  <dependency>
    <name>MAPREDUCE2/MAPREDUCE2_CLIENT</name>
    <scope>host</scope>
    <auto-deploy>
      <enabled>true</enabled>
    </auto-deploy>
  </dependency>
</dependencies>

<requiredServices>
   <service>ZOOKEEPER</service>
   <service>YARN</service>
   <service>TEZ</service>
</requiredServices>

However, there are some aspects I could not find and was not able to understand about the "dependency". So, I would like to know about:

  1. Is there some additional resources on how to add the "dependency" on the custom service ?
  2. I would like to know more about the specifics of the tags, so that I know the tags usage. For example
  3. <dependency>
        <name>ZOOKEEPER/ZOOKEEPER_SERVER</name> [How this naming are put ?]
        <scope>cluster</scope>                  [When to use which scope ?]
        <auto-deploy>
          <enabled>true</enabled>
          <co-locate>HIVE/HIVE_SERVER</co-locate>
        </auto-deploy>
     </dependency>

Thank you !

1 ACCEPTED SOLUTION

avatar
Contributor

hi @Sayed Anisul Hoque.

@1. you already linked to the resources handling custom services, maybe the sub-menu brings more light

@2. depdency.name: this is <Service>/<Component>, have a look at the other metainfo.xml definitions. As another example, if you depend on an HBase Master you would write HBASE/HBASE_MASTER

@2 dependency.scope: this is the scope the dependency has to have. In your example, 'cluster' means that a Zookeeper Server has to be installed somewhere on your cluster. When you have scope 'host' it would mean that the component Zookeeper Server has to be on the same host as your custom service.

Hope that helps.

View solution in original post

3 REPLIES 3

avatar
Contributor

hi @Sayed Anisul Hoque.

@1. you already linked to the resources handling custom services, maybe the sub-menu brings more light

@2. depdency.name: this is <Service>/<Component>, have a look at the other metainfo.xml definitions. As another example, if you depend on an HBase Master you would write HBASE/HBASE_MASTER

@2 dependency.scope: this is the scope the dependency has to have. In your example, 'cluster' means that a Zookeeper Server has to be installed somewhere on your cluster. When you have scope 'host' it would mean that the component Zookeeper Server has to be on the same host as your custom service.

Hope that helps.

avatar
Contributor

Thank you David Pocivalnik !

I have one more question. Maybe it is a bit dumb question but suppose, i have couple of component for example there's Master, Slave components. How will I know, to which component type to add the dependencies ?

avatar
Contributor

I don't know of any best practice, but I did refer to an existing service, e.g. HBase

This example shows that the dependencies are only defined for the Master component. But anyhow, it totally depends on your components. So if your slave depends on having e.g. a RegionServer on the same host you should add this dependency to your slave component. If you just require to have a RegionServer on the cluster I'd just go with defining the dependency at the Master component.

What's also important is the '<requiredServices>' section in the sample linked to above.

I hope this information helps.