hive搭建笔记(ubuntu)

在 hadoop单机环境搭建成功后,可以搭建hive。

在hdfs上建目录:
$ hadoop fs -mkdir /tmp
$ hadoop fs -mkdir /user/hive/warehouse

添加权限:
$ hadoop fs -chmod g+w   /tmp
$ hadoop fs -chmod g+w   /user/hive/warehouse

下载解压hive:
$ wget http://labs.mop.com/apache-mirror/hive/stable/hive-0.8.1.tar.gz .
$ tar -zxvf hive-0.8.1.tar.gz

设置HADOOP_HOME、HIVE_HOME,并将其添加到~/.bashrc
export HADOOP_HOME=/home/zxm/hadoop/hadoop-1.0.3
export HIVE_HOME=/home/work/hadoop/hive-0.8.1

多用户支持
(确认已安装好mysql)
启动mysql:
$ mysql -u root -p
mysql>grant all on hive.* to hive@localhost identified by '123456'
修改hive conf/hive-site.xml,如下:
<property>  
  <name>javax.jdo.option.ConnectionURL</name>  
  <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true<alue>  
  <description>JDBC connect string for a JDBC metastore</description>  
</property>  
<property>  
  <name>javax.jdo.option.ConnectionDriverName</name>  
  <value>com.mysql.jdbc.Driver<alue>  
  <description>Driver class name for a JDBC metastore</description>  
</property>  
<property>  
  <name>javax.jdo.option.ConnectionUserName</name>  
  <value>hive<alue>  
  <description>username to use against metastore database</description>  
</property>  
<property>  
  <name>javax.jdo.option.ConnectionPassword</name>  
  <value>123456<alue>  
  <description>password to use against metastore database</description>  
</property>
下载mysql jdbc包:
wget http://downloads.mysql.com/archives/mysql-connector-java-5.0/mysql-connector-java-5.0.8.tar.gz .
解压:
tar -zxvf mysql-connector-java-5.0.8.tar.gz 
将mysql-connector-java-5.0.8-bin.jar拷贝到hive lib目录下:
cp mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar  ./lib

启动hive:
$ cd /home/zxm/hadoop/hive-0.8.1 ; ./bin/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/zxm/hadoop/hive-0.8.1/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/work/hive_job_log_work_201207051945_218572007.txt
hive> SHOW TABLES;
OK
Time taken: 7.281 seconds
hive> CREATE TABLE pokes (foo INT, bar STRING);
OK
Time taken: 0.398 seconds
hive> SHOW TABLES;                             
OK
pokes
Time taken: 0.181 seconds
hive> DESCRIBE pokes;
OK
foo     int
bar     string
Time taken: 0.58 seconds
hive> 

你可能感兴趣的:(hadoop,String,ubuntu,jar,File,table)