赞
踩
目录
将文件上传到:上传到/user/hive/warehouse/db1.db/t_word目录下
xshell连接主机,启动hadoop集群,启动MySQL服务已就绪
尝试使用Hive的LOAD DATA
语句加载数据到表:
LOAD DATA INPATH '/user/hive/warehouse/db1.db/t_word/word.txt' INTO TABLE t_word;
- hive> LOAD DATA INPATH '/user/hive/warehouse/db1.db/t_word/word.txt' INTO TABLE t_word;
- FAILED: SemanticException Line 1:17 Invalid path ''/user/hive/warehouse/db1.db/t_word/word.txt'': No files matching path hdfs://mini01:8020/user/hive/warehouse/db1.db/t_word/word.txt
先创建目录,再将文件上传到目录下,再去加载到数据库表中,最后再去查询即可;
- hadoop fs -mkdir -p /user/hive/warehouse/db1.db/t_word
-
-
-
-
- hadoop fs -put word.txt /user/hive/warehouse/db1.db/t_word/
-
-
-
- LOAD DATA INPATH '/user/hive/warehouse/db1.db/t_word/word.txt' INTO TABLE t_word;
注意:文件重复要删除
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。