hive初次使用报错

hive(元数据存储在mysql) 启动
Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, don't forget to include the option to auto-create the underlying database in your JDBC connection string (e.g. ?createDatabaseIfNotExist =true for mysql)

看解释是hive元数据库没有初始化的原因,
第一次需要执行初始化命令: schematool -dbType mysql -initSchema
查看初始化后信息 schematool -dbType mysql -info

这时候你再查看mysql中 hive 数据库的表,会有一大堆表生成,如图
hive启动过程中的报错


执行完成之后,可以重启一下mysql服务,service mysqld restart

之后又报错,
Exception in thread "main" java.lang.IllegalArgumentException : java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir}/${system:user.name}
at org.apache.hadoop.fs.Path.initialize(Path.java:206)
at org.apache.hadoop.fs.Path.(Path.java:172)
at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:606)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:526)
at org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:494)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:709)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:645)
at sun.reflect.NativeMethodAccessorImpl .invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl .invoke(NativeMethodAccessorImpl .java:57)
at sun.reflect.DelegatingMethodAccessor Impl.invoke(DelegatingMethodAccessor Impl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir}

这个错误的原因是   ${system:java.io.tmpdir} 设置的路径不存在还是怎么回事,那么在hive-site.xml中去查找 ${system:java.io.tmpdir} ,将该路径替换成你本地的缓存目录,这个目录你可以自己建,可以在hive目录下建立一个tmp目录,替换成这个路径。

执行bin/hive

成功。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值