Versions Compared

Key

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

...

Now, download the latest distribution of apache OODT and extract it. There is a directory named config which contains the scripts required to publish configuration to zookeeper. Inside that directory will bebin,  conf-publisher executable and etc, examples and , lib dirrectories directories. Out of those, bin contains conf-publisher executable. etc contains log4j.xml for logging configuration and config-publisher.xml for configuring the configuration to be stored in zookeeper. examples contains some example configuration files for resource manager and file manager. For us to publish/store configuration in zookeeper, we need to modify the config-publisher.xml in the etc directory. You will find the following default content in that file out of the box.

...

Code Block
languagexml
themeEclipse
titleconfig-publisher.xml
linenumberstrue
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    <!-- Configuration publisher for File Manager OODT Component -->
    <bean id="filemgr-config-publisher" class="org.apache.oodt.config.distributed.cli.DistributedConfigurationPublisher">
        <constructor-arg value="filemgr"/>
        <property name="propertiesFiles">
            <map key-type="java.lang.String" value-type="java.lang.String">
                <entry key="../examples/filemgr/filemgr.properties" value="/etc/filemgr.properties"/>
            </map>
        </property>
        <property name="configFiles">
            <map key-type="java.lang.String" value-type="java.lang.String">
                <entry key="../examples/filemgr/mime-types.xml" value="/etc/mime-types.xml"/>
                <entry key="../examples/filemgr/cmd-line-actions.xml" value="/policy/cmd-line-actions.xml"/>
                <entry key="../examples/filemgr/cmd-line-options.xml" value="/policy/cmd-line-options.xml"/>
                <entry key="../examples/filemgr/oodt/elements.xml" value="/policy/oodt/elements.xml"/>
                <entry key="../examples/filemgr/oodt/product-types.xml" value="/policy/oodt/product-types.xml"/>
                <entry key="../examples/filemgr/oodt/product-type-element-map.xml" value="/policy/oodt/product-type-element-map.xml"/>
            </map>
        </property>
    </bean>

</beans>

...

  1. First define a bean of type org.apache.oodt.config.distributed.cli.DistributedConfigurationPublisher and give it a meaningful id. In the above example, we have given filemgr-config-publisher for the bean id. 

  2. Then set the constructor argument value of that bean to the name of the OODT component you wish to publish configuration for. In the above example, it is filemgr which is the shorthand name used internally for OODT File Manager. List of shorthand names that should be used per component is listed below. 

    Tip
    titleShorthand names for OODT components

    Following shorthand names need to be used when configuring the config-publisher.xml to publish configuration for any OODT component. Using the following naming convention is mandatory because these shorthand names are being used internally for creating ZNodes in zookeeper.

    OODT Component NameShorthand name to be used when configuring config-publisher.xml
    File Managerfilemgr
    Resource Managerresmgr
  3. Now, we have to set the properties files to be stored in zookeeper for our selected OODT component. Since properties files and other configuration files need to be treated in a different manner at run time, properties files are considered separately. Following fragment from our example config-publisher.xml shows how we should define the configuration files to be stored in zookeeper.

    Code Block
    languagexml
    <property name="propertiesFiles">
        <map key-type="java.lang.String" value-type="java.lang.String">
            <entry key="../examples/filemgr/filemgr.properties" value="/etc/filemgr.properties"/>
        </map>
    </property>

    Configuration takes a map of key value pairs where the key of each entry stands for the location (in your local machine) of the properties file to be stored in zookeeper. Value of each entry stands for the location where the corresponding properties file should be available once downloaded from zookeeper. For example,  

    <entry key="../examples/filemgr/filemgr.properties" value="/etc/filemgr.properties"/>

      says that the file located at ../examples/filemgr/filemgr.properties (relative to bin directory) needs to be available at ${OODT_COMPONENT_HOME}/etc/filemgr.properties location when being downloaded by the deployed instances. 

  4. Similarly we have to setup the configuration files other than properties files to be stored in zookeeper. Example configuration fragment is shown below. 

    Code Block
    languagexml
    <property name="configFiles">
        <map key-type="java.lang.String" value-type="java.lang.String">
            <entry key="../examples/filemgr/mime-types.xml" value="/etc/mime-types.xml"/>
            <entry key="../examples/filemgr/cmd-line-actions.xml" value="/policy/cmd-line-actions.xml"/>
            <entry key="../examples/filemgr/cmd-line-options.xml" value="/policy/cmd-line-options.xml"/>
            <entry key="../examples/filemgr/oodt/elements.xml" value="/policy/oodt/elements.xml"/>
            <entry key="../examples/filemgr/oodt/product-types.xml" value="/policy/oodt/product-types.xml"/>
            <entry key="../examples/filemgr/oodt/product-type-element-map.xml" value="/policy/oodt/product-type-element-map.xml"/>
        </map>
    </property>

    As explained in the previous point, we have to give a mapping of local files to be stored in zookeeper along with the desired location of those files to be available relatively to ${OODT_COMPONENT_HOME} during run time. For example, 

    <entry key="../examples/filemgr/oodt/product-types.xml" value="/policy/oodt/product-types.xml"/>

    says that the file located at ../examples/filemgr/oodt/product-types.xml (relative to bin directory) needs to be available at ${OODT_COMPONENT_HOME}//policy/oodt/product-types.xml location when being downloaded by the deployed instances. 

  5. We have now finished configuring the configuration publisher for file manager OODT component in the above steps. Similarly we can configure configuration publisher beans for other OODT components as per our requirement.

