mac OSX 上 brew install hive

本文介绍了BREW Install Have,并对默认的元存储方案进行了修改,将Derby数据库改为MySQL的方法,以及可能遇到的问题的解决方案。

[En]

This article introduces brew install hive and modifies the default metastore storage scheme, the method of changing the Derby database to mysql, and the solutions to the problems that may be encountered.

  1. 通过homebrew安装hive

1

brew install hive

  1. 添加hadoop和hive的环境变量

1

2

3

4

5

6

sudo vim ~/.bash_profile export HADOOP_HOME= /usr/local/Cellar/hadoop/hadoop .<a href="http://version.no" rel="noopener">version.no</a> export HIVE_HOME= /usr/local/Cellar/hive/hive .<a href="http://version.no" rel="noopener">version.no</a> /libexec
source ~/.bash_profile

  1. 下载 mysql connector

1

2

3 curl -L '<a href="http://www.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.22.tar.gz/from/http://mysql.he.net/" rel="noopener">http://www.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.22.tar.gz/from/http://mysql.he.net/</a>' | tar xz sudo cp mysql-connector-java-5.1.15 /mysql-connector-java-5 .1.22-bin.jar /usr/local/Cellar/hive/hive .<a href="http://version.no" rel="noopener">version.no</a> /libexec/lib/

  1. 创建mysql metastore

1

2

3

4

mysql> CREATE DATABASE metastore;

mysql> USE metastore;

mysql> CREATE USER 'hiveuser' @ 'localhost' IDENTIFIED BY 'password' ;

mysql> GRANT SELECT , INSERT , UPDATE , DELETE , ALTER , CREATE ON metastore.* TO 'hiveuser' @ 'localhost' ;

  1. 配置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 cd /usr/local/Cellar/hive/hive .<a href="http://version.no" rel="noopener">version.no</a> /libexec/conf
cp hive-default.xml.template hive-site.xml

#&#x6DFB;&#x52A0;&#x6216;&#x8005;&#x7F16;&#x8F91;&#x5982;&#x4E0B;&#x5185;&#x5BB9;
<name>javax.jdo.option.ConnectionURL<</name> /name >
<value>jdbc:mysql:</value> //localhost/metastore < /value >

< /property >
<name>javax.jdo.option.ConnectionDriverName<</name> /name >
<value>com.mysql.jdbc.Driver<</value> /value >

< /property >
<name>javax.jdo.option.ConnectionUserName<</name> /name >
<value>hiveuser<</value> /value >

< /property >
<name>javax.jdo.option.ConnectionPassword<</name> /name >
<value>password<</value> /value >

< /property >
<name>datanucleus.fixedDatastore<</name> /name >
<value></value> false < /value >

< /property >

  1. 测试hive是否工作

1

2

3

$ hive;

hive > show tables;

hive> create table temp_table temp_col string;

  1. Revoke few permissions on the mysql metastore

1

2

$ mysql

mysql> REVOKE ALTER,CREATE ON metastore.* FROM 'hiveuser' @ 'localhost' ;

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

在配置完成后,可能遇到的问题解决方案

一、参考误差

[En]

One, Reference error

解决方案:

[En]

Solution:

使用Sequel PRO,修改配置单元用户的权限并添加引用的全局权限。

[En]

Using sequel pro, modify the permissions of the hive user and add the global permissions of the Reference.

第二,在启动配置单元时遇到绝对URI:${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D“中的相对路径

[En]

Second, “Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D” encountered when starting hive

解决方案:

[En]

Solution:

在hive-site.xml配置中修改以下密钥值:

[En]

Modify the following key value in the hive-site.xml configuration:

restart hive metastore and hiveserver2

Original: https://www.cnblogs.com/ToDoToTry/p/5349753.html
Author: fandyst
Title: mac OSX 上 brew install hive

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/6843/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

最近整理资源【免费获取】:   👉 程序员最新必读书单  | 👏 互联网各方向面试题下载 | ✌️计算机核心资源汇总