首页 > 数据库技术 > 详细

Hive-0.12.0 配置Mysql的Metasotre

时间:2014-04-10 07:28:16      阅读:502      评论:0      收藏:0      [点我收藏+]

转载自:Hive-0.12.0 配置Mysql的Metasotre

  1.  官网下载Hive-0.12.0

    下载地址:hive-0.12.0

  2、安装Mysql-server

bubuko.com,布布扣
#注意:如果安装mysql完整的server-client,yum执行yum -y install mysql-server 如果,仅仅安装客户端yum -y install mysql即可
#这里我们安装完整的mysql-server
$sudo yum -y install mysql-server
#设置开机自启动
$sudo /sbin/chkconfig --add mysqld
$sudo /sbin/chkconfig mysqld on  
$sudo /sbin/service mysqld start
#设置初始root密码
$sudo mysqladmin -u root password a123456

$mysql -uroot -pa123456

#创建DB for Hive MetaStore
mysql> create database hive_metastore;
#给予mysql root用户以master.hadoop上的所有权限,本机hostname为master.hadoop
mysql> grant all privileges on *.* to root@master.hadoop identified by a123456;
mysql> flush privileges;
bubuko.com,布布扣

  

  3.  解压压缩包并修改环境变量.

bubuko.com,布布扣
[hadoop@master ~]$ tar -xzvf hive-0.12.0.tar.gz
[hadoop@master ~]$ cd hive-0.12.0/
[hadoop@master hive-0.12.0]$ pwd
/home/hadoop/hive-0.12.0  

#修改/etc/profile 添加HIVE_HOME环境变量,并将Hive的bin添加到PATH中
[hadoop@master hive-0.12.0]$ sudo vim /etc/profile
#在最后追加:
#hive-0.12.0
export HIVE_HOME=/home/hadoop/hive-0.12.0
export PATH=${PATH}:${HIVE_HOME}/bin

#编辑完之后到shell下执行:
[hadoop@master hive-0.12.0]$ source /etc/profile
bubuko.com,布布扣

  

  4.  阅读官方文档关于Mysql-Metastore有关Remote Metastore的介绍

  官方地址:https://cwiki.apache.org/confluence/display/Hive/AdminManual+MetastoreAdmin

 

   其中有关Remote Metastore的Server端配置说明如下:

   bubuko.com,布布扣

  根据以上信息配置hive-site.xml

  

bubuko.com,布布扣
[hadoop@master hive-0.12.0]$ cd conf/
[hadoop@master conf]$ cp hive-default.xml.template hive-site.xml 
bubuko.com,布布扣

  编辑hive-site.xml

  找到:javax.jdo.option.ConnectionURLjavax.jdo.option.ConnectionDriverName,修改为:

bubuko.com,布布扣
<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:mysql://master.hadoop/hive_metastore?createDatabaseIfNotExist=true</value>
  <description>JDBC connect string for a JDBC metastore</description>
</property>

<property>
  <name>javax.jdo.option.ConnectionDriverName</name>
  <value>com.mysql.jdbc.Driver</value>
  <description>Driver class name for a JDBC metastore</description>
</property>
bubuko.com,布布扣

   找到:javax.jdo.option.ConnectionUserNamejavax.jdo.option.ConnectionPassword,修改为:

bubuko.com,布布扣
<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>root</value>
  <description>username to use against metastore database</description>
</property>

<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>a123456</value>
  <description>password to use against metastore database</description>
</property>
bubuko.com,布布扣

  将准备好的mysql-jdbc的jar, copy到$HIVE_HOME/lib下:

bubuko.com,布布扣
[hadoop@master]$ cp mysql-connector-java-5.1.9.jar $HIVE_HOME/lib/
bubuko.com,布布扣

  仅仅设置完后,仍然报错:

bubuko.com,布布扣

  查看Hive的日志,默认的位于/tmp/${username}/hive.log, 在hive-site.xml中配置。

bubuko.com,布布扣

  回头查看Remote Metastore文档下面有:

 

 bubuko.com,布布扣

  我们回头编辑hive-site.xml文件找到hive.metastore.schema.verification的配置,并将其设置成false。(注意:改参数在生成metastore时会用到)

bubuko.com,布布扣
<property>
  <name>hive.metastore.schema.verification</name>
  <value>false</value>
   <description>
   Enforce metastore schema version consistency.
   True: Verify that version information stored in metastore matches with one from Hive jars.  Also disable automatic
         schema migration attempt. Users are required to manully migrate schema after Hive upgrade which ensures
         proper metastore schema migration. (Default)
   False: Warn if the version information stored in metastore doesn‘t match with one from in Hive jars.
   </description>
</property>
bubuko.com,布布扣

配置完成。

  5.  启动hive shell环境,执行show databases 则代表已经成功生成metastore。

bubuko.com,布布扣

  进入mysql环境,查看hive元数据。

bubuko.com,布布扣

 

Hive 的具体操作请参看:Hive官方文档

Hive-0.12.0 配置Mysql的Metasotre,布布扣,bubuko.com

Hive-0.12.0 配置Mysql的Metasotre

原文:http://www.cnblogs.com/lucas-yu/p/3653866.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!