...

Code Block
languagetext
ubuntu@ubuntu: bin$ ./conf-publisher -connectString 127.0.0.1:2181 -publish


Starting Distributed Configuration Publisher 
log4j:WARN Continuable parsing error 40 and column 23
log4j:WARN The content of element type "log4j:configuration" must match "(renderer*,appender*,(category|logger)*,root?,categoryFactory?)".
Starting configuration publishing
INFO ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6ed3ef1: display name [org.springframework.context.support.ClassPathXmlApplicationContext@6ed3ef1]; startup date [Sun Jul 09 18:11:50 IST 2017]; root of context hierarchy
INFO XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [etc/config-publisher.xml]
INFO ClassPathXmlApplicationContext - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@6ed3ef1]: org.springframework.beans.factory.support.DefaultListableBeanFactory@5b464ce8
INFO DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5b464ce8: defining beans [filemgr-config-publisher]; root of factory hierarchy
INFO DistributedConfigurationPublisher - Using zookeeper connect string : 127.0.0.1:2181
INFO DistributedConfigurationPublisher - Curator framework start operation invoked
INFO DistributedConfigurationPublisher - Waiting to connect to zookeeper, startupTimeout : 30000
INFO DistributedConfigurationPublisher - CuratorFramework client started successfully


Processing commands for component : filemgr
Publishing configuration for : filemgr
INFO DistributedConfigurationPublisher - Publishing configuration ../examples/filemgr/filemgr.properties - /etc/filemgr.properties
INFO DistributedConfigurationPublisher - Replaced old published configuration at /etc/filemgr.properties with content of file : ../examples/filemgr/filemgr.properties
INFO DistributedConfigurationPublisher - Properties files published successfully
INFO DistributedConfigurationPublisher - Publishing configuration ../examples/filemgr/mime-types.xml - /etc/mime-types.xml
INFO DistributedConfigurationPublisher - Replaced old published configuration at /etc/mime-types.xml with content of file : ../examples/filemgr/mime-types.xml
INFO DistributedConfigurationPublisher - Publishing configuration ../examples/filemgr/cmd-line-actions.xml - /policy/cmd-line-actions.xml
INFO DistributedConfigurationPublisher - Replaced old published configuration at /policy/cmd-line-actions.xml with content of file : ../examples/filemgr/cmd-line-actions.xml
INFO DistributedConfigurationPublisher - Publishing configuration ../examples/filemgr/cmd-line-options.xml - /policy/cmd-line-options.xml
INFO DistributedConfigurationPublisher - Replaced old published configuration at /policy/cmd-line-options.xml with content of file : ../examples/filemgr/cmd-line-options.xml
INFO DistributedConfigurationPublisher - Publishing configuration ../examples/filemgr/oodt/elements.xml - /policy/oodt/elements.xml
INFO DistributedConfigurationPublisher - Replaced old published configuration at /policy/oodt/elements.xml with content of file : ../examples/filemgr/oodt/elements.xml
INFO DistributedConfigurationPublisher - Publishing configuration ../examples/filemgr/oodt/product-types.xml - /policy/oodt/product-types.xml
INFO DistributedConfigurationPublisher - Replaced old published configuration at /policy/oodt/product-types.xml with content of file : ../examples/filemgr/oodt/product-types.xml
INFO DistributedConfigurationPublisher - Publishing configuration ../examples/filemgr/oodt/product-type-element-map.xml - /policy/oodt/product-type-element-map.xml
INFO DistributedConfigurationPublisher - Replaced old published configuration at /policy/oodt/product-type-element-map.xml with content of file : ../examples/filemgr/oodt/product-type-element-map.xml
INFO DistributedConfigurationPublisher - Config files published successfully
Published configuration for : filemgr
INFO DistributedConfigurationPublisher - Configuration publisher destroyed
INFO DistributedConfigurationPublisher - Exiting CLI ...
Finished

...