准备工作:
1、Hadoop 2.2.0环境运行正常;
2、下载HIVE0.11版本。
操作步骤:
1、解压HIVE 0.11的文件
tar zxvf hive-0.11.0-bin.tar.gz -C /opt
2、修改.bash_profile文件,添加:
HIVE_HOME=/opt/hive-0.11.0-bin;
export HIVE_HOME;
export PATH=$HIVE_HOME/bin:$PATH
3、在$HIVE_HOME/conf目录下,执行如下命令生成hive的配置
cp hive-default.xml.template hive-site.xml
cp hive-env.sh.template hive-env.sh
cp hive-exec-log4j.properties.template hive-exec-log4j.properties
cp hive-log4j.properties.template hive-log4j.properties
4、创建HIVE使用的hdfs目录:
hdfs dfs -mkdir -p /user/hive/warehouse
hdfs dfs -mkdir /tmp
hdfs dfs -chmod g+w /tmp
hdfs dfs -chmod g+w /usr/hive/warehouse
5、Linux shell下直接使用hive命令,在hive下创建一个表格
hive> show databases;
OK
default
Time taken: 15.214 seconds, Fetched: 1 row(s)
hive> show tables;
OK
Time taken: 1.621 seconds
hive> create
create create_union(
hive> create ta
table tables tablesample tan(
hive> create table zq_blog(id IN
INPATH INPUTFORMAT INSERT INT INTO
hive> create table zq_blog(id INT, siteurl STRING);
OK
Time taken: 1.269 seconds
hive> SHOW TABLE
TABLE TABLES TABLESAMPLE
hive> SHOW TABLEs;
OK
zq_blog
Time taken: 0.102 seconds, Fetched: 1 row(s)
hive> quit