php连接hive执行sql查询

来源:互联网 发布:js属性的nodetype 编辑:程序博客网 时间:2024/05/16 05:22

使用php连接hive的条件

1  需要安装thrift  安装步骤

#  ./configure --without-ruby 

#   make && make install

如果没有安装libevent libevent-devel的应该先安装这两个依赖库yum -y install libevent libevent-devel

安装好后启动hive thrift

# ./hive --service hiveserver >/dev/null 2>/dev/null &

查看hiveserver默认端口是否打开10000   如果打开表示成功

 

注:php版本要求是5.2或者以上

php连接hive代码

 

将以上代码存为test.php到apache的www路径/var/www/html/中  php连接hive的依赖包放到/var/www/html/hivephp/thrift/

php连接hive的lib包下载地址 http://download.csdn.net/source/3409880

打开浏览器浏览http://localhost/test.php就可以看到查询结果了

原创粉丝点击