Configure Hue to Store Data in Oracle Database

Note: To configure Hue with Oracle 12, you need the Oracle 11 Instant Client Base and SDK.
  1. Install the following packages:
    CentOS yum install gcc python-devel
    SuSE zypper install gcc python-devel
    Ubuntu apt-get install gcc python-dev
  2. Ensure that the library required to install the Oracle module in Hue is available through the LD_LIBRARY_PATH environment variable. The module that provides support for Oracle in Hue requires the libclntsh.so library to be available through the LD_LIBRARY_PATH environment variable. Typically, the library is located under the $ORACLE_HOME or $ORACLE_HOME/lib directories. Also, the library might include a version in the filename (for example, libclntsh.so.11.1), but the Oracle module for Hue requires it to be named libclntsh.so.
    1. Ensure that the ORACLE_HOME environment variable is set:
      export ORACLE_HOME=<path_to_oracle_installation>
    2. Use the find command to locate the library:
      find "$ORACLE_HOME" -name "libclntsh.so*"
    3. Go to the directory and ensure that the library is available and has the proper filename. If not, you can create a symbolic link:
      ln -s libclntsh.so.11.* libclntsh.so
    4. Add the following variables to the Hue environment configuration by creating a file in /opt/mapr/hue/hue-<version>/bin/env.d/. For example, create /opt/mapr/hue/hue-<version>/bin/env.d/99custom with the following content:
      export ORACLE_HOME="<path_to_oracle_installation>"
      export LD_LIBRARY_PATH="$ORACLE_HOME:$LD_LIBRARY_PATH"
      or the following, depending on your Oracle configuration:
      export ORACLE_HOME="<path_to_oracle_installation>"
      export LD_LIBRARY_PATH="$ORACLE_HOME/lib:$LD_LIBRARY_PATH"
  3. Depending on the Oracle instant client version installed:
    1. Run the shell script:
      $ sudo sh -c "echo /usr/lib/oracle/<version-number>/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf"
    2. Use the ldconfig command to create the linking:
      $ sudo ldconfig
    3. Verify the dynamic linking:
       $ sudo ldconfig -p | grep -i oracle
      For example:
      ldconfig -p | grep -i oracle
      libocijdbc11.so (libc6,x86-64) => /opt/oracle/instantclient_11_2/libocijdbc11.so
      libociei.so (libc6,x86-64) => /opt/oracle/instantclient_11_2/libociei.so
      libocci.so.11.1 (libc6,x86-64) => /opt/oracle/instantclient_11_2/libocci.so.11.1
      libnnz11.so (libc6,x86-64) => /opt/oracle/instantclient_11_2/libnnz11.so
      libclntsh.so.11.1 (libc6,x86-64) => /opt/oracle/instantclient_11_2/libclntsh.so.11.1
  4. Install the Python cx_Oracle package in Hue:
    cd /opt/mapr/hue/hue-<version>
    source ./bin/activate
    pip install cx_Oracle==5.3
    deactivate
    Note: Python cx_Oracle version 5.3 is supported.
  5. Configure the database connection parameters in the [desktop][[database]] section of hue.ini. Note these considerations:
    • Make sure that you have the appropriate permissions to use LOBs; for example, SQL GRANT on SYS.DBMS_LOB.
    • SID refers to the Oracle system ID, which is used to uniquely identify the database.
      [desktop]
        ...
        [[database]]
          engine=oracle
          host=<host>
          port=1521
          user=<user>
          password=<password>
          name=<SID of the database>
      
    • To achieve a multithreading environment, you can specify the options={'threaded':true} parameter in this section. For example:
      [desktop]
        ...
        [[database]]
          engine=oracle
          host=node1
          port=1521
          user=hue
          password=hue_password
          name=XE
          options={'threaded':true}
      

      By setting the port=0 parameter, you can use the Oracle Service Name instead of specifying the SSID. For example:

      [desktop]
        ...
        [[database]]
          engine=oracle
          port=0
          user=hue
          password=hue_password
          name=node1:1521/hue
      
  6. Perform the initial data migration:
    sudo /opt/mapr/server/configure.sh -R                   
  7. Restart Hue:
    maprcli node services -name hue -action restart -nodes <node_with_hue>