配置Impala以使用ODBC
可以将第三方产品设计为使用ODBC与Impala集成。为获得最佳体验,请确保支持您打算使用的任何第三方产品。验证支持包括检查Impala,ODBC,操作系统和第三方产品的版本是否已获批准同时使用。在配置系统以使用ODBC之前,请下载连接器。在访问下载ODBC连接器所需的页面之前,您可能需要登录并接受许可协议。
继续阅读:
下载ODBC驱动程序
重要提示:截至2015年底,大多数商业智能应用程序都使用2.x ODBC驱动程序进行了认证。虽然此页面上的说明涵盖了2.x和1.x驱动程序,但是对于连接到Impala的大多数ODBC应用程序,只能使用2.x驱动程序。
有关安装说明,请参阅连接器文档页面。
下载:https://www.cloudera.com/downloads/connectors/impala/odbc/2-5-43.html
文档:http://www.cloudera.com/documentation/other/connectors/impala-odbc/
一、检查unixODBC是否安装:
rpm -qa|grep unixODBC
假设没有安装。使用以下的命令安装:
yum install unixODBC
yum install unixODBC-devel
使用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
二、安装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
三、改动/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
四、验证安装是否成功
运行 isql -v impalaodbc
[root@h1 ~]# isql -v impalaodbc +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+
来源:oschina
链接:https://my.oschina.net/u/1998220/blog/1929177