Hdfs dfs命令使用

如果是把数据放在了hdfs系统,那么我们如何访问他们呢?

1.hdfs查看文件夹

./hdfs dfs -ls hdfs://mycluster/output/online/

2.hdfs创建目录dfs创建文件夹

./hdfs dfs -mkdir hdfs://mycluster/output/online/
./hdfs dfs -mkdir hdfs://mycluster/output/online/pv

这里有个坑,如果你直接创建多级目录,会得到错误提示,所以要一级一级的去建立目录才行!

16/12/22 18:32:54 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
mkdir: `hdfs://mycluster/output/online/pv': No such file or directory

3.创建hive表


CREATE EXTERNAL TABLE `pv_table`(
`city_name` string,
`pv` string,
`product_line` string)
PARTITIONED BY (
  `day` string)
ROW FORMAT DELIMITED
  FIELDS TERMINATED BY '\t'
STORED AS INPUTFORMAT
  'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
  'hdfs://mycluster/output/online/pv')

转载于:https://www.cnblogs.com/ae6623/p/6212447.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值