해당 문서는 hdfs 명령어에 대해 정리하기 위해 작성된 문서이다.
hdfs dfs -put Sample.txt /tmp
hdfs dfs -ls /tmp
hdfs dfs -cat /tmp/Sample.txt
# 파일 크기 %b, 파일 블록 크기 %o, 복제 수 %r, 소유자명 %u, 파일명 %n
hdfs dfs -stat '%b %o %r %u %n' /tmp/Sample.txt
hdfs dfs -mv /tmp/Sample.txt /tmp/Sample2.txt
# 전체 크기, 디렉터리 수, 파일 수, 노드 수 등 파일 시스템의 전체 상태
hdfs fsck /
# 하둡 파일 시스템의 기본 정보 및 통계
hdfs dfsadmin -report
hdfs dfs -get /tmp/Sample2.txt
hdfs dfs -rm /tmp/Sample2.txt # 우선은 임시 삭제 후 특정시간이 지나면 완전 삭제
# 임시 삭제가 필요 없는 경우
hdfs dfs -rm /tmp/Sample2.txt -skipTrash
hdfs 점검에서 파일 시스템 문제가 발생할 경우 "CORRUPT FILES", "MISSING BLOCKS", "MISSING SIZE", "CORRUPT BLOCKS" 등의 항목에 숫자가 표기된다.
# 안전 모드 상태라면 해제
hdfs dfsadmin -savemode leave
# 손상된 파일 강제 삭제
hdfs fsck / -delete
# 손상된 파일을 /lost + found 디렉토리로 옮김
hdfs fsck / -move
너무 잘 보고 있습니다