ODBC Driver for Apache Hive

Build 22.0.8479

Linux DSN の構成

このセクションでは、以下のいくつかのLinux ディストリビューションでODBC 接続をセットアップしDSN を設定する方法を説明します:Ubuntu のようなDebian ベースのシステム、Red Hat Enterprise Linux (RHEL)、CentOS、およびFedora のようなRed Hat Linux プラットフォーム。

Linux の最小バージョン

Red Hat ベースおよびDebian ベースシステムでサポートされる最小バージョンは以下のとおりです。

OSMin. Version
Ubuntu11.04
Debian7
RHEL6.9
CentOS6.9
Fedora13
SUSE12.1

ドライバー依存関係のインストール

必要な依存関係をインストールするには、次のコマンドをルートとしてまたはsudo で実行します。

  • Debian/Ubuntu:
    apt-get install libc6 libstdc++6 zlib1g libgcc1
  • RHEL/CentOS/Fedora:
    yum install glibc libstdc++ zlib libgcc

本製品 が必要とする対応ライブラリは以下のとおりです。

Debian/Ubuntu PackageRHEL/CentOS/Fedora PackageFile
libc6glibclinux-vdso.1
libc6glibclibm.so.6
libc6glibclibrt.so.1
libc6glibclibdl.so.2
libc6glibclibpthread.so.0
libc6glibclibc.so.6
libc6glibcld-linux-x86-64.so.2
libstdc++6libstdc++libstdc++.so.6
zlib1gzliblibz.so.1
libgcc1libgcclibgcc_s.so.1

ドライバーのインストール

標準のパッケージ管理システムを使用してドライバーをインストールできます。

Ubuntu のようなDebian ベースのシステムでは、次のコマンドをroot またはsudo で実行します。

dpkg -i /path/to/driver/setup/ApacheHiveODBCDriverforUnix.deb 

RPM パッケージ形式をサポートするシステムでは、次のコマンドをroot またはsudo で実行します。

rpm -ivh /path/to/driver/ApacheHiveODBCDriverforUnix.rpm 

ドライバーのライセンス

次のコマンドを実行して本製品 のライセンスを取得します。評価版をアクティベートするには、<key> の入力を省略してください。

cd /opt/cdata/cdata-odbc-driver-for-apachehive/bin/
sudo ./install-license.sh <key>

ドライバーマネージャー経由の接続

ドライバーマネージャーはドライバーをロードし、アプリケーションからドライバーに関数呼び出しを渡します。本製品 をドライバーマネージャーに登録して、ドライバーマネージャーのコンフィギュレーションファイルにDSN を定義する必要があります。

本製品 のインストールでは、本製品 をunixODBC ドライバーマネージャーに登録し、システムDSN を作成します。UnixODBC ドライバーマネージャーは、Python やその他多くのアプリケーションから使用できます。アプリケーションに別のドライバーマネージャーが組み込まれている可能性があります。

DSN の作成

unixODBC をインストールしてDSN を設定するには、unixODBC の使用 を参照してください。OBIEE、Informatica、およびSAS に接続するDSN を作成するには、DataDirect ドライバーマネージャーの使用 を参照してください。

Apache Hive への接続

セルフホステッドインスタンス

Apache Hive への接続を確立するには以下を指定します。

  • TransportMode:Hive サーバーとの通信に使用するトランスポートモード。有効な入力値は、BINARY およびHTTP です。デフォルトではBINARY が選択されます。
  • Server:HiveServer2 をホストするサーバーのホスト名またはIP アドレスに設定。
  • Port:HiveServer2 インスタンスへの接続用のポートに設定。
  • UseSSL(オプション):TLS/SSL を有効にするには、これを設定。

Amazon EMR インスタンス

Connections to Amazon EMR will need to be established using an SSH tunnel.

Use the following procedure to create an SSH tunnel to EMR.

  1. To begin, you will need an active EMR cluster and an EC2 key pair. The key pair can be in .ppk or .pem format.
  2. Next, authorize inbound traffic in your cluster settings.

