欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

hive配置常见问题的解决方法

程序员文章站 2022-03-31 09:32:44
按照一般教程配置后运行时可能会不成功,可能有以下问题: 1、mysql无法连接,3306这个端口绑定了127.0.0.1这个IP,通过netstat -an | grep 3306可以查看到...

按照一般教程配置后运行时可能会不成功,可能有以下问题:

1、mysql无法连接,3306这个端口绑定了127.0.0.1这个IP,通过netstat -an | grep 3306可以查看到,进入

/etc/mysql/mysql.conf.d/mysqld.cnf 找到 bind-address=127.0.0.1 并注释掉,重启mysql

2、mysql-connector这个jar包可能过高,在hive-site.xml中配置mysql URL时采用如下方式:

javax.jdo.option.ConnectionURLjdbc:mysql://192.168.101.217:3306/hive?createDatabaseIfNotExist=true&useSSL=false&nullNamePatternMatchesAll=true
JDBC connect string for a JDBC metastore

3、system:java.io.tmpdir 和system:user.name提示需要使用绝对路径

Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException:

java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D

at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:472)

at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:671)

at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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.lang.IllegalArgumentException: java.net.URISyntaxException:

Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D

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:515)

at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:458)

... 8 more

Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D

at java.net.URI.checkPath(URI.java:1804)

at java.net.URI.(URI.java:752)

at org.apache.hadoop.fs.Path.initialize(Path.java:203)

... 11 more

解决方法:

首先将conf/hive-site.xml中所有的system:java.io.tmpdir 和system:user.name都换成绝对路径。

然后找到如下代码:

hive.exec.local.scratchdir

/home/lch/software/Hive/apache-hive-2.1.1-bin/tmp/${system:user.name}

Local scratch space for Hive jobs

替换成如下代码:

hive.exec.local.scratchdir

/home/lch/software/Hive/apache-hive-2.1.1-bin/tmp/${user.name}

Local scratch space for Hive jobs

主要时是红色部份