Upload
kay-kim
View
2.456
Download
1
Embed Size (px)
DESCRIPTION
Source: http://flyingbono.tistory.com/entry/HDFS-%EA%B4%80%EB%A0%A8-2%EC%B0%A8-%EC%9E%90%EB%A3%8C
Citation preview
Data Replication
• HDFS’s blocks in a file except the last block are the same size.
• The block size and replication factor are configurable per file.
• The NameNode periodically receives a Heartbeat and a Blockreport from each of the DataNodes in the cluster. – DataNodes send Heartbeat to the
NameNode. NameNode used Heartbeats to detect DataNode failure.
– DataNode periodically sends a report of all existing blocks to the NameNode.
Replica Placement
• For the common case, replication factor == 3– One replica on one node in the local rack– Another on a different node in the local rack– The last on a different node in a different
rack– If replication factor > 3,
additional replicas are randomly placed
Replica Placement
• Does not impact data reliability and availability guarantees.
• However, it does reduce the aggregate network bandwidth used when reading data. (3 개의 rack 이 아닌 , 2 개의 rack 에 데이터를 저장하기 때문 )
• Replicas of file 은 공평하게 분배되지 않음• This policy is a work in progress.
Replica Selection
• To minimize global bandwidth consumption and read latency, HDFS tries to satisfy a read request from a replica that is closest to the reader.
SafeMode
• 시작 시 , NameNode 는 SafeMode 상태• 데이터 block 의 복제는 안전모드 상태일 때
발생하지 않음• 안전하게 복제된 data block 의
percentage 를 점검한 후 , 안전모드 상태에서 벗어남
• 명시된 replication factor 보다 적은 data block 의 list 를 check
• NameNode 가 위 block 들을 다른 데이터노드에 복재함
NameNode Meta-data
• The NameNode uses a tansaction log called the EditLog to persistently record every change that occurs to file system metadata. – E.g.) creating a file, deleting a file, or changing
the replication factor of a file• The entire file system namespace, including
the mapping of blocks to files and file system properties, is stored in a file called the FsImage.
• EditLog & FsImage is stored as files in the NameNode’s local file system.
Checkpoint
• When the NameNode starts up, – NameNode 는 FsImage 와 EditLog 를
디스크로부터 읽고 , EditLog 로부터의 모든 transaction 들을 FsImage 에 적용한 뒤 , 새로운 버전의 FsImage 로 디스크에 저장
– EditLog 의 transactions 은 FsImage 에 저장되었기 때문에 버림
• 현재 , checkpoint 는 NameNode 시작 시에만 발생
• 주기적으로 checkpointing 을 지원하는 작업 구현 중
The communication protocol
• Layered on top of the TCP/IP protocol• Client Protocol : client ↔ NameNode• DataNode Protocol : DataNodes↔
NameNode• A Remote Procedure Call(RPC)
abstration wraps both the Client Protocol and the DataNode Protocol.– NameNode 는 어떠한 RPC 들도 초기화하지 않음– NameNode 는 DataNodes 나 Clients 에
발행된 요청에 대해서만 응답
Robustness
• The three common types of failure– NameNode failures– DataNode failures– Network partitions
Data Disk Failure
• A network partition can cause a subset of DataNodes to lose connectivity with the NameNode. – Using a Heartbeat message
• The necessity for re-replication’s reasons– A DataNode may become unavailable like a
dead DataNode– A replica may become corrupted– A hard disk on a DataNode may fail– The replication factor of a file may be
increased
NameNode Failure
• A single point of failure• 현재 , 자동적인 재 시작과 다른 머신에
의한 NameNode software 의 장애 극복은 지원되지 않음
Data Correctness/Integrity
• Use Checksums to validate data– Use CRC32
• DataNode stores the checksum.
Replication Pipelining
• DataNode 는 pipeline 내의 이전 DataNode 로부터 데이터를 받는 동시에 Pipeline 내의 다음 DataNode 로 전송
• The data is pipelined from one DataNode to the next.
File Deletes and Undeletes
• 사용자나 application 에 의해서 파일이 삭제되었을 때 , 그 파일은 HDFS 에서 바로 삭제되지 않음– /trash 폴더의 파일로 먼저 이름 변경– /trash 폴더에 있다면 , 복원 가능–일정 시간 후 , NameNode 는 해당 파일을
Namespace 에서 삭제 • 해당 파일과 그에 관련된 블록들의 해제