Apache Hive Installation

来源:互联网 发布:360软件卫士下载 编辑:程序博客网 时间:2024/05/17 18:01

1. Extract the latest hive package to /home/gl65073/hive

2. Set up env

$ export HIVE_HOME=/home/gl65073/hive
$ export PATH=$HIVE_HOME/bin:$PATH
$ $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

3. Run hive CLI

$ $HIVE_HOME/bin/hive

4. Prepare test data file

$ cat /tmp/test.txt
vajava,adg
adsd,dds
adsd,asdf
asdf,
asdf,dddd

5. Load test data file into hive table

hive> create table pokes(k string, v string) row format delimited fields terminated by','stored as textfile;
OK
Time taken: 0.092seconds
hive> load data local inpath '/tmp/test.txt'into table pokes;
Loading data to table default.pokes
Tabledefault.pokes stats: [numFiles=1, totalSize=46]
OK
Time taken: 0.376seconds
hive> select * from pokes;
OK
vajava  adg
adsd    dds
adsd    asdf
asdf
asdf    dddd
Time taken: 0.095seconds, Fetched: 5row(s)

0 0
原创粉丝点击