cdh hive和impala的odbc驱动
http://www.cloudera.com/downloads.html.html
选择 SLES 11 64-bit下载:
http://www.cloudera.com/downloads/connectors/impala/odbc/2-5-26.html
或者
https://downloads.cloudera.com/connectors/impala_odbc_2.5.26.1027/Linux/SLES11/ClouderaImpalaODBC-2.5.26.1027-1.x86_64.rpm
apt-get install unixodbc apt-get install unixodbc-dev
安装impala odbc
apt-get install alien dpkg-dev debhelper build-essential alien ClouderaImpalaODBC-2.5.26.1027-1.x86_64.rpm dpkg -i clouderaimpalaodbc_2.5.26.1027-2_amd64.deb
vi /etc/profile.d/impala_env.sh
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libodbcinst.so export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/odbc export ODBCINI=/etc/odbc.ini export ODBCSYSINI=/etc export CLOUDERAIMPALAINI=/opt/cloudera/impalaodbc/lib/64/cloudera.impalaodbc.ini
source /etc/profile.d/impala_env.sh
odbcinst -j
*HOST 地址是impala Daemon所在的机器ip,端口可以在cm中设置
vi /etc/odbc.ini
[ODBC Data Sources] Sample_Cloudera_Impala_DSN_64=Cloudera Impala ODBC Driver 64-bit [Sample_Cloudera_Impala_DSN_64] Driver=/opt/cloudera/impalaodbc/lib/64/libclouderaimpalaodbc64.so HOST=192.168.2.103 PORT=21050 Database=default
vi /etc/odbcinst.ini
[ODBC Drivers] Cloudera Impala ODBC Driver 64-bit=Installed [Cloudera Impala ODBC Driver 64-bit] Description=Cloudera Impala ODBC Driver (64-bit) Driver=/opt/cloudera/impalaodbc/lib/64/libclouderaimpalaodbc64.so
isql -v Sample_Cloudera_Impala_DSN_64
PHP连接:
<?php $connection=odbc_connect('Sample_Cloudera_Impala_DSN_64','',''); $SQL_Exec_String="show tables"; $result=odbc_exec($connection, $SQL_Exec_String); while(odbc_fetch_row($result)) { $Tables=odbc_result($result, 1); echo $Tables.'<br/>'; } ?>
参考网址:
http://hadoop4beginner.blogspot.com/2015/05/installing-impala-odbc-driver-in-ubuntu.html
来源:https://www.cnblogs.com/ggzone/p/5222579.html