HDFS數據恢復方法如下:
hdfs dfs -cp /user/username/.Trash/Current/文件名 /目標路徑
恢復。hdfs dfs -cp /目錄/.snapshot/快照名/文件名 /目標路徑
恢復數據。hdfs fsck / -list-corruptfileblocks
定位問題塊,手動從備份恢復。hdfs distcp hdfs://源集群/路徑 hdfs://目標集群/路徑
。hdfs dfs -setrep -w 3 /路徑
調整副本數。注意:操作前建議先備份數據,優先使用自動化工具,復雜場景需聯系管理員處理。