安装Hive
•解压Hive
•tar zxvf hive-0.8.1.tar /home/test/Desktop
•建立软连接
•ln –s hive-0.8.1 hive
•添加环境变量
•export HIVE_HOME=/home/test/Desktop/hive
•export PATH=….HIVE_HOME/bin:$PATH:.
配置Hive
•进入hive/conf目录
•依据hive-env.sh.template,创建hive-env.sh文件
•cp hive-env.sh.template hive-env.sh
•修改hive-env.sh
•指定hive配置文件的路径
•export HIVE_CONF_DIR=/home/test/Desktop/hive/conf
•指定Hadoop路径
• HADOOP_HOME=/home/test/Desktop/hadoop
hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=metastore_db;create=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org.apache.derby.jdbc.EmbeddedDriver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>APP</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>mine</value>
<description>password to use against metastore database</description>
</property>
•命令行键入
•Hive
•显示
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Logging initialized using configuration in jar:file:/home/test/Desktop/hive-0.8.1/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/test/hive_job_log_test_201208260529_167273830.txt
hive>
测试语句
•建立测试表test
•create table test (key string);
•show tables;
第四部分:使用MySQL数据库的安装方式
安装MySQL•Ubuntu 采用apt-get安装
•sudo apt-get install mysql-server
•建立数据库hive
•create database hive
•创建hive用户,并授权
•grant all on hive.* to hive@'%' identified by 'hive';
•flush privileges;
安装Hive
•解压Hive
•tar zxvf hive-0.8.1.tar /home/test/Desktop
•建立软连接
•ln –s hive-0.8.1 hive
•添加环境变量
•export HIVE_HOME=/home/test/Desktop/hive
•export PATH=….HIVE_HOME/bin:$PATH:.
修改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>false </value>
</property>
<property>
<name>datanucleus.fixedDatastore </name>
<value>true </value>
</property>
<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>
启动Hive
•命令行键入
•Hive
•显示
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Logging initialized using configuration in jar:file:/home/test/Desktop/hive-0.8.1/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/test/hive_job_log_test_201208260529_167273830.txt
hive>
测试语句
•建立测试表test
•create table test (key string);
•show tables;