hive基本操作与应用

启动hadoop

start-all.sh
jps

  

Hdfs上创建文件夹

hdfs dfs -mkdir wcinput
hdfs dfs -ls /user/hadoop

  

 

上传文件至hdfs

  先将文件放在wc文件夹中,我存放的是try.txt

  然后文件上传到hdfs

hdfs dfs -put ./try.txt wcinput
hdfs dfs -ls /user/hadoop/wcinput

  

  

启动Hive

hive

  

创建原始文档表

create table docs(long string);

  

  

 

导入文件内容到表docs并查看

load data inpath '/user/hadoop/wcinput/try.txt' overwrite into table docs;

 

select * from docs;

  

 

用HQL进行词频统计,结果放在表word_count里

 

查看统计结果

 

posted @ 2018-05-17 00:16  246王芷玲  阅读(118)  评论(0)    收藏  举报