Hive搭建
前提条件:
下载:https://mirrors.cnnic.cn/apache/hive/
安装了hadoop集群,
1.解压缩hive的软件包,使用命令:
tar -zxvf hive-3.1.0-bin.tar.gz
**2.进入hive的配置目录. 编辑/usr/local/data/hive-3.1.0/conf/hive-site.xml **
添加配置文件:
Enforce metastore schema version consistency.
True: Verify that version information stored in metastore matches with one from Hive jars. Also disable automatic
schema migration attempt. Users are required to manully migrate schema after Hive upgrade which ensures
proper metastore schema migration. (Default)
False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
** hive-env.sh配置**
export HADOOP_HOME=/usr/local/hadoop-2.8.4
export HIVE_HOME=/usr/local/data/hive-3.1.0
Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/usr/local/data/hive-3.1.0/conf
Folder containing extra libraries required for hive compilation/execution can be controlled by:
export HIVE_AUX_JARS_PATH=/usr/local/data/hive-3.1.0/lib
mysql驱动包导入
mysql驱动包放置到$HIVE_HOME\lib目录
/usr/local/data/hive-3.1.0/lib
记得文件要授权
chown -R mysql:mysql /usr/local
** 对数据库进行初始化,执行命令:**
schematool -initSchema -dbType mysql
报错1:
LF4J: Found binding in [jar:file:/usr/local/data/hive-3.1.0/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
Jar包冲突
rm -f log4j-slf4j-impl-2.10.0.jar
报错2:
message from server: "Host 'linux1' is not allowed to connect to this MySQL server"
可能是帐号不允许从远程登陆,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
登录数据库:mysql -u root -p
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
mysql>FLUSH PRIVILEGES;
出现
Initialization script completed
schemaTool completed
启动成功
启动hive
进入到hive的bin目录执行命令:
hive
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)