Env:
Cloudera Manager 4.6.1 with CDH4.3
Hadoop 2.0.0-CDH4.3
Hive 0.10.0-CDH4.3
CentOS 6.4 X86_64
Hive started successfully:
[root@n8 hive]# netstat -anlp | grep 10000 tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 21739/java
What I want to do: connect to Hive server via Hive Thrift service with below Groovy script:
import org.apache.hadoop.hive.service.*; import org.apache.thrift.protocol.*; import org.apache.thrift.transport.*; transport = new TSocket("n8.example.com", 10000); protocol = new TBinaryProtocol(transport); client = new HiveClient(protocol); transport.open(); client.execute("show tables"); client.getClusterStatus(); client.getSchema(); client.fetchOne(); client.fetchAll();
The dependencies have been placed into Groovy classpath already:
# load required libraries load !{groovy.home}/lib/*.jar # load user specific libraries load !{user.home}/.groovy/lib/*.jar # tools.jar for ant tasks load ${tools.jar} load ${user.home}/dev/hadoop-2.0.0-cdh4.3.0/share/hadoop/common/*.jar load ${user.home}/dev/hadoop-2.0.0-cdh4.3.0/share/hadoop/common/lib/*.jar load ${user.home}/dev/hadoop-2.0.0-cdh4.3.0/share/hadoop/hdfs/*.jar load ${user.home}/dev/hadoop-2.0.0-cdh4.3.0/share/hadoop/hdfs/lib/*.jar load ${user.home}/dev/hadoop-2.0.0-cdh4.3.0/share/hadoop/mapreduce/*.jar load ${user.home}/dev/hadoop-2.0.0-cdh4.3.0/share/hadoop/mapreduce/lib/*.jar load ${user.home}/dev/hadoop-2.0.0-cdh4.3.0/share/hadoop/tools/lib/*.jar load ${user.home}/dev/hive-0.10.0-cdh4.3.0/lib/*.jar
But when I tried to execute the Groovy script, the executing process was hanged without any return, the connection was reset by the Hive server:
[root@n8 hive]# netstat -anlp | grep 10000 tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 21739/java tcp 1 0 192.168.1.208:10000 192.168.1.100:50761 CLOSE_WAIT 21739/java
Solution:
Stop the HiveServer2, then execute below command to start another HiveServer2 in which host the Hive installed.
hive --service hiveserver 10000 &
Run above Groovy script then you will find that the script will run successfully.
Or you could keep the first HiveServer2 instance running by choosing another port to run another HiveServer2 on.
hive --service hiveserver 10001 &
Reason:
By default hive would create the metastore in whichever directory you are starting the thrift server. So when you keep starting the server from various locations it has different metastores which has no reference to your tables which you would have created some where else.
相关推荐
php连接hive thrift server的lib包,经测试用hive压缩包中自带的php lib无法测试成功
spark-hive-thriftserver_2.11-2.1.spark-hive-thrift
spark-hive_2.11-2.3.0...spark-hive-thriftserver_2.11-2.3.0.jar log4j-2.15.0.jar slf4j-api-1.7.7.jar slf4j-log4j12-1.7.25.jar curator-client-2.4.0.jar curator-framework-2.4.0.jar curator-recipes-2.4.0.jar
hbase_hive_thrift_php
spark和hive结合依赖,如何使用请看我博客https://blog.csdn.net/z1987865446/article/details/109372818
Hive错误之 Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask错误分析_xiaohu21的博客-CSDN博客.mht
hive-on-spark客户端
一个基于thrift的进行使用php操作hive的一个类库的封装。
hiveclient.properties
从数据库(mysql)中读取数据写入HDFS并建hive表;在该转换中,需要配置2个DB链接(Mysql和HiveServer2),配置Hadoop集群(HDFS),配置子服务器(远程执行服务器)。需要实践的元数据文件:mysql-to-hive.ktr
基于hadoop的Hive数据仓库JavaAPI简单...2 Starting Hive Thrift Server 上面代表你已经成功的在端口为10002(默认的端口是10000)启动了hiveserver服务。这时候,你就可以通过Java代码来连接hiveserver,代码如下:
spark-1.6.3-bin-hadoop2.4-without-hive.tgz 经测试,hadoop 2.8.2下可用。hive2.1.1 可用
用于配置hive驱动,详细配置过程可参考https://blog.csdn.net/qq_32284189中SQuirrel SQL Client数据库连接工具的配置与使用
housing solution built on top of Hadoop. Hive supports queries expressed in a SQL-like declarative language - HiveQL, which are compiled into map-reduce jobs executed on Hadoop. In addition, HiveQL ...
spark2.3.0 without hive 编译版本,用于Hive on Spark 环境搭建 ./dev/make-distribution.sh --name "hadoop277-without-hive" --tgz "-Pyarn,hadoop-provided,hadoop-2.7,parquet-provided,orc-provided" -...
jdbc方式连接hive thrift server驱动器所有jar包!!!!!!!!!
hive hive hive hive hive hive hive hive hive hive hive hive
to resource for using Hive: authors Scott Shaw, Ankur Gupta, David Kjerrumgaard, and Andreas Francois Vermeulen take you through learning HiveQL, the SQL-like language specific to Hive, to analyze, ...
实现elasticsearch与hive数据互通 环境 实验性单节点集群 vagrant.linux16.4.4(无doctor) hive2.3.3+beeline es6.2.2 kibana6.2.2 elasticsearch-hadoop-6.2.2.jar 没有doctor
用于配置hive on spark的spark安装包,安装包不集成hive的jar包