Configure Hue to Store Data in Oracle Database

About this task

NOTE
To configure Hue with Oracle 12, you need the Oracle 11 Instant Client Base and SDK.

Procedure

  1. Install the following packages:
    RedHat yum install gcc libnsl
    SLES zypper install gcc
    Ubuntu apt-get install gcc
  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:
      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>/desktop/conf/env.d/. For example, create /opt/mapr/hue/hue-<version>/desktop/conf/env.d/99-custom.sh 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. Install the Python cx_Oracle package in Hue:
    cd /opt/mapr/hue/hue-<version> 
    . bin/activate 
    pip install cx_Oracle==5.3 
    deactivate 
    NOTE
    Python cx_Oracle version 5.3 is supported.
  4. 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
      
  5. Invoke configure.sh to perform the initial data migration:
    sudo /opt/mapr/server/configure.sh -R                   
  6. Restart Hue:
    maprcli node services -action restart -nodes <node_with_hue> -name hue