我们尝试操作一下hdfs
[root@quickstart Desktop]# hdfs dfs -ls /
Found 6 items
drwxrwxrwx - hdfs supergroup 0 2017-10-23 10:29 /benchmarks
drwxr-xr-x - hbase supergroup 0 2020-04-28 01:06 /hbase
drwxr-xr-x - solr solr 0 2017-10-23 10:32 /solr
drwxrwxrwt - hdfs supergroup 0 2020-04-28 01:06 /tmp
drwxr-xr-x - hdfs supergroup 0 2017-10-23 10:31 /user
drwxr-xr-x - hdfs supergroup 0 2017-10-23 10:31 /var
在这需要注意一下,我们使用HDFS的全路径尝试一下
[root@quickstart Desktop]# hdfs dfs -ls hdfs://127.0.0.1:9000/
20/04/28 01:13:57 WARN ipc.Client: Failed to connect to server: quickstart.cloudera/127.0.0.1:9000: try once and fail.
java.net.ConnectException: Connection refused
结果发现执行报错,这是因为CDH中启动的Hadoop集群,namenode的端口号是8020,不是9000,这一点需要注意一下
[root@quickstart Desktop]# hdfs dfs -ls hdfs://127.0.0.1:8020/
Found 6 items
drwxrwxrwx - hdfs supergroup 0 2017-10-23 10:29 hdfs://127.0.0.1:8020/benchmarks
drwxr-xr-x - hbase supergroup 0 2020-04-28 01:06 hdfs://127.0.0.1:8020/hbase
drwxr-xr-x - solr solr 0 2017-10-23 10:32 hdfs://127.0.0.1:8020/solr
drwxrwxrwt - hdfs supergroup 0 2020-04-28 01:06 hdfs://127.0.0.1:8020/tmp
drwxr-xr-x - hdfs supergroup 0 2017-10-23 10:31 hdfs://127.0.0.1:8020/user
drwxr-xr-x - hdfs supergroup 0 2017-10-23 10:31 hdfs://127.0.0.1:8020/var
在这里同样可以访问HDFS的web界面和YARN的web界面
在这里访问HDFS的web界面我们需要使用50070端口,因为这里面的hadoop集群的版本是2.6的,在hadoop2.x中hdfs的web界面端口是50070
可以通过hadoop version命令查看版本号
[root@quickstart Desktop]# hadoop version
Hadoop 2.6.0-cdh5.13.0
Subversion http://github.com/cloudera/hadoop -r 42e8860b182e55321bd5f5605264da4adc8882be
Compiled by jenkins on 2017-10-04T18:08Z
Compiled with protoc 2.5.0
From source with checksum 5e84c185f8a22158e2b0e4b8f85311
This command was run using /usr/lib/hadoop/hadoop-common-2.6.0-cdh5.13.0.jar