mac OSX 上 brew install hive

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

本文介绍brew install hive并修改默认的metastore存储方案,改Derby数据库为mysql的方法以及可能遇到的问题的解决方案。

1. 通过homebrew安装hive

1
brew  install  hive

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

1
2
3
4
5
6
sudo  vim ~/.bash_profile
 
export  HADOOP_HOME= /usr/local/Cellar/hadoop/hadoop .version.no
export  HIVE_HOME= /usr/local/Cellar/hive/hive .version.no /libexec
 
source  ~/.bash_profile

3. 下载mysql connector

1
2
3
 
sudo  cp  mysql-connector-java-5.1.15 /mysql-connector-java-5 .1.22-bin.jar  /usr/local/Cellar/hive/hive .version.no /libexec/lib/

4. 创建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' ;

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
cd  /usr/local/Cellar/hive/hive .version.no /libexec/conf
cp  hive-default.xml.template hive-site.xml
 
#添加或者编辑如下内容
<property>
   <name>javax.jdo.option.ConnectionURL< /name >
   <value>jdbc:mysql: //localhost/metastore < /value >
< /property >
<property>
   <name>javax.jdo.option.ConnectionDriverName< /name >
   <value>com.mysql.jdbc.Driver< /value >
< /property >
<property>
   <name>javax.jdo.option.ConnectionUserName< /name >
   <value>hiveuser< /value >
< /property >
<property>
   <name>javax.jdo.option.ConnectionPassword< /name >
   <value>password< /value >
< /property >
<property>
   <name>datanucleus.fixedDatastore< /name >
   <value> false < /value >
< /property >

6. 测试hive是否工作

1
2
3
$ hive;
hive > show tables;
hive> create table temp_table temp_col string;

7. 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

 
(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/{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 


本文转自fandyst 博客园博客,原文链接:http://www.cnblogs.com/ToDoToTry/    ,如需转载请自行联系原作者

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
5月前
|
SQL 关系型数据库 MySQL
Mac下安装hive
Mac下安装hive
168 0
在mac OSX中安装启动zookeeper(采用brew安装方式)
项目需要,所以,在mac OSX中安装了一下zookeeper。
585 0
|
5月前
|
数据安全/隐私保护
Mac平台出现brew command not found问题解决方法
Mac平台出现brew command not found问题解决方法
146 0
|
8月前
Mac brew 卡在 ‘Cloning into ‘.../homebrew-core(或 homebrew-cas)‘
Mac brew 卡在 ‘Cloning into ‘.../homebrew-core(或 homebrew-cas)‘
49 0
|
Shell Ruby
mac 安装brew报错 Failed to connect to raw.githubusercontent.com port 443: Connection refused解决办法...
mac 安装brew报错 Failed to connect to raw.githubusercontent.com port 443: Connection refused解决办法...
486 0
|
安全 关系型数据库 MySQL
Mac 使用 brew 安装 mysql
Mac 使用 brew 安装 mysql
Mac 使用 brew 安装 mysql
|
Linux iOS开发 MacOS
mac安装brew(国内地址,可成功安装!)
Brew全称叫Homebrew,是Mac系统上的软件包管理工具。这里的软件并不是指从AppStore或从网上下载的dmg文件,而是开发所需要用的一些工具软件,如gawk等。 只需要一个命令, 安装和卸载它们非常方便。
516 0
mac安装brew(国内地址,可成功安装!)
|
Ruby
MAC正确简单安装brew
MAC正确简单安装brew
366 0
|
开发工具 git iOS开发
Mac使用brew install 安装wget工具报错 fatal: not in a git directory Error: Command failed with exit 128: git
Mac使用brew install 安装wget工具报错 fatal: not in a git directory Error: Command failed with exit 128: git
1642 0
Mac使用brew install 安装wget工具报错 fatal: not in a git directory Error: Command failed with exit 128: git
|
存储 NoSQL 数据可视化
Mac OSX 平台安装 MongoDB
Mac OSX 平台安装 MongoDB
113 0
Mac OSX 平台安装 MongoDB