基于Docker的Hadoop集群环境搭建hive环境
本文基于Hadoop in docker的文章后构建的,具体base的docker镜像都为hadoop3构建
构建镜像文件
Dockerfile
1 | FROM dean1943/hadoop3 |
配置文件
hive-env.sh
1 | export HADOOP_HOME=/opt/hadoop |
hive-site.xml
修改hive.metastore.schema.verification,设定为false
创建/usr/local/hive/tmp目录,替换${system:java.io.tmpdir}为该目录
替换${system:user.name}为root
初始化数据库
1 | schematool -initSchema -dbType derby |
会在当前目录下简历metastore_db的数据库。
注意!!!下次执行hive时应该还在同一目录,默认到当前目录下寻找metastore。
遇到问题,把metastore_db删掉,重新执行命令
实际工作环境中,经常使用mysql作为metastore的数据
启动hive
1 | hive |
观察hadoop fs -ls /tmp/hive中目录的创建
1 | show databases; |
观察hadoop fs -ls /user
启动yarn
1 | load data inpath '/wcinput' overwrite into table doc; |
使用sougou搜索日志做实验
将日志文件上传的hdfs系统,启动hive
1 | create table sougou (qtime string, qid string, qword string, url string) row format delimited fields terminated by ','; |