Skip to content

Latest commit

 

History

History
74 lines (59 loc) · 1.65 KB

1Hive.md

File metadata and controls

74 lines (59 loc) · 1.65 KB

Hive

教程

配置mysql数据库存储

  1. 根据官网下载安装 官方手册

  2. 下载mysql j包 官方地址

cp mysql-connector-java-8.0.13.jar $HIVE_HOME/lib
  1. 修改配置文件
cd $HIVE_HOME/conf
$ cp hive-default.xml.template hive-site.xml

配置如下

<configuration>
<property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://127.0.0.1:3306/hive_data?createDatabaseIfNotExist=true</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</value>
</property>
<property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>hive</value>
</property>
<property>    
        <name>hive.querylog.location</name>   
        <value>/home/hive2.1/tmp</value> 
</property>  
<property>    
        <name>hive.exec.local.scratchdir</name>   
        <value>/home/hive2.1/tmp</value> 
</property> 
<property> 
        <name>hive.downloaded.resources.dir</name>   
        <value>/home/hive2.1/tmp</value> 
</property>
</configuration>
cd $HIVE_HOME/conf
$ cp hive-env.sh.template hive-env.xml
添加hadoop目录地址:   HADOOP_HOME=/usr/local/hadoop-2.8.5
  1. 初始化数据
$HIVE_HOME/bin/schematool -dbType mysql -initSchema
  1. 进入客户端
$HIVE_HOME/bin/hive