Hive - 将本地磁盘文件导入到Hive表

  • 桌面有txt文件名为: words.txt
  • 上传至本地服务器: rz
  • 上传到HDFS: hadoop fs -put 12312312.txt /user/portal/user/portal/tmp/words.txt
  • 在Hive中建表

create external table if not EXISTS tmp.words_counts (word string ) STORED AS TEXTFILE LOCATION '/user/portal/tmp/xx1/words';

  • 将本地磁盘文件导入Hive表中:

LOAD DATA INPATH '/home/hadoop_portal/tmp/words.txt' OVERWRITE INTO TABLE tmp.words_counts

  • done

你可能感兴趣的:(hadoop,HDFS,HIVE)