| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 코테
- 영어
- bigdata engineering
- Apache Kafka
- pyspark
- 개발
- BigData
- 여행
- 코딩
- bigdata engineer
- Iceberg
- HIVE
- 자바
- Spark
- 삼성역맛집
- 코딩테스트
- HDFS
- Data Engineering
- Trino
- apache iceberg
- 프로그래머스
- 백준
- Data Engineer
- 코엑스맛집
- Kafka
- Linux
- 맛집
- java
- 알고리즘
- hadoop
- Today
- Total
지구정복
[HDFS] Storage Type & Policies 본문
데이터 노드에 사용될 실제 서버의 디렉터리(ex: /hadoop/disk1/, /hadoop/disk2)를 특정 디스크 타입으로 마운트하고
이를 HDFS상에서 해당 디렉터리가 HDD인지 SSD인지 등을 설정할 수 있다.
HDFS storage types
먼저 HDFS에서 사용가능한 스토리지 타입은 다음과 같다.
- ARCHIVE - Archival storage is for very dense storage and is useful for rarely accessed data. This storage type is typically cheaper per TB than normal hard disks.
- DISK - Hard disk drives are relatively inexpensive and provide sequential I/O performance.
This is the default storage type. - SSD - Solid state drives are useful for storing hot data and I/O-intensive applications.
- RAM_DISK - This special in-memory storage type is used to accelerate low-durability, single-replica writes.
위 종류에 따라 HDFS상에서 특정 데이터 노드 디렉터리에 스토리지 정책을 설정할 수 있다.
HDFS storage policies
아래처럼 6개의 정책이 존재한다.
- Hot - All replicas are stored on DISK.
- Cold - All replicas are stored ARCHIVE.
- Warm - One replica is stored on DISK and the others are stored on ARCHIVE.
- All_SSD - All replicas are stored on SSD.
- One_SSD - One replica is stored on SSD and the others are stored on DISK.
- Lazy_Persist - The replica is written to RAM_DISK and then lazily persisted to DISK.
기본은 Hot이다.
그럼 이제 HDFS의 디렉터리에 어떻게 설정하는지 알아본다.
Commands for configuring storage policies
먼저 아래 설정들이 되어 있어야 한다.
dfs.storage.policy.enabled - true (default)
dfs.storage.default.policy - HOT (default)
dfs.datanode.data.dir
- A datanode storage location /grid/dn/disk0 on DISK should be configured with [DISK]file:///grid/dn/disk0
- A datanode storage location /grid/dn/ssd0 on SSD should be configured with [SSD]file:///grid/dn/ssd0
- A datanode storage location /grid/dn/archive0 on ARCHIVE should be configured with [ARCHIVE]file:///grid/dn/archive0
- A datanode storage location /grid/dn/ram0 on RAM_DISK should be configured with [RAM_DISK]file:///grid/dn/ram0
- A datanode storage location /grid/dn/nvdimm0 on NVDIMM should be configured with [NVDIMM]file:///grid/dn/nvdimm0
즉, 만약 데이터노드로 사용되는 Linux server에 아래와 같이 디렉터리가 있다면
/hadoop/dn/1 SSD
/hadoop/dn/2 HDD (DISK)
/hadoop/dn/3 ARCHIVE
/hadoop/dn/4 HDD (DISK)
설정값은 아래와 같다.
hdfs dfs -ls / 명령어 실행시
/cold1 이란 디렉터리가 있다고 하자.
'hdfs storagepolicy'명령어를 사용해서 설정하면 된다.
* Set
Command: hdfs storagepolicies -setStoragePolicy -path <path> -policy <policyName>
Ex: hdfs storagepolicies -setStoragePolicy -path /cold1 -policy COLD
* List
Command: hdfs storagepolicies -getStoragePolicy -path <path>
Ex: hdfs storagepolicies -getStoragePolicy -path /cold1
아래의 정보들을 확인할 수 있다.
- Policy ID
- Policy name
- A list of storage types for block placement
- A list of fallback storage types for file creation
- A list of fallback storage types for replication
아래는 예시
| Policy ID | Policy Name | Block Placement (n replicas) | Fallback storages for creation | Fallback storages for replication |
| 15 | Lazy_Persist | RAM_DISK: 1, DISK: n-1 | DISK | DISK |
| 14 | All_NVDIMM | NVDIMM: n | DISK | DISK |
| 12 | All_SSD | SSD: n | DISK | DISK |
| 10 | One_SSD | SSD: 1, DISK: n-1 | SSD, DISK | SSD, DISK |
| 7 | Hot (default) | DISK: n | <none> | ARCHIVE |
| 5 | Warm | DISK: 1, ARCHIVE: n-1 | ARCHIVE, DISK | ARCHIVE, DISK |
| 2 | Cold | ARCHIVE: n | <none> | <none> |
| 1 | Provided | PROVIDED: 1, DISK: n-1 | PROVIDED, DISK | PROVIDED, DISK |
* Unset
Command: hdfs storagepolicies -unsetStoragePolicy -path <path>
Ex: hdfs storagepolicies -unsetStoragePolicy -path /cold1
이때 기존에 /cold1에 존재하는 데이터들은 가만히 있고, 신규로 생성되는 데이터들에 대해서만 적용된다.
기존 데이터들도 적용시키려면 mover 명령어를 사용해야 한다.
Command: hdfs mover -p /cold1
혹은 아래 명령으로도 실제 블록은 스토리지 policy에 맞게 이동시킬 수 있다.
* satisfy storage policy
- Command:
-
hdfs storagepolicies -satisfyStoragePolicy -path <path>
'데이터 엔지니어링 정복 > HDFS' 카테고리의 다른 글
| The directory item limit of /hdfs/directory/test_data is exceeded: limit=1048576 items=1048576 (1) | 2025.06.25 |
|---|---|
| [HDFS] 적정 heap memory (1) | 2025.06.05 |
| [HDFS] Erasure Coding (0) | 2023.05.12 |
| [HDFS&MR] (역대급삽질) Execute Hadoop Streaming using Python | 파이썬으로 하둡 스트리밍 실행하기 (1) | 2021.06.02 |
| [HDFS] HDFS파일 업로드 및 다운로드 기능하는 jar파일 만들고 실행하기 (1) | 2021.05.24 |