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里

 

查看统计结果

转载于:https://www.cnblogs.com/zhiling123/p/9042124.html

原文地址:https://www.cnblogs.com/twodog/p/12136891.html