启动hive
启动hiveserver2
hiveserver2作用:
1.为hive提供了一种允许客户端远程访问的服务。
2.基于thrift协议,支持跨平台,跨编程语言对hive访问;
3.允许远程访问hive;
详细步骤
1)HDFS创建目录
hadoop fs -mkdir -p /jikeh/hive/wordcount/input
2)上传文本文件到HDFS
hadoop fs -copyFromLocal /usr/local/Env/Hadoop/hadoop-2.6.5/LICENSE.txt /jikeh/hive/wordcount/input
3)进入hive命令行界面,编写HiveQL语句实现WordCount算法
hive (default)>create table words(line string);
hive (default)>load data inpath '/jikeh/hive/wordcount/input' overwrite into table docs;
hive (default)>create table wordcount as select word, count(1) as count from (select explode(split(line,' '))as word from words) w group by word order by word;
4)客户端查看运行结果
请参考这篇文章:Hive客户端工具的使用
客户端工具:Oracle SQL Developer
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/shili/s50875.shtml