Hive安装

Hadoop安装

Hadoop安装

Hive元数据三种存储方式

  1. Derby:hive默认的存储模式,不可以并发调用hive
  2. 本地MySQL
  3. 远程MySQL

采用第二种方式,安装MySQL,启动并创建Hive用户,创建Hive元数据库

insert into mysql.user(Host,User,Password) values("localhost","hive",password("hive"));

create database hive;

grant all on hive.* to hive@'%' identified by 'hive';

grant all on hive.* to hive@'localhost' identified by 'hive';

flush privileges;

 

配置Hive环境变量

vim /etc/profile

修改Hive配置

修改hive-site.xml

<property>

<name>javax.jdo.option.ConnectionURL </name>

<value>jdbc:mysql://localhost:3306/hive </value>

</property>

 

<property>

<name>javax.jdo.option.ConnectionDriverName </name>

<value>com.mysql.jdbc.Driver </value>

</property>

 

<property>

<name>javax.jdo.option.ConnectionPassword </name>

<value>hive </value>

</property>

 

<property>

<name>hive.hwi.listen.port </name>

<value>9999 </value>

<description>This is the port the Hive Web Interface will listen on </descript ion>

</property>

 

<property>

<name>datanucleus.autoCreateSchema </name>

<value>true</value>

</property>

 

<property>

<name>datanucleus.fixedDatastore </name>

<value>false</value>

</property>

</property>

 

<property>

<name>javax.jdo.option.ConnectionUserName</name>

<value>hive</value>

<description>Username to use against metastore database</description>

</property>

 

<property>

<name>hive.exec.local.scratchdir</name>

<value>/home/hdpsrc/hive/iotmp</value>

<description>Local scratch space for Hive jobs</description>

</property>

<property>

<name>hive.downloaded.resources.dir</name>

<value>/home/hdpsrc/hive/iotmp</value>

<description>Temporary local directory for added resources in the remote file system.</description>

</property>

<property>

<name>hive.querylog.location</name>

<value>/home/hdpsrc/hive/iotmp</value>

<description>Location of Hive run time structured log file</description>

</property>

 

注意事项

  • 找到mysql的jdbc驱动,比如mysql-connector-java-5.1.6-bin.jar拷贝到hive/lib目录下
  • hive/lib/jline-2.12.jar拷贝到/hadoop/yarn/lib/目录下

启动Hive,测试

在hive中新建表

 

在MySQL中查看

posted on 2016-02-28 11:13  一羽赐命  阅读(353)  评论(0编辑  收藏  举报