Wondows安装本地模式hive,填坑指南

windows安装hive一直格式化失败

主要总结一下我2天1夜的填坑经历,顺便给后人爬出坑的指南。

先贴出我的错误
hive --service metastore(我用的格式化代码)
在这里插入图片描述
我一直卡在这里一个晚上,我找了很多资料,但都没有这个错误,可能是我犯了一个新错误,好悲伤!
然后就是这个错误,我经历了以下过程:

  • MySQL的字符集格式默认是Latin1,改为utf-8
  • Hadoop、hive、mysql connect xxx .jar三者的版本兼容问题

(我用的是Hadoop2.6.4+hive2.2.0+mysql-connector-java-5.1.10-bin.jar)

我多次更改jar包的版本,但基本没啥用,还是不能往下继续格式化。
我尝试过的版本
在这里说明一下,根据我的经验,6.0.2和8.0.19这两个高版本兼容了5.x的不足,直接用高版本的很省事的。一开始我分辨不出来有什么区别,只能都尝试了,最后高版本的直接能够正常走到我格式化时卡住的那一步。低版本5.x的格式化时有错误,改了很多地方之后,发现和高版本走到了同一步。

  • hive-site.xml是否有写错的属性

我这里就不贴hive-site.xml这个文件了,百度都有,主要想说
jdbc:mysql://localhost:3306/hive?----->中的hive是你连接的数据库名

> 		<property> 		
> 			<name>javax.jdo.option.ConnectionURL</name>
> 			<value>jdbc:mysql://localhost:3306/hive?characterEncoding=UTF-8&amp;createDatabaseIfNotExist=true&amp;serverTimezone=UTC&amp;useSSL=false</value>
> 			<description> 		JDBC connect string for a JDBC metastore.  </description>	
> 		</property>
  • 是否是本地模式。

不连接集群的好像都是,反正我也没搞太明白。

  • 在以上所有办法都失败后,我成功的秘诀

直接格式化:

hive --service schematool -initSchema -dbType mysql

直接启动hive:

hive Starting Hive Metastore Server

血泪的教训啊!
我以为我的hive格式化失败了,其实是成功了,我一直以一种不适合我电脑的方式在进行登录hive。
之前用了错误的登录hive方式,直接显示卡在Tcp-keepalive=true这一步,往下走也走不动.
我尝试了这两步之后,就成功了(说的好轻巧,为了解决这个bug,我浓密的秀发都分叉了!)。
总之,网上有太多的安装指南,都迷眼了。建议大家选择时,慎重吧!

最后给大家贴一下我连接hive成功后的日志:

