启动hive后一直是这个界面,这个也不算报错就是一直出不来hive的执行界面?
在hive配置文件conf/hive-site.xml中的mysql连接url中添加参数useSSL=false
从错误信息来看,是在连接MySQL数据库时出现的,可能是SSL连接设置不正确导致的。
1、在连接MySQL数据库时,设置useSSL=false,这样就可以禁用SSL连接。
2、需要使用SSL连接,设置useSSL=true,并提供服务器证书的信任库(truststore)以进行证书验证。
3、检查MySQL版本是否符合SSL连接的要求。根据错误信息,MySQL 5.5.45+、5.6.26+和5.7.6+版本需要默认使用SSL连接,如果没有设置明确的选项,则会出现上述错误。
4、检查MySQL配置文件中是否正确设置了SSL连接选项。
①启动Hadoop:start-all.sh
②初始化Metastore架构:schematool -dbType mysql -initSchema
③启动Hive:hive
hive> 进入hive shell
④创建/删除/修改/查看 数据库、表、视图,向表中装载数据,查询数据等等。
注:
①启动hive报错:
Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException:
Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
原因是hive-site.xml里的临时目录没有设置好。
修改${system:Java.io.tmpdir}为自己创建的临时目录/opt/module/hive/tmp。
<property>
<name>Hive.exec.local.scratchdir</name>
<value>${system:Java.io.tmpdir}/${system:user.name}</value>
<description>Local scratch space for Hive jobs</description>
</property>
<property>
<name>hive.downloaded.resources.dir</name> <value>${system:java.io.tmpdir}/${hive.session.id}_resources</value>
<description>Temporary local directory for added resources in the remote file system.</description>
</property>
<property>
<name>hive.server2.logging.operation.log.location</name>
<value>${system:java.io.tmpdir}/${system:user.name}/operation_logs</value>
<description>Top level directory where operation logs are stored if logging functionality is enabled</description>
</property>
<property>
<name>hive.querylog.location</name>
<value>${system:java.io.tmpdir}/${system:user.name}</value>
<description>Location of Hive run time structured log file</description>
</property>
②schematool -dbType mysql -initSchema时报错:
Schema initialization FAILED! Metastore state would be inconsistent !!
网上教程都是说在文件头部加上mysql的连接配置,但是hive-site.xml.templat中原本是有derby的配置,这样就会被下面的derby配置覆盖,导致初始化失败。方法就是可以将mysql配置放在最下面,或者删除derby的配置。
删除derby的配置产生的metastore_db目录。
③hive命令(如show databases ,show tables),会报出如下错误:
Failed with exception Java.io.IOException:java.lang.IllegalArgumentException: java.NET.URISyntaxException: Relative path in absolute URI: ${system:user.name}
找到hive-site.xml的hive.exec.local.scratchdir的值里面的system.user.name改为{system.user.name}改为system.user.name改为{user.name}。