Install Hive using Mysql as metadata store On Ubuntu.

来源:互联网 发布:php语言好用吗 编辑:程序博客网 时间:2024/05/16 01:45

This post is about the installation of Hive and use mysql as the metadata store on ubuntu. The environment of my system is ubuntu 12.04, hadoop 1.0.3, hive 0.9.0 and mysql 5.5.

The detail information of installation describes as follows:

step 1: install mysql

$ sudo apt-get install mysql-server

step 2: restart mysql service

$ sudo /etc/init.d/mysql restart or sudo service mysql restart

step 3: modify the configure file of hive hive-site.xml as follows:

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><configuration>    <property>        <name>hive.metastore.local</name>        <value>true</value>    </property>    <property>        <name>javax.jdo.option.ConnectionURL</name>        <value>jdbc:mysql://localhost:3306/hive?characterEncoding=UTF-8</value>    </property>    <property>        <name>javax.jdo.option.ConnectionDriverName</name>        <value>com.mysql.jdbc.Driver</value>    </property>    <property>        <name>javax.jdo.option.ConnectionUserName</name>        <value>root</value>    </property>    <property>        <name>javax.jdo.option.ConnectionPassword</name>        <value>mysql</value>    </property></configuration>

step 4: copy the mysql jdbc package to the directory hive-0.9.0/lib.

$ sudo cp *.jar /home/hadoop/hive-0.9.0/lib

step 5: create hive database in mysql shell.

step 6: start hive and create table in hive shell

$ bin/hive$ create table test (id int, name string)

step 7: see the metadata of hive in mysql shell

$ mysql -uroot -pmysql$ use hive;$ show tables;$ select * from TBLS;
原创粉丝点击