Mac 安装Hive

栏目: 服务器 · 发布时间: 6年前

内容简介:安装mysql,执行下面命令在libexec/conf 中,把hive-default.xml.template 复制一份重新命名为hive-site.xmlhttps://dev.mysql.com/downloads/connector/j/

1. 用brew安装

brew install hive

2. mysql中创建元数据库

安装mysql,执行下面命令

create database metastore;
create user 'hive'@'localhost' identified by '123456';
grant select,insert,update,delete,alter,create,index,references on metastore.* to 'hive'@'localhost';
flush privileges;

3. 创建修改配置

在libexec/conf 中,把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.cj.jdbc.Driver</value>
</property>

<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>hive(填上述 mysql 中创建的用户名)</value>
</property>

<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>123456(填上述mysql中创建的用户密码)</value>
</property>

<property>
  <name>hive.exec.local.scratchdir</name>
  <value>/tmp/hive</value>
</property>

<property>
  <name>hive.querylog.location</name>
  <value>/tmp/hive</value>
</property>

<property>
  <name>hive.downloaded.resources.dir</name>
  <value>/tmp/hive</value>
</property>

<property>
  <name>hive.server2.logging.operation.log.location</name>
  <value>/tmp/hive</value>
</property>

4. 去网站下载mysql的connect jar 复制到lib中

https://dev.mysql.com/downloads/connector/j/

Mac 安装Hive

mac 的选择这个independent,解压后把jar复制到libexec/lib 中

5. 环境变量设置

export ANDROID_HOME=~/Library/Android/sdk
# added by Anaconda3 5.1.0 installer
export PATH="/Users/walle/anaconda3/bin:$PATH"

#sqoop
export SQOOP_HOME=/usr/local/Cellar/sqoop/1.4.6/libexec 
export PATH=$PATH:$SQOOP_HOME/bin

# hadoop 
export HADOOP_HOME=/usr/local/Cellar/hadoop/3.1.0/libexec 
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

#hive
export HIVE_HOME=/usr/local/Cellar/hive/hive/2.3.1/libexec
export PATH=$PATH:$HIVE_HOME/bin

export PATH=$PATH:/Applications/XAMPP/xamppfiles/bin

for f in $HADOOP_HOME/share/hadoop/common/hadoop-*.jar;do
     export CLASSPATH=$CLASSPATH:$f
done
for f in $HADOOP_HOME/share/hadoop/hdfs/hadoop-*.jar;do
     export CLASSPATH=$CLASSPATH:$f
done
for f in $HADOOP_HOME/share/hadoop/mapreduce/hadoop-*.jar;do
     export CLASSPATH=$CLASSPATH:$f
done
for f in $HADOOP_HOME/share/hadoop/yarn/hadoop-*.jar;do
     export CLASSPATH=$CLASSPATH:$f
done
export CLASSPATH=$CLASSPATH:$HADOOP_HOME/share/common/lib:$HADOOP_HOME/share/hdfs/lib:$HADOOP_HOME/share/mapreduce/lib:$HADOOP_HOME/share/tools/lib:$HADOOP_HOME/share/yarn/lib

6. 初始化库

在bin目录下执行下面的初始化

schematool -initSchema -dbType mysql

7. 运行hive

hive

4010


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Data Structures and Algorithms in Java

Data Structures and Algorithms in Java

Michael T. Goodrich、Roberto Tamassia / Wiley / 2010-01-26 / USD 177.41

* This newest edition examines fundamental data structures by following a consistent object-oriented framework that builds intuition and analysis skills of data structures and algorithms * Presents ne......一起来看看 《Data Structures and Algorithms in Java》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具