常用操作练习
作者:
Noe1017
,
2024-02-10 20:03:38
,
所有人可见
,
阅读 42
按顺序执行以下操作
1.在hdfs中创建文件夹:/itcast/itheima,如存在请删除(跳过回收站)
hdfs dfs -mkdir -p /itcast/itheima
2.上传/etc/hosts文件到hdfs的/itcast/itheima内
hdfs dfs -put /etc/hosts /itcast/itheima
#由于,这里的参数格式自动识别,源操作地址和目标操作地址,因此不需要特别加协议头来区分是hdfs系统,还是本地
3.查看hdfs中刚刚上传的文件内容
hdfs dfs -cat /itcast/itheima/hosts
4.向hdfs中上传的文件追加:itheima到最后一行
hdfs dfs -appendToFile - /itcast/itheima/hosts
itheima
5.下载hdfs中上传的文件到本地任意目录
6.在hdfs中创建文件夹:/itcast/bigdata,将/itcast/itheima/hosts文件复制到/itcast/bigdata内
7.将/itcast/itheima/hosts文件重命名为/itcast/itheima/myhost
8.删除/itcast文件夹