在Ubuntu上配置Hadoop分布式文件系统(HDFS)后,您可以通过以下步骤进行测试:
启动HDFS集群:
start-dfs.sh脚本启动HDFS集群。检查HDFS状态:
http://<namenode_ip>:50070,这是HDFS NameNode的Web界面。在这里,您可以查看集群的状态、存储使用情况等信息。创建测试目录和文件:
hdfs dfs -mkdir /testdir
hdfs dfs -touchz /testdir/testfile
列出目录内容:
hdfs dfs -ls /testdir
读取测试文件:
hdfs dfs -cat /testdir/testfile
复制文件:
hdfs dfs -cp /testdir/testfile /testdir/testfile_backup
移动文件:
hdfs dfs -mv /testdir/testfile_backup /testdir/testfile_moved
删除文件和目录:
hdfs dfs -rm /testdir/testfile_moved
hdfs dfs -rm -r /testdir
检查集群健康状况:
hdfs dfsadmin -report命令检查集群的健康状况和资源使用情况。停止HDFS集群:
stop-dfs.sh脚本停止HDFS集群。通过以上步骤,您可以验证HDFS的基本功能是否正常工作。如果在测试过程中遇到任何问题,请检查Hadoop配置文件(如core-site.xml、hdfs-site.xml和yarn-site.xml)是否正确配置,并确保所有节点之间的网络连接正常。