Hive本地模式安装和配置(官网简单翻译)
安装步骤据官网简单翻译:(我部署的本地模式,按照官网的部署成功了,参照网上的步骤都没成功。在命令行运行hive时候一直报错)
1、Requirements
- Java 1.7
Note: Hive versions 1.2 onward require Java 1.7 or newer. Hive versions 0.14 to 1.1 work with Java 1.6 as well. Users are strongly advised to start moving to Java 1.8 (see HIVE-8607). - Hadoop 2.x (preferred), 1.x (not supported by Hive 2.0.0 onward).
Hive versions up to 0.13 also supported Hadoop 0.20.x, 0.23.x. - Hive is commonly used in production Linux and Windows environment. Mac is a commonly used development environment. The instructions in this document are applicable to Linux and Mac. Using it on Windows would require slightly different steps.
要求
1、java1.7,Hive版本1.2以上的要求jdk1.7及 以上。Hive版本0.4-1.1的1.6也可。强烈建议将java版本升到1.8
2、Hadoop2.x,1.x
3、Linux或windows环境。Mac常用于生产环境。
2、Installing Hive from a Stable Release
Start by downloading the most recent stable release of Hive from one of the Apache download mirrors (see Hive Releases). 从官网下载最近稳定版本的Hive。网址https://hive.apache.org/downloads.html
Next you need to unpack the tarball. This will result in the creation of a subdirectory named
hive-x.y.z(where
x.y.zis the release number):解压
[code] $ tar -xzvf hive-x.y.z.tar.gz
Set the environment variable
HIVE_HOMEto point to the installation directory: 设置HIVE_HOME指向安装目录
[code] $ cd hive-x.y.z $ export HIVE_HOME={{pwd}}
Finally, add
$HIVE_HOME/binto your
PATH:将Hive的执行bin目录添加到环境变量中去。
[code] $ export PATH=$HIVE_HOME/bin:$PATH
另从源码编译Hive进行安装部署的方式自行查看官网。我是直接下载的稳定版。
3、Running Hive
Hive uses Hadoop(Hive使用Hadoop的HDFS), so:
- you must have Hadoop in your path OR
export HADOOP_HOME=<hadoop-install-dir>
In addition, you must use below HDFS commands to create
/tmpand
/user/hive/warehouse(aka
hive.metastore.warehouse.dir) and set them
chmod g+wbefore you can create a table in Hive.(这一步为在HDFS中创建Hive的仓库和临时文件,并赋予g+w权限)
[code] $ $HADOOP_HOME/bin/hadoop fs -mkdir /tmp $ $HADOOP_HOME/bin/hadoop fs -mkdir /user/hive/warehouse $ $HADOOP_HOME/bin/hadoop fs -chmod g+w /tmp $ $HADOOP_HOME/bin/hadoop fs -chmod g+w /user/hive/warehouse
You may find it useful, though it's not necessary, to set
HIVE_HOME:
$ export HIVE_HOME=<hive-install-dir>
Starting from Hive 2.1, we need to run the schematool command below as an initialization step. For example, we can use "derby" as db type. (这一步非常重要,我就是因为没有创建这个一直报如下的错,初始化dbType,这时候会自动在hive所在的目录创建metadata_db,已经创建再次初始化会报错)
[code] $ $HIVE_HOME/bin/schematool -dbType <db type> -initSchema
到此我们的Hive内嵌模式,简单版算是正式部署好了,但是还可能在hive cli里运行的时候还是出现错误:
得到网上汇总方案:
1.hive的版本过高导致的问题,所以其他伙伴有类似错误请考虑版本
2.需要hive元数据库初始化,执行 schematool -dbType mysql -initSchema
3.HIVE_HOME/lib 下的derby-10.11.1.1.jar问题,,把derby-10.11.1.1.jar 换成derby-10.10.2.0.jar问题成功解决
内嵌模式的部署就说到这,不懂欢迎来问!
以上部署的Hive使用内嵌的derby作为元数据的存储,但是在实际上还可以用MysQL和其他的远程(比如分布式数据库、HDFS作为存储Hive元数据的容器)。一般生产上也都是是使用分布式的文件系统或者数据库存储。
阅读更多- Hive 2、Hive 的安装配置(本地MySql模式)
- hive2.1.0+mysql5.1本地模式+Hadoop完全分布式集群的安装与配置
- Hive 3、Hive 的安装配置(本地derby模式)
- 大数据 (十九)Hive【Hive安装配置(本地数据库模式)】
- Hive 3、Hive 的安装配置(本地derby模式)
- 大数据(十八)Hive【Hive安装配置(本地derby模式)】
- Hive 2、Hive 的安装配置(本地MySql模式)
- Hive 2、Hive 的安装配置(本地MySql模式)
- Hive本地模式安装配置
- Hive 3、Hive 的安装配置(本地derby模式)
- Hive 3、Hive 的安装配置(本地derby模式)
- Hive 2、Hive 的安装配置(本地MySql模式)
- Hive1.2.1本地、远程模式安装配置及常见错误
- Hive2.0.0安装步骤(配置mysql+简单入门)
- [Kali_USB Live模式下网卡加载安装问题]针对ASUS X202E笔记本配置的本地Broadcom43142无线网卡启动并显示wifi功能
- Hadoop单机模式中Hive安装配置
- hadoop-hive本地和伪分布式模式的安装
- Hive-0.12.0-cdh5.0.1 安装[metasore 内嵌模式、本地模式、远程模式]
- Hive本地模式安装及遇到的问题和解决方案
- HIVE本地独立模式安装