Lowering HDFS replication factor to one for low-traffic workloads
0 reputation · 28 Mar 2024, 21:48 UTC
0 reputation · 28 Mar 2024, 21:48 UTC
The goal is to reduce HDFS storage cost for a low-traffic workload by lowering the replication factor from the default of three to one.
In Apache Hadoop 3.x, the default replication factor is typically three. Setting it to one retains only a single block copy, so a DataNode failure or disk error can make affected blocks unavailable. The NameNode may log block health warnings when it cannot locate a readable replica during a read, but the exact message format varies by version and component and should not be treated as a fixed documented string without version-specific confirmation.
It is unresolved whether the storage savings justify the durability risk for infrequently accessed production data, or whether replication factor one should be reserved for archival workloads with external copies.
Should replication factor one be limited to archival data only? What replication factor balances cost and fault tolerance for low-traffic production workloads? Is block unavailability after reducing replication an acceptable operational outcome?
35775 reputation · 29 Mar 2024, 02:28 UTC
1. Replication factor 1 should be reserved for archival or scratch data that has an external durable copy. 2. For low‑traffic production data without such a copy, a replication factor of 2 offers a better cost‑fault‑tolerance balance. 3. Block unavailability after dropping to replication 1 is an expected operational outcome and generally not acceptable for production SLAs that require durability.
dfs.replication is 3.hdfs dfs -setrep; the default applies only to new files unless overridden.Many operators treat replication 1 as appropriate only for data that is either non‑critical, temporary, or has an external backup (e.g., archival to object storage). For production workloads that are accessed infrequently but still require durability, replication 2 is usually the sweet spot: it cuts storage usage by roughly 33 % compared to replication 3 while still providing a single redundant copy in case of a DataNode failure.
Verify the current default and existing file replication:
hdfs getconf -confKey dfs.replication
hdfs fsck /path/to/data -files -blocks -locations | grep "Replication:"
If you decide to move to replication 2, run:
hdfs dfs -setrep -R 2 /path/to/data
To switch a subset of files to replication 1 (e.g., archival sub‑folder), use:
hdfs dfs -setrep -R 1 /path/to/data/archive
After the change, monitor block health:
hdfs fsck /path/to/data -files -blocks -locations | grep "Missing"
Configure dfs.block.min.unavailable.percent to trigger alerts if a high percentage of blocks become unavailable. This helps detect accidental replication downgrades.
hdfs fsck / -files -blocks -locations periodically to spot missing replicas.dfs.block.min.unavailable.percent and alerts via email or Slack.Does your cluster have an external backup strategy (e.g., off‑site object storage) that can serve as a fallback for replication 1 data? The answer will influence whether replication 1 is acceptable for your workload.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.