CentOS7.2安装Hive
一、环境
Centso7.2 64位 apache-hive-2.3.3-bin.tar.gz
二、安装
1、下载 apache-hive-2.3.3-bin.tar.gz
链接:http://hive.apache.org/downloads.html
2、通过Xshell工具将压缩包上传至/usr/local/src并解压缩
cd /usr/local/src tar -xzvf apache-hive-2.3.3-bin.tar.gz
3、将解压缩的apache-hive-2.3.3-bin移动至/usr/local
mv /usr/local/src/apache-hive-2.3.3-bin /usr/local/hive
4、配置环境变量
cd /usr/local/hive/conf cp hive-default.xml.template hive-site.xml
修改hive.metastore.schema.verification,设定为false 创建/usr/local/hive/tmp目录,替换${system:java.io.tmpdir}为该目录 替换${system:user.name}为root
5、建立数据库
schematool -initSchema -dbType derby
在当前目录下建立metastore_db的数据库; 请注意!!!下次执行hive时应该还在同一目录,默认到当前目录下寻找metastore ; 遇到问题,把metastore_db删掉,重新执行命令 实际工作环境中,经常使用mysql作为metastore的数据。
6、启动Hive:
hive
7、简单操作:
show databases; use default; create table emp(name string,agent string,age int,salary double); show tables; desc emp; select * from emp; drop table emp;