Skip to main content
Skip table of contents

Indexima with Knox

Add Knox Indexima service

Create the following tree and add the two following files: service.xml and rewrite.xml

BASH
cd /usr/hdp/current/knox-server/data/services

├── indexima
│   └── 0.166.234
│       ├── rewrite.xml
│       └── service.xml

Edit the file rewrite.xml with the following content

BASH
<service role="INDEXIMA" name="indexima" version="0.166.234">
    <routes>
        <route path="/indexima"/>
    </routes>
    <dispatch classname="org.apache.hadoop.gateway.hive.HiveDispatch" ha-classname="org.apache.hadoop.gateway.hive.HiveHaDispatch"/>
</service>

Edit the file rewrite.xml with the following content

BASH
<rules>
    <rule dir="IN" name="INDEXIMA/indexima/inbound" pattern="*://*:*/**/indexima">
        <rewrite template="{$serviceUrl[INDEXIMA]}"/>
    </rule>
</rules>

Then alter the advanced topology in Ambari GUI as shown in the following capture

Restart Knox

You can restart Knox by using the command gatway.sh:

BASH
${KNOX_HOME}/bin/gateway.sh stop
Stopping Gateway with PID 14762 succeeded.

${KNOX_HOME}/bin/gateway.sh start
Gateway is starting with PID 4493.

${KNOX_HOME}/bin/gateway.sh status
Gateway is running with PID 4493.


The command gateway.sh must not be run as root

Configure Indexima to use Knox Gateway

You need to modify the galactica/conf/hive-site.xml file to use Indexima with HTTP

hive-site.xml
XML
<configuration>
    <property>
        <name>hive.server2.thrift.port</name>
        <value>110000</value>
    </property>
    <property>
        <name>hive.server2.thrift.bind.host</name>
        <value>0.0.0.0</value>
    </property>
    <property>
        <name>hive.server2.transport.mode</name>
        <value>http</value>
    </property>
    <property>
        <name>hive.server2.thrift.http.port</name>
        <value>11001</value>
    </property>
...

Connection strings

Example of a full connection string, using SSL and Kerberos

jdbc:hive2://fqdn.io:8443/;ssl=true;sslTrustStore=/var/lib/knox/data-2.6.5.0-292/security/keystores/gateway.jks;trustStorePassword=password;transportMode=http;httpPath=gateway/default/indexima

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.