Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Modify the metainfo.xml

    Code Block
                    <component>
                        <name>SAMPLESRV_CLIENT</name>
                        <displayName>Sample Srv Client</displayName>
                        <category>CLIENT</category>
                        <cardinality>1+</cardinality>
                        <commandScript>
                            <script>scripts/sample_client.py</script>
                            <scriptType>PYTHON</scriptType>
                            <timeout>600</timeout>
                        </commandScript>
                        <configFiles>
                          <configFile>
                            <type>xml</type>
                            <fileName>test-config.xml</fileName>
                            <dictionaryName>test-config</dictionaryName>
                          </configFile>
                        </configFiles>
                    </component>    
  2. Create a directory for the configuration dictionary file SAMPLESRV/configuration.

    Code Block
    mkdir -p configuration
    cd configuration
  3. Create the test-config.xml file. For example:

    Code Block
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
    
    <configuration>
      <property>
        <name>some.test.property</name>
        <value>this.is.the.default.value</value>
        <description>This is a test description.</description>
      </property>
      <property>
        <name>another.test.property</name>
        <value>5</value>
        <description>This is a second test description.</description>
      </property>
    </configuration>
    
    
  4. There is an optional setting "configuration-dir".  Custom services should either not include the setting or should leave it as the default value "configuration".

     

    Code Block
    <configuration-dir>configuration</configuration-dir>
  5. Configuration dependencies can be included in the metainfo.xml in the a "configuration-dependencies" section.  This section can be added to the service as a whole or a particular component. One of the implications of this dependency is that whenever the config-type is updated, Ambari automatically marks the component or service as requiring restart.
    Code Block
          <configuration-dependencies>
            <config-type>core-site</config-type>
            <config-type>hdfs-site</config-type>
          </configuration-dependencies>

     

     

...