C:\Users\Administrator>hive Starting Hive Metastore Server
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/F:/Hadoop/hadoop-2.6.4/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/Static
SLF4J: Found binding in [jar:file:/F:/Hadoop/Hive/apache-hive-2.2.0-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLog
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Connecting to jdbc:hive2://
20/04/27 22:48:53 INFO conf.HiveConf: Found configuration file file:/F:/Hadoop/Hive/apache-hive-2.2.0-bin/conf/hive-site.xml
20/04/27 22:48:55 INFO metastore.HiveMetaStore: 0: Opening raw store with implementation class:org.apache.hadoop.hive.metastore.
20/04/27 22:48:55 INFO metastore.ObjectStore: ObjectStore, initialize called
20/04/27 22:48:55 INFO DataNucleus.Persistence: Property hive.metastore.integral.jdo.pushdown unknown - will be ignored
20/04/27 22:48:55 INFO DataNucleus.Persistence: Property datanucleus.cache.level2 unknown - will be ignored
20/04/27 22:48:56 INFO metastore.ObjectStore: Setting MetaStore object pin classes with hive.metastore.cache.pinobjtypes="Table,
20/04/27 22:48:59 INFO metastore.MetaStoreDirectSql: Using direct SQL, underlying DB is MYSQL
20/04/27 22:48:59 INFO metastore.ObjectStore: Initialized ObjectStore
20/04/27 22:48:59 INFO metastore.HiveMetaStore: Added admin role in metastore
20/04/27 22:48:59 INFO metastore.HiveMetaStore: Added public role in metastore
20/04/27 22:48:59 INFO metastore.HiveMetaStore: No user is added in admin role, since config is empty
20/04/27 22:48:59 INFO metastore.HiveMetaStore: 0: get_all_functions
20/04/27 22:48:59 INFO HiveMetaStore.audit: ugi=Administrator ip=unknown-ip-addr cmd=get_all_functions
20/04/27 22:49:00 INFO session.SessionState: Created HDFS directory: /tmp/hive/Administrator/b2601122-97e5-4bd9-af09-88d892ff463
20/04/27 22:49:00 INFO session.SessionState: Created local directory: F:/Hadoop/Hive/apache-hive-2.2.0-bin/my_hive/scratch_dir/b
20/04/27 22:49:00 INFO session.SessionState: Created HDFS directory: /tmp/hive/Administrator/b2601122-97e5-4bd9-af09-88d892ff463
20/04/27 22:49:00 INFO sqlstd.SQLStdHiveAccessController: Created SQLStdHiveAccessController for session context : HiveAuthzSess
pe=HIVESERVER2]
20/04/27 22:49:00 WARN session.SessionState: METASTORE_FILTER_HOOK will be ignored, since hive.security.authorization.manager is
20/04/27 22:49:00 INFO hive.metastore: Mestastore configuration hive.metastore.filter.hook changed from org.apache.hadoop.hive.m
urity.authorization.plugin.AuthorizationMetaStoreFilterHook
20/04/27 22:49:00 INFO metastore.HiveMetaStore: 0: Cleaning up thread local RawStore…
20/04/27 22:49:00 INFO HiveMetaStore.audit: ugi=Administrator ip=unknown-ip-addr cmd=Cleaning up thread local RawStore…
20/04/27 22:49:00 INFO metastore.HiveMetaStore: 0: Done cleaning up thread local RawStore
20/04/27 22:49:00 INFO HiveMetaStore.audit: ugi=Administrator ip=unknown-ip-addr cmd=Done cleaning up thread local RawSto
20/04/27 22:49:00 INFO service.CompositeService: Operation log root directory is created: F:\Hadoop\Hive\apache-hive-2.2.0-bin\m
20/04/27 22:49:01 INFO service.CompositeService: HiveServer2: Background operation thread pool size: 100
20/04/27 22:49:01 INFO service.CompositeService: HiveServer2: Background operation thread wait queue size: 100
20/04/27 22:49:01 INFO service.CompositeService: HiveServer2: Background operation thread keepalive time: 10 seconds
20/04/27 22:49:01 INFO service.AbstractService: Service:OperationManager is inited.
20/04/27 22:49:01 INFO service.AbstractService: Service:SessionManager is inited.
20/04/27 22:49:01 INFO service.AbstractService: Service:CLIService is inited.
20/04/27 22:49:01 INFO service.AbstractService: Service:OperationManager is started.
20/04/27 22:49:01 INFO service.AbstractService: Service:SessionManager is started.
20/04/27 22:49:01 INFO service.AbstractService: Service:CLIService is started.
20/04/27 22:49:01 INFO service.AbstractService: Service:ThriftBinaryCLIService is inited.
20/04/27 22:49:01 INFO thrift.ThriftCLIService: Client protocol version: HIVE_CLI_SERVICE_PROTOCOL_V10
20/04/27 22:49:01 INFO session.SessionState: Created HDFS directory: /tmp/hive/Administrator/024aea43-7ca8-4be2-a3a7-42affb12238
20/04/27 22:49:01 INFO session.SessionState: Created local directory: F:/Hadoop/Hive/apache-hive-2.2.0-bin/my_hive/scratch_dir/0
20/04/27 22:49:01 INFO session.SessionState: Created HDFS directory: /tmp/hive/Administrator/024aea43-7ca8-4be2-a3a7-42affb12238
20/04/27 22:49:01 INFO session.HiveSessionImpl: Operation log session directory is created: F:\Hadoop\Hive\apache-hive-2.2.0-bin
20/04/27 22:49:01 INFO service.CompositeService: Session opened, SessionHandle [024aea43-7ca8-4be2-a3a7-42affb12238f], current s
20/04/27 22:49:01 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Updating thread name to 024aea43-7ca8-4be2-a3a7-42affb12238f main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Resetting thread name to main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Updating thread name to 024aea43-7ca8-4be2-a3a7-42affb12238f main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Resetting thread name to main
Connected to: Apache Hive (version 2.2.0)
Driver: Hive JDBC (version 2.2.0)
Transaction isolation: TRANSACTION_REPEATABLE_READ
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Updating thread name to 024aea43-7ca8-4be2-a3a7-42affb12238f main
20/04/27 22:49:02 INFO operation.Operation: Putting temp output to file F:\Hadoop\Hive\apache-hive-2.2.0-bin\my_hive\scratch_dir
or output to file F:\Hadoop\Hive\apache-hive-2.2.0-bin\my_hive\scratch_dir\024aea43-7ca8-4be2-a3a7-42affb12238f87028132453359560
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Resetting thread name to main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Updating thread name to 024aea43-7ca8-4be2-a3a7-42affb12238f main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Resetting thread name to main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Updating thread name to 024aea43-7ca8-4be2-a3a7-42affb12238f main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Resetting thread name to main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Updating thread name to 024aea43-7ca8-4be2-a3a7-42affb12238f main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Resetting thread name to main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Updating thread name to 024aea43-7ca8-4be2-a3a7-42affb12238f main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Resetting thread name to main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Updating thread name to 024aea43-7ca8-4be2-a3a7-42affb12238f main
20/04/27 22:49:02 INFO conf.HiveConf: Using the default value passed in for log id: 024aea43-7ca8-4be2-a3a7-42affb12238f
20/04/27 22:49:02 INFO session.SessionState: Resetting thread name to main
Beeline version 2.2.0 by Apache Hive
hive>
hive>

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值