Hadoop综合大作业 要求:
1.用Hive对爬虫大作业产生的文本文件(或者英文词频统计下载的英文长篇小说)进行词频统计。
我下载的是一篇英文长篇小说《教父》,字数为
个,

将文章(godfather.txt)放在了wc文件中:

启动hadoop:
|
1
2
|
start-all.shjps |

文件上传至hdfs
|
1
2
|
hdfs dfs -put ./godfather.txt /bigdatacase/datasethdfs dfs -ls /bigdatacase/dataset |

启动hive
|
1
|
hive |

创建原始文档表
|
1
|
create table novel(long string); |

导入文件内容到表novel
|
1
|
load data inpath ‘/bigdatacase/dataset/godfather.txt‘ overwrite into table novel; |

进行词频统计并放入表novelcount表中
|
1
|
create table novelcount as select word,count(1) from (select(long,‘ ‘)) as word from novel) word group by word; |

查看统计结果(前20个)
|
1
|
select * from novelcount limit 20 |

2.用Hive对爬虫大作业产生的csv文件进行数据分析,写一篇博客描述你的分析过程和分析结果。
爬虫大作业爬取的结果是如图所示

将统计好的文件number.txt和number.csv放置wc文件夹中

启动hdfs
|
1
2
|
start-all.shjps |


将文件上传至hdfs,并显示前十条

启动mysql

启动hive

创建数据库
|
1
|
create database numbercount; |

创建表

导入数据

查看数据


原文:https://www.cnblogs.com/BOXczx/p/9090212.html