熟悉常用的Hadoop操作
一、使用hadoop用户登录Linux系统,启动Hadoop(Hadoop的安装目录为“/usr/local/hadoop”),为hadoop用户在HDFS中创建用户目录“/user/hadoop”
$ cd /usr/local/hadoop
$ ./sbin/start-dfs.sh
$ ./bin/hdfs dfs -mkdir -p /user/hadoop
二、接着在HDFS的目录“/user/hadoop”下,创建test文件夹,并查看文件列表
$ cd /usr/local/hadoop
$ ./bin/hdfs dfs -mkdir test
$ ./bin/hdfs dfs -ls .
三、将Linux系统本地的“~/.bashrc”文件上传到HDFS的test文件夹中,并查看test
$ cd /usr/local/hadoop
$ ./bin/hdfs dfs -put ~/.bashrc test
$ ./bin/hdfs dfs -ls test
四、将HDFS文件夹test复制到Linux系统本地文件系统的“/usr/local/hadoop”目录下。
$ cd /usr/local/hadoop
$./bin/hdfs dfs -get test ./