powerBi odbc 鏈接impala 實現自助分析

配置Impala以使用ODBC

能夠將第三方產品設計爲使用ODBC與Impala集成。爲得到最佳體驗,請確保支持您打算使用的任何第三方產品。驗證支持包括檢查Impala,ODBC,操做系統和第三方產品的版本是否已獲批准同時使用。在配置系統以使用ODBC以前,請下載鏈接器。在訪問下載ODBC鏈接器所需的頁面以前,您可能須要登陸並接受許可協議。html

繼續閱讀:sql

 

下載ODBC驅動程序

重要提示:截至2015年末,大多數商業智能應用程序都使用2.x ODBC驅動程序進行了認證。雖然此頁面上的說明涵蓋了2.x和1.x驅動程序,可是對於鏈接到Impala的大多數ODBC應用程序,只能使用2.x驅動程序。ide

有關安裝說明,請參閱鏈接器文檔頁面ui

下載:https://www.cloudera.com/downloads/connectors/impala/odbc/2-5-43.htmlthis

文檔:http://www.cloudera.com/documentation/other/connectors/impala-odbc/spa

 

1、檢查unixODBC是否安裝:

rpm -qa|grep unixODBC操作系統

假設沒有安裝。使用如下的命令安裝:設計

 

yum install unixODBCunix

 

yum install unixODBC-develcode

使用odbcinst命令查看unixODBC配置文件路徑,不一樣版本號的unixODBC配置文件路徑是不一樣的,假設是源碼方式安裝unixODBC,也可以經過編譯參數--sysconfdir指定。

 

 

[root@h1 ~]# odbcinst -j
unixODBC 2.2.14
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

2、安裝Impala ODBC驅動

yum --nogpgcheck localinstall /opt/src/ClouderaImpalaODBC-2.5.43.1032-1.el7.x86_64.rpm 

Marking /opt/src/ClouderaImpalaODBC-2.5.43.1032-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package ClouderaImpalaODBC.x86_64 0:2.5.43.1032-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================
 Package     Arch   Version       Repository                                    Size
=====================================================================================
Installing:
 ClouderaImpalaODBC
             x86_64 2.5.43.1032-1 /ClouderaImpalaODBC-2.5.43.1032-1.el7.x86_64  49 M

Transaction Summary
=====================================================================================
Install  1 Package

Total size: 49 M
Installed size: 49 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ClouderaImpalaODBC-2.5.43.1032-1.x86_64                           1/1 
  Verifying  : ClouderaImpalaODBC-2.5.43.1032-1.x86_64                           1/1 

Installed:
  ClouderaImpalaODBC.x86_64 0:2.5.43.1032-1                                          

Complete!

安裝完畢後的文件在:/opt/cloudera/impalaodbc 文件夾,這個文件夾包括了安裝文檔、lib包、配置文件演示樣例。
 ll /opt/cloudera/impalaodbc/
total 644
-rwxr-xr-x 1 root root 528661 Apr 25 03:19 Cloudera-ODBC-Driver-for-Impala-Install-Guide.pdf
drwxr-xr-x 3 root root   4096 Aug 16 16:27 ErrorMessages
-rwxr-xr-x 1 root root  12003 Apr 25 03:19 EULA.txt
drwxr-xr-x 3 root root   4096 Aug 16 16:27 lib
-rwxr-xr-x 1 root root  15623 Apr 25 03:19 Release-Notes-Impala-ODBC.txt
drwxr-xr-x 2 root root   4096 Aug 16 16:27 Setup
-rwxr-xr-x 1 root root  83667 Apr 25 03:19 third-party-licenses.txt

問題:cdh5.15 impala2.12 下裝impalaODBC-2.5.39報以下錯誤,提示衝突,換2.5.43便可

 rpm -ivh /opt/src/ClouderaImpalaODBC-2.5.39.1020-1.el7.x86_64.rpm

Preparing...                          ################################# [100%]
    file /opt/cloudera from install of ClouderaImpalaODBC-2.5.39.1020-1.x86_64 conflicts(衝突) with file from package cloudera-manager-daemons-5.15.0-1.cm5150.p0.62.el7.x86_64

配置ODBC端口

Cloudera ODBC Connector的2.5和2.0版本(目前已針對某些但不是全部BI應用程序進行了認證)使用HiveServer2協議,對應於Impala端口21050.Impala支持使用全部受支持的驅動程序版本進行Kerberos身份驗證,而且須要ODBC 2.05.13用於LDAP用戶名/密碼身份驗證的Impala或更高版本。

Cloudera ODBC Connector的1.x版使用原始的HiveServer1協議,對應於Impala端口21000。

設置驅動的環境變量:

在 /etc/profile 最後加入:

export ODBCINI=/etc/odbc.ini
export ODBCSYSINI=/etc
export CLOUDERAIMPALAODBCINI=/etc/cloudera.impalaodbc.ini

而後運行:source /etc/profile  

使改動的腳本立刻生效。

拷貝:cloudera.impalaodbc.ini 到 /etc/文件夾:

 

[root@h1 Setup]#cp /opt/cloudera/impalaodbc/lib/64/cloudera.impalaodbc.ini  /etc/

[root@h1 Setup]#


改動:/etc/cloudera.impalaodbc.ini 中的例如如下條目:

 

 

# Generic ODBCInstLib
#   iODBC
#ODBCInstLib=libiodbcinst.so

#   SimbaDM / unixODBC
ODBCInstLib=libodbcinst.so

也就是說不使用iODBC , 使用 unixODBC

 

3、改動/etc/odbc.ini 文件

參照 /opt/cloudera/impalaodbc/Setup/odbc.ini ,  在/etc/odbc.ini 加入例如如下的內容:

 

[impalaodbc]

# Description: DSN Description.
# This key is not necessary and is only to give a description of the data source.
Description=Cloudera ODBC Driver for Impala (64-bit) DSN

# Driver: The location where the ODBC driver is installed to.
Driver=/opt/cloudera/impalaodbc/lib/64/libclouderaimpalaodbc64.so

# The DriverUnicodeEncoding setting is only used for SimbaDM
# When set to 1, SimbaDM runs in UTF-16 mode.
# When set to 2, SimbaDM runs in UTF-8 mode.
#DriverUnicodeEncoding=2

# Values for HOST, PORT, KrbFQDN, and KrbServiceName should be set here.
# They can also be specified on the connection string.
HOST=172.16.230.152
PORT=21050
Database=default

# The authentication mechanism.
# 0 - no authentication.
# 1 - Kerberos authentication
# 2 - Username authentication.
# 3 - Username/password authentication.
# 4 - Username/password authentication with SSL.
AuthMech=0

# Kerberos related settings.
KrbFQDN=
KrbRealm=
KrbServiceName=

# Username/password authentication with SSL settings.
UID=
PWD=
CAIssuedCertNamesMismatch=1
TrustedCerts=/opt/cloudera/impalaodbc/lib/64/cacerts.pem

# Specify the proxy user ID to use.
#DelegationUID=

# General settings
TSaslTransportBufSize=1000
RowsFetchedPerBlock=1000
SocketTimeout=0
StringColumnLength=32767
UseNativeQuery=0

4、驗證安裝是否成功

運行 isql -v impalaodbc

 

[root@h1 ~]# isql -v impalaodbc
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
相關文章
相關標籤/搜索