Patching, Cluster Expansion, Hardware Refresh and Data Migration
OS Patching with Rolling Reboots
Security patches need reboots. Do them in batches that the cluster can tolerate.
| Rule | Reason |
|---|---|
| Patch masters one at a time using failover | NameNode, RM, ZooKeeper, JournalNodes keep quorum |
| Patch workers in batches of 2 to 5 percent, one rack at a time | Keeps at least 2 replicas available |
| Use maintenance mode or short outage under the dead-node timeout | Avoid re-replication storms |
| Check health between batches | Stop if missing blocks appear |
yaml
# patch.yml (Ansible)
- hosts: workers
serial: "3%"
max_fail_percentage: 0
tasks:
- name: Put DataNode in maintenance (stop services gracefully)
ansible.builtin.systemd: { name: "{{ item }}", state: stopped }
loop: [hadoop-nodemanager, hadoop-datanode]
- name: Patch and reboot
ansible.builtin.dnf: { name: "*", state: latest, security: true }
- ansible.builtin.reboot: { reboot_timeout: 900 }
- name: Start services
ansible.builtin.systemd: { name: "{{ item }}", state: started }
loop: [hadoop-datanode, hadoop-nodemanager]
- name: Wait until DataNode is registered and no under-replicated backlog
ansible.builtin.shell: |
for i in $(seq 1 60); do
U=$(curl -s "http://nn1:9870/jmx?qry=Hadoop:service=NameNode,name=FSNamesystem" | jq '.beans[0].UnderReplicatedBlocks')
[ "$U" -lt 100 ] && exit 0; sleep 30; done; exit 1
delegate_to: localhost
Adding Nodes or Racks
- Rack, power and network the servers; apply the standard OS image
- Add DNS and topology data (new rack path)
- Run Ansible to install and configure Hadoop
- Add to
workersfile and any include lists - Start DataNode and NodeManager
hdfs dfsadmin -reportshows new capacity- Run the balancer slowly at low-traffic hours
- Update monitoring targets and capacity sheet
bash
hdfs dfsadmin -refreshNodes
yarn rmadmin -refreshNodes
hdfs dfsadmin -setBalancerBandwidth 52428800
hdfs balancer -threshold 8 -idleiterations 3
hdfs dfsadmin -printTopology | tail -15
Hardware Refresh (Replace Old With New)
- Add new nodes first, then retire old ones in batches
- Decommission old racks one at a time and wait for Decommissioned state
- Keep replication and rack rules satisfied during the move
- Check old nodes have no unique data before removal (
fsck -blocks -locations) - Wipe disks securely and update the inventory
Migrating Data Between Clusters
| Scenario | Approach |
|---|---|
| Old cluster to new cluster | Parallel run: distcp in waves, switch jobs by dataset, final sync with writes frozen |
| On-premises to cloud | distcp to object storage over a dedicated link or transfer appliance |
| Major version change (2.x to 3.x) | Use webhdfs:// or hdfs:// distcp from the source (the older cluster) running on the newer cluster |
bash
# run from the NEW (higher version) cluster, read old data using webhdfs
hadoop distcp -update -p -m 100 -bandwidth 80 webhdfs://old-nn:9870/data hdfs://new/data
# final cutover sync: freeze writers, snapshot-diff distcp, then change client configs / nameservice
Migration Plan Template
| Phase | Actions |
|---|---|
| Discover | Inventory data, jobs, users, schedules, dependencies, volumes (hdfs dfs -du) |
| Prepare | Build target, security, Ranger policies, KMS keys, quotas, monitoring |
| Copy | Bulk distcp, then incremental syncs |
| Validate | Counts, checksums, sample queries and job outputs match |
| Cutover | Freeze, final sync, switch endpoints, start jobs on the new side |
| Hypercare | Fast support for 2 to 4 weeks, keep old data until sign-off |
| Decommission | Delete old data after retention approval |
Data and metadata together: Remember Hive metastore content, Oozie or Airflow definitions, HBase tables, Ranger policies and user access. Migrating only the files is a common cause of failed moves.
Network is the usual limit: Moving 1 PB over a 10 Gbit link at full speed takes about 9 days (1 PB / 1.25 GB per second). Real life is slower, so plan bandwidth and do not saturate production links.
Conclusion
Lifecycle work follows the same ideas: small batches, health checks between them, capacity added before old nodes removed, and migrations done in waves with validation and a clear cutover.
Quick Summary: rolling batches by rack; add before remove; balancer; distcp waves + final sync.

