[Hive]关于Hive的启动问题

业务背景

用户轨迹工程脚本最近经常报错,报错如下:

SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
FAILED: Error in metadata: MetaException(message:java.lang.RuntimeException: commitTransaction was called but openTransactionCalls = 0. This probably indicates that there are unbalanced calls to openTransaction/commitTransaction)
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

搜了下发现,这是hive 0.10.0, 0.11.0, 0.12.0版本的bug,描述如下:

https://issues.apache.org/jira/browse/HIVE-4996

分析

查看了下集群上hive的配置文件,发现有这些:

$locate hive-site.xml
/etc/hive/conf.cloudera.hive/hive-site.xml
/etc/hive/conf.dist/hive-site.xml
/etc/hive/conf.dist/hive-site.xml_back
/etc/hive-hcatalog/conf.dist/proto-hive-site.xml
/home/pms/db_engine/apache-hive-0.13.1-bin/conf/hive-site.xml
/home/pms/db_engine/apache-hive-0.13.1-bin/hcatalog/etc/hcatalog/proto-hive-site.xml
/home/pms/workspace/kangshantong/spark/source/spark/sql/hive/src/test/resources/data/conf/hive-site.xml
/home/pms/workspace/kangshantong/spark/source/spark/sql/hive/target/scala-2.10/test-classes/data/conf/hive-site.xml
/home/pms/workspace/tangning/software/spark-1.3.1/conf/hive-site.xml
/home/pms/workspace/tangning/software/spark-1.3.1/sql/hive/src/test/resources/data/conf/hive-site.xml
/home/pms/workspace/tangning/software/spark-1.3.1/sql/hive/target/scala-2.10/test-classes/data/conf/hive-site.xml
/home/zhoushugang/apache-hive-0.13.1-bin/conf/hive-site.xml
/home/zhoushugang/apache-hive-0.13.1-bin/hcatalog/etc/hcatalog/proto-hive-site.xml
/usr/local/biserver-ce/pentaho-solutions/system/kettle/plugins/pentaho-big-data-plugin/hadoop-configurations/cdh51/hive-site.xml
/usr/local/biserver-ce/pentaho-solutions/system/kettle/plugins/pentaho-big-data-plugin/hadoop-configurations/hadoop-20/hive-site.xml
/usr/local/cloud/hive/conf/hive-site.xml
/usr/local/cloud/hive/scripts/pdk/conf/hive-site.xml
/usr/local/cloud/hive/src/cloudera/patches/0054-CDH-10280-Change-default-value-for-hive-site.xml-in-.patch
/usr/local/cloud/hive/src/common/src/test/resources/hive-site.xml
/usr/local/cloud/hive/src/conf/hive-site.xml
/usr/local/cloud/hive/src/data/conf/hive-site.xml
/usr/local/cloud/hive/src/pdk/scripts/conf/hive-site.xml

我习惯都是直接使用如下命令启动hive的

hive

在这么多的hive目录里面,如何知道这个命令启动的是以上哪个目录的hive呢?直接打印$HIVE_HOME就知道了

$echo $HIVE_HOME
/usr/local/cloud/hive

$HIVE_HOME是配置在/etc/profile里面的

$cat /etc/profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
        if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
           if [ "$2" = "after" ] ; then
              PATH=$PATH:$1
           else
              PATH=$1:$PATH
           fi
        fi
}

# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
        EUID=`id -u`
        UID=`id -ru`
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
fi

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
ulimit -n 102400

if [ -x /usr/bin/id ]; then
        USER="`id -un`"
        LOGNAME=$USER
        MAIL="/var/spool/mail/$USER"
fi

HOSTNAME=`/bin/hostname`
HISTSIZE=2000
HISTTIMEFORMAT="%F %T "
JAVA_HOME=/usr/j2sdk
PATH=$JAVA_HOME/bin:$PATH
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        . $i
    fi
done
unset i
unset pathmung

HIVE_CONFIG_HOME=/usr/local/cloud/hive/conf
HIVE_HOME=/usr/local/cloud/hive
PATH=$HIVE_HOME/bin:$PATH:/opt2/bi_project/software/bin
export FLOW_HOME=/opt2/bi_project/software/conf/flow
export HIVE_CONFIG_HOME=/opt2/bi_project/software/conf/hive

所以直接使用hive命令的话,启动的是/usr/local/cloud/hive目录下的hive,而这个hive的版本是hive 0.10.0,如下:

[[email protected] /usr/local/cloud/hive/lib]
$ll
total 52480
....
-rw-r--r--  1 search search   93402 Apr 23  2013 hive-beeline-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search    3922 Apr 23  2013 hive-builtins-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search   32642 Apr 23  2013 hive-cli-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search   89389 Apr 23  2013 hive-common-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search  112792 Apr 23  2013 hive-contrib-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search 4596605 Apr 23  2013 hive-exec-0.10.0-cdh4.2.1.jar
-rw-r--r-x  1 root   root     55055 Oct 20  2014 hive-hbase-handler-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search   23884 Apr 23  2013 hive-hwi-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search   55005 Apr 23  2013 hive-hwi-0.10.0-cdh4.2.1.war
-rw-r--r--  1 search search  116852 Apr 23  2013 hive-jdbc-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search 3083290 Apr 23  2013 hive-metastore-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search   14433 Apr 23  2013 hive-pdk-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search  654201 Apr 23  2013 hive-serde-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search 1490629 Apr 23  2013 hive-service-0.10.0-cdh4.2.1.jar
-rw-r--r--  1 search search   98271 Apr 23  2013 hive-shims-0.10.0-cdh4.2.1.jar
....

