查看hadoop fs文件大小
hadoop fs -du -h /data/source/
查看hadoop fs文件目录
hadoop fs -ls /data/source/
查看hadoop fs文件夹内所有内容
hadoop fs -cat /data/source/*
将文件放入hdfs
hdfs dfs -copyFromLocal 本机文件目录 放入的hdfs目录
hdfs dfs -copyFromLocal /data/nm_use_1.txt /data/
hive中建立数据表
create table nm_use
(month string comment '账期' ,
province string comment '省份' ,
business_type string comment '业务类型' ,
product_type string comment '产品类型' ,
product_name string comment '产品名称' ,
business_hall string comment '本月是否使用手厅' ,
arpu_range string comment 'ARPU分档' ,
dou_range string comment 'DOU分档' ,
mou_range string comment 'MOU分档' ,
over_flow_range string comment '超套流量分档' ,
over_phone_range string comment '超套语音分档' ,
over_flow_income_range string comment '超套流量收入分档' ,
over_phone_income_range string comment '超套语音收入分档' ,
user_number string comment '用户数' ,
income string comment '收入' ,
flow string comment '流量使用量' ,
phone string comment '语音使用量' ,
over_flow string comment '超套流量使用量' ,
over_phone string comment '超套语音使用量' ,
over_flow_income string comment '超套流量收入' ,
over_phone_income string comment '超套语音收入' )
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
修改成utf8字符集,来支持中文字符
alter table nm_use character set utf8
hive中加载hdfs中数据
inpath后填写hdfs中目标文件路径
load data inpath '/data/nm_use_1.txt' into table nm_use;