3. Set Up the Oozie Configuration Files

Complete the following instructions to set up Oozie configuration files:

  1. Extract the Oozie configuration files to a temporary directory.

    The files are located in the configuration_files/oozie directory where you decompressed the companion files.

  2. Modify the configuration files, based on your environment and Oozie database type.

    • For Derby:

      In the temporary directory, locate the following file and modify the properties. Search for TODO in the files for the properties to replace.

      1. Edit the oozie-site.xml and modify the following properties:

        <property>       
         <name>oozie.base.url</name>       
         <value>http://$oozie.full.hostname:11000/oozie</value>  
         <description>Enter your Oozie server hostname.</description>
        </property>
        <property>       
         <name>oozie.service.Store­Service.jdbc.url</name>       
         <value>jdbc:derby:$OOZIE_DATA_DIR/$soozie.db.schema.name-db;create=true</value>  
        
        </property>
        <property>       
         <name>oozie.service.JPAService.jdbc.driver</name>       
         <value>org.apache.derby.jdbc.EmbeddedDriver</value>  
        </property>
        <property>       
         <name>oozie.service.JPAService.jdbc.username</name>       
         <value>$OOZIE_DBUSER</value>  
        </property>
        <property>       
         <name>oozie.service.JPAService.jdbc.password</name>       
         <value>$OOZIE_DBPASSWD</value>  
        </property>
        <property>
          <name>oozie.service.WorkflowAppService.system.libpath</name>
          <value>/user/$OOZIE_USER/share/lib</value>
        </property>
    • For MySQL:

      1. Install and start MySQL 5.x .

        [Note]Note

        See Metastore Database Requirements for supported versions and Installing and Configuring MySQL 5.x for instructions.

      2. Create the Oozie database and Oozie MySQL user. For example, using the MySQL mysql command-line tool:

        $ mysql -u root -p
        Enter password: ******
        
        mysql> create database oozie;
        Query OK, 1 row affected (0.03 sec)
        
        mysql> grant all privileges on oozie.* to 'oozie'@'localhost' identified by 'oozie';
        Query OK, 0 rows affected (0.03 sec)
        
        mysql> grant all privileges on oozie.* to 'oozie'@'%' identified by 'oozie';
        Query OK, 0 rows affected (0.03 sec)
        
        mysql> exit
        Bye
      3. Configure Oozie to use MySQL.

        Edit properties in the oozie-site.xml file as follows:

        ... <property>
               <name>oozie.service.JPAService.jdbc.driver</name>
               <value>com.mysql.jdbc.Driver</value>
             </property>
             <property>
               <name>oozie.service.JPAService.jdbc.url</name>
               <value>jdbc:mysql://localhost:3306/oozie</value>
             </property>
             <property>
                <name>oozie.service.JPAService.jdbc.username</name>
                <value>oozie</value>
             </property>
             <property>
                <name>oozie.service.JPAService.jdbc.password</name>
                <value>oozie</value>
             </property>
         ...
        [Note]Note

        In the JDBC URL property, replace localhost with the hostname where MySQL is running.

      4. Add the MySQL JDBC driver JAR to Oozie.

        Copy or symlink the MySQL JDBC driver JAR into the /var/lib/oozie/ directory.

        [Note]Note

        You must manually download the MySQL JDBC driver JAR file.

    • For Postgres:

      1. Install PostgreSQL 8.4.x or 9.0.x.

        [Note]Note

        See Metastore Database Requirements for supported versions and Installing and Configuring MySQL 5.x for instructions.

      2. Create the Oozie user and Oozie database. For example, using the Postgres psql command-line tool:

         $ psql -U postgres
         Password for user postgres: *****
         postgres=# CREATE ROLE oozie LOGIN ENCRYPTED PASSWORD 'oozie'
           NOSUPERUSER INHERIT CREATEDB NOCREATEROLE;
         CREATE ROLE
        
         postgres=# CREATE DATABASE "oozie" WITH OWNER = oozie
         ENCODING = 'UTF8'
         TABLESPACE = pg_default
         LC_COLLATE = 'en_US.UTF8'
         LC_CTYPE = 'en_US.UTF8'
         CONNECTION LIMIT = -1;
         CREATE DATABASE
        
         postgres=# \q
      3. Configure Postgres to accept network connections for user oozie.

        Edit the Postgres data/pg_hba.conf file as follows:

        host oozie oozie 0.0.0.0/0 md5
      4. Reload the Postgres configuration.

        $ sudo -u postgres pg_ctl reload -s -D /opt/PostgresSQL/8.4/data
      5. Configure Oozie to use Postgres.

        Edit the oozie-site.xml file as follows:

        ... <property>
              <name>oozie.service.JPAService.jdbc.driver</name>
              <value>org.postgresql.Driver</value>
            </property>
            <property>
              <name>oozie.service.JPAService.jdbc.url</name>
              <value>jdbc:postgresql://localhost:5432/oozie</value>
            </property>
            <property>
              <name>oozie.service.JPAService.jdbc.username</name>
              <value>oozie</value>
            </property>
            <property>
              <name>oozie.service.JPAService.jdbc.password</name>
              <value>oozie</value>
            </property>
        ...
        [Note]Note

        In the JDBC URL property, replace localhost with the hostname where Postgres is running. In the Postgres case , unlike MySQL or Oracle, there is no need to download and install the JDBC driver separately, because the driver is license-compatible and bundled with Oozie.

    • For Oracle:

      1. Install and start Oracle 11g.

        [Note]Note

        See Metastore Database Requirements for supported versions and Installing and Configuring MySQL 5.x for instructions.

      2. Create the Oozie Oracle user.

        For example, using the Oracle sqlplus command-line tool:

        $ sqlplus system@localhost
        Enter password: ******
        SQL> create user oozie identified by oozie default tablespace users temporary tablespace temp;
        User created.
        
        SQL> grant all privileges to oozie;
        Grant succeeded.
        
        SQL> exit
        $ 
      3. Configure Oozie to use Oracle.

        Edit the oozie-site.xml file as follows:

        ... <property>
             <name>oozie.service.JPAService.jdbc.driver</name>
             <value>oracle.jdbc.driver.OracleDriver</value>
            </property>
            <property>
             <name>oozie.service.JPAService.jdbc.url</name>
             <value>jdbc:oracle:thin:@localhost:1521:oozie</value>
            </property>
            <property>
             <name>oozie.service.JPAService.jdbc.username</name>
             <value>oozie</value>
            </property>
            <property>
             <name>oozie.service.JPAService.jdbc.password</name>
             <value>oozie</value>
            </property>
        ... 
        [Note]Note

        Note: In the JDBC URL property, replace localhost with the hostname where Oracle is running and replace oozie with the TNS name of the Oracle database.

      4. Add the Oracle JDBC driver JAR to Oozie. Copy or symlink the Oracle JDBC driver JAR in the /var/lib/oozie/ directory.

        [Note]Note

        Note: You must manually download the Oracle JDBC driver JAR file.

  3. Edit the oozie-env.sh and modify the following properties to match the directories created:

    modify: export JAVA_HOME=
    add: JRE_HOME=$
    {JAVA_HOME}
    
    export OOZIE_CONFIG=$
    {OOZIE_CONFIG:-/etc/oozie/conf}
    
    export CATALINA_BASE=$
    {CATALINA_BASE:-/var/lib/oozie/oozie-server}
    
    export CATALINA_TMPDIR=$
    {CATALINA_TMPDIR:-/var/tmp/oozie}
    
    export OOZIE_CATALINA_HOME=/usr/lib/bigtop-tomcat
  4. Copy the Configuration Files.

    On your Oozie server create the config directory, copy the configuration files, and set the permissions:

    rm -r $OOZIE_CONF_DIR ;
    mkdir -p $OOZIE_CONF_DIR ;
  5. Copy all the config files to $OOZIE_CONF_DIR directory.

  6. Set appropriate permissions.

    chown -R $OOZIE_USER:$HADOOP_GROUP $OOZIE_CONF_DIR/../ ;
    chmod -R 755 $OOZIE_CONF_DIR/../ ;

    where:

    • $OOZIE_CONF_DIR is the directory to store Oozie configuration files. For example, /etc/oozie/conf.

    • $OOZIE_DATA is the directory to store the Oozie data. For example, /var/db/oozie.

    • $OOZIE_LOG_DIR is the directory to store the Oozie logs. For example, /var/log/oozie.

    • $OOZIE_PID_DIR is the directory to store the Oozie process ID. For example, /var/run/oozie.

    • $OOZIE_TMP_DIR is the directory to store the Oozie temporary files. For example, /var/tmp/oozie.

    • $OOZIE_USER is the user owning the Oozie services. For example, oozie.

    • $HADOOP_GROUP is a common group shared by services. For example, hadoop.

  7. Configure your database for Oozie:

    • For Derby:

      No database configuration is required.

    • For MySQL:

      echo "create database if not exists oozie;" | mysql -u root
      echo "grant all privileges on oozie.* to 'oozie'@'localhost' identified by 'oozie';" | mysql -u root
      echo "grant all privileges on oozie.* to 'oozie'@`hostname -f` identified by 'oozie';" | mysql -u root
    • For Postgres:

      echo "CREATE DATABASE oozie;" | psql -U postgres
      echo "CREATE USER oozie WITH PASSWORD 'oozie';" | psql -U postgres
      echo "GRANT ALL PRIVILEGES ON DATABASE oozie TO oozie;" | psql -U postgres
    • For Oracle:

      bash -l -c 'echo "create user oozie identified by oozie;" | sqlplus system/root@`hostname -f`'
      bash -l -c 'echo "GRANT SELECT_CATALOG_ROLE TO oozie;" | sqlplus system/root@`hostname -f`'
      bash -l -c 'echo "GRANT CONNECT, RESOURCE TO oozie;" | sqlplus system/root@`hostname -f`'    

loading table of contents...