Set the following to connect (while running an active tunnel session to EMR):

  • Server:Set this to the master node (master-public-dns-name) where the Apache Hive server is running.
  • Port:Set this to the port required to connect to Apache Hive.
  • UseSSH:Set this to true.
  • SSHServer:Set this to the master node (master-public-dns-name).
  • SSHPort:Set this to 22.
  • SSHAuthMode:Set this to PUBLIC_KEY.
  • SSHUser:Set this to hadoop.
  • SSHClientCert:Set this to the full path to the key file.
  • SSHClientCertType:Set this to type that corresponds to the key file.Typically either PEMKEY_FILE or PPKFILE.

Hadoop Cluster on Azure HDInsight Instances

You will need to supply the following to establish a connection to a Hadoop cluster hosted on Azure HDInsight:

  • User:Set this to the cluster username that you specified when creating the cluster on Azure HDInsight.
  • Password:Set this to the cluster password that you specified when creating the cluster on Azure HDInsight.
  • Server:The server corresponding to your cluster.For example: myclustername.azurehdinsight.net.
  • Port:Set this to the port running HiveServer2.This will be 443 by default.
  • HTTPPath:Set this to the HTTP path for the hive2 service.This will be hive2 by default.
  • TransportMode:Set this to HTTP.
  • UseSSL:Set this to true.
  • QueryPassthrough(オプション):QueryPassthrough をtrue に設定して本製品 のSQL エンジンをバイパスし、Apache Hive に直接HiveQL クエリを実行します。

Google インスタンス

接続の前に

Ensure that the Apache Hive server on DataProc was created with the DataProc Component Gateway enabled.

Next, obtain the external IP address of the Hive Cluster. To find this, load up the Cloud Shell and list the instances.

gcloud compute instances list

Note the external IP of the relevant machine.

Build an SSH Tunnel to the Hive Cluster Web Interface

Navigate to the Hive cluster on DataProc and select the WEB INTERFACES tab. Select Create an SSH tunnel to connect to a web interface.

A cloud console command will be shown that can be used to create an SSH key pair. Download the private key from the directory specified in the console.

Configure the SSH tunnel in an SSH utility:

  • ホスト名:Set this to the external IP noted above.
  • ポート:22
  • Point the tool to your private SSH key.
  • For the Tunnel, map an open port to localhost:10000. localhost will be resolved properly on the server.

Connecting to Hive on Google DataProc

Specify the following information to connect to Apache Hive:

  • TransportMode:Set this to BINARY.
  • AuthScheme:Set this to Plain.
  • Port:Set this to the chosen SSH Tunnel port on the local machine.

Apache Hive への認証

PLAIN

Set AuthScheme to PLAIN when the hive.server2.authentication property is set to None (uses Plain SASL), PAM, or CUSTOM. In addition, set the following connection properties:

  • User:ログインするユーザーに設定。何も設定しない場合は、代わりに'anonymous' が送信されます。
  • Password:ユーザーのパスワードに設定。何も設定しない場合は、代わりに'anonymous' が送信されます。

LDAP

Set AuthScheme to LDAP when the hive.server2.authentication property is set to LDAP. さらに、次の接続プロパティを設定します。

  • User:ログインするユーザーに設定。
  • Password:ユーザーのパスワードに設定。

NOSASL

Set AuthScheme to NOSASL when the hive.server2.authentication property is set to NOSASL. There are no user credentials submitted in this auth scheme.

Kerberos

Set AuthScheme to Kerberos when the hive.server2.authentication property is set to Kerberos. Kerberos で認証する方法についての詳細は、Kerberos の使用 を参照してください。

ドライバーエンコーディングの設定

ODBC ドライバーは、ODBC ドライバーマネージャーで使用するエンコーディングを指定する必要があります。デフォルトでは、Unix 用のCData ODBC ドライバーはunixODBC と互換性のあるUTF-16 を使用するように設定されていますが、他のドライバーマネージャーでは代替エンコーディングが必要な場合があります。

また、ANSI ODBC API を使用するアプリケーションからODBC ドライバーを使用している場合は、ANSI コードページを設定する必要があります。例えば、ANSI アプリケーションに日本語の文字をインポートするには、設定ファイル'/opt/cdata/cdata-odbc-driver-for-apachehive/lib/cdata.odbc.apachehive.ini' でコードページを指定できます。

[Driver]
AnsiCodePage = 932

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8479