选择hive版本

从上面locate hive-site.xml命令所列出的hive目录中,有hive 0.13版本的,这个版本已经修复了hive 0.10.0的bug,现在要启动这个0.13版本的hive,而不是0.10.0的hive,命令如下:

/home/pms/db_engine/apache-hive-0.13.1-bin/bin/hive
时间: 2024-12-17 23:02:40

[Hive]关于Hive的启动问题的相关文章

HIVE 1.1.0 启动时报错: Unsupported major.minor version 51.0

JDK 1.6 + HIVE 1.1.0 启动时抛异常: [email protected]:~# hive Logging initialized using configuration in jar:file:/hive/apache-hive-1.1.0-bin/lib/hive-common-1.1.0.jar!/hive-log4j.propertiesSLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found bin

hive的hiveserver2模式启动不起来,发现Hadoop一直处于安全模式

hive的hiveserver2模式启动不起来,发现Hadoop一直处于安全模式 命令介绍 命令hadoop fs –safemode get 查看安全模式状态 命令hadoop fs –safemode enter 进入安全模式状态 命令hadoop fs –safemode leave 离开安全模式状态 用Hadoop fsck查看破坏丢失的文件位置 hadoop fsck Usage: DFSck <path> [-move | -delete | -openforwrite] [-fi

Hive 学习笔记(启动方式,内置服务)

一.Hive介绍 Hive是基于Hadoop的一个数据仓库,Hive能够将SQL语句转化为MapReduce任务进行运行. Hive架构图分为以下四部分. 1.用户接口 Hive有三个用户接口: 命令行接口(CLI):以命令行的形式输入SQL语句进行数据数据操作 Web界面:通过Web方式进行访问. http://p.baidu.com/itopic/main/qlog?qid=e0f26162633565663838623000&type=questionlog http://p.baidu.

Hive之 hive架构

Hive架构图 主要分为以下几个部分: 用户接口,包括 命令行CLI,Client,Web界面WUI,JDBC/ODBC接口等 中间件:包括thrift接口和JDBC/ODBC的服务端,用于整合Hive和其他程序. 元数据metadata存储,通常是存储在关系数据库如 mysql, derby 中的系统参数 底层驱动:包括HiveQL解释器.编译器.优化器.执行器(引擎). Hadoop:用 HDFS 进行存储,利用 MapReduce 进行计算. 用户接口主要有三个:CLI,Client 和

Hive(2)-Hive的安装,使用Mysql替换derby,以及一丢丢基本的HQL

一. Hive下载 1. Hive官网地址 http://hive.apache.org/ 2. 文档查看地址 https://cwiki.apache.org/confluence/display/Hive/GettingStarted 3. 下载地址 http://archive.apache.org/dist/hive/ 4. github地址 https://github.com/apache/hive 5. 也可以使用我准备好的安装包 https://pan.baidu.com/s/1

hive (一) ----- hive的安装和使用

一.hive安装 1.下载hive2.1-tar.gz 2.解压 tar -zxf hive-2.1.0.tar.gz -C /opt cd /opt ln -s hive-2.1.0 hive 3.配置环境变量 [/etc/profile] HIVE_HOME=/soft/hive PATH=...:$HIVE_HOME/bin 测试: hive --version hive --help 4.复制mysql驱动程序到hive的lib目录下. 5.配置hive 1)复制hive-default

[Hive - LanguageManual] Hive Concurrency Model (待)

Hive Concurrency Model Hive Concurrency Model Use Cases Turn Off Concurrency Debugging Configuration Locking in Hive Transactions Use Cases Concurrency support (http://issues.apache.org/jira/browse/HIVE-1293) is a must in databases and their use case

【hive】——Hive四种数据导入方式

Hive的几种常见的数据导入方式这里介绍四种:(1).从本地文件系统中导入数据到Hive表:(2).从HDFS上导入数据到Hive表:(3).从别的表中查询出相应的数据并导入到Hive表中:(4).在创建表的时候通过从别的表中查询出相应的记录并插入到所创建的表中. 一.从本地文件系统中导入数据到Hive表 先在Hive里面创建好表,如下: hive> create table wyp > (id int, name string, > age int, tel string) >

Shell脚本执行hive语句 | hive以日期建立分区表 | linux schedule程序

#!/bin/bash source /etc/profile; ################################################## # Author: ouyangyewei # # # # Content: Combineorder Algorithm # ################################################## # change workspace to here cd / cd /home/deploy/rec