首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Hive环境筹建

2013-07-09 
Hive环境搭建?Hive1.安装(1)安装要求:Java1.6;Hadoop0.20.x(2)安装步骤$ tar -xzvf hive-x.y.z.tar.gz$ cd

Hive环境搭建

?

Hive

1.安装

(1)安装要求:Java1.6;Hadoop0.20.x

(2)安装步骤

$ tar -xzvf hive-x.y.z.tar.gz

$ cd hive-x.y.z$ export HIVE_HOME={{pwd}}$ export PATH=$HIVE_HOME/bin:$PATH$ export JAVA_HOME=/usr/java/jdk1.7.0_01

?

$ export HADOOP_HOME=<hadoop-install-dir>

$ $HADOOP_HOME/bin/hadoop fs -mkdir /tmp $ $HADOOP_HOME/bin/hadoop fs -mkdir /user/hive/warehouse $ $HADOOP_HOME/bin/hadoop fs -chmod g+w /tmp $ $HADOOP_HOME/bin/hadoop fs -chmod g+w /user/hive/warehouse

?

注:0.8.1的hive版本忽略hive-default.xml,因此需要将hive/conf下的hive-default.xml.template复制并改名为hive-site.xml。

?

(3)存储元数据:mysql数据库。

Hive 将元数据存储在 RDBMS 中,有三种模式可以连接到数据库:Hive默认是采用Derby来存储其Meta信息的,现在我们需要修改为mysql。mysql -u rootmysql> CREATE USER 'hive'@'hivedb.acme.com' IDENTIFIED BY 'dbpassword';mysql> CREATE DATABASE hivemetastoredb DEFAULT CHARACTER SET latin1 DEFAULT COLLATE latin1_swedish_ci;mysql> GRANT ALL PRIVILEGES ON hivemetastoredb.* TO 'hive'@'hivedb.acme.com' WITH GRANT OPTION;mysql> flush privileges;mysql> quit;

?

<property> <name>hive.metastore.local</name> <value>true</value> <description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM</description> </property> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://hive-mysql:3306/hive?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> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>hive</value> <description>username to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>hivepasswd</value> <description>password to use against metastore database</description> </property>

?

$ sudo apt-get install libboost-dev automake libtool flex bison pkg-config g++

?

$ wget http://apache.freelamp.com/incubator/thrift/0.2.0-incubating/thrift-0.2.0-incubating.tar.gz$ tar -zxvf thrift-0.2.0-incubating.tar.gz$ cd thrift-0.2.0$ ./bootstrap.sh$ ./configure$ sudo make$ sudo make install

?

(4)使用thrift来连接Hive

需要修改Hive的配置文件conf/hive-site.xml中的hive.metastore.uris参数,一般端口号是10000.

hive.metastore.uris

thrift://hostname:portnum?

【where?hostname?is the name of the machine hosting the Thrift server, and?portnum?is the port number used above in the installation script.】

?

?启动hive的Thrift Server,即可使用Hive了。

hive --service hiveserver

?

?

?

?

热点排行