本文介绍brew install hive并修改默认的metastore存储方案,改Derby数据库为mysql的方法以及可能遇到的问题的解决方案。
1. 通过homebrew安装hive
1 |
|
2. 添加hadoop和hive的环境变量
1 2 3 4 5 6 |
|
3. 下载mysql connector
1 2 3 |
|
4. 创建mysql metastore
1 2 3 4 |
|
5. 配置hive的配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
6. 测试hive是否工作
1 2 3 |
|
7. Revoke few permissions on the mysql metastore
1 2 |
|
9. Further troubleshooting :
(a) If you get a bin log error saying statement format is not support. Login to your mysql console as root
$ mysql -uroot mysql > SET GLOBAL binlog_format = ‘ROW‘;
(b) You could also try reading the logs as follows. Logs can be emitted to the bash prompt while running hive by setting hive.root.logger to INFO,console.
$ hive -hiveconf hive.root.logger=INFO,console
(c)You could also read the raw hive logs which is usually located at /tmp/user_name/hive.log
(d)If you still have any errors, feel free to comment.
在配置完成后,可能遇到的问题解决方案:
一,Reference error
解决方案:
使用sequel pro, 修改hive用户的权限,添加Reference的global权限。
二,启动hive时遇到的" Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D "
解决方案:
修改hive-site.xml 配置中的以下key value即可:
<name>hive.exec.scratchdir</name>
<value>/tmp/hive-${user.name}</value>
<name>hive.exec.local.scratchdir</name>
<value>/tmp/${user.name}</value>
<name>hive.downloaded.resources.dir</name>
<value>/tmp/${user.name}_resources</value>
<name>hive.scratch.dir.permission</name>
<value>733</value>
restart hive metastore and hiveserver2