High Availability and Architecture
1. How does NameNode HA work, and how is split brain prevented?
Active and standby NameNodes share edits through a quorum of JournalNodes (a write needs a majority). ZKFC uses ZooKeeper for election. Split brain is prevented by QJM accepting writes only from the newest writer epoch, plus configured fencing (sshfence or shell) as extra safety.
2. What if two of three JournalNodes fail?
The quorum is lost, so the active NameNode cannot write edits and shuts itself down to protect the namespace. Restore JournalNodes; the cluster resumes after a NameNode restart. This is why JournalNodes need reliable hosts and monitoring.
3. Federation versus HA: what is the difference?
HA removes the single point of failure for one namespace. Federation adds several independent namespaces to scale metadata and isolate workloads, with shared DataNodes via block pools. They are combined in large clusters. Each federated namespace should itself be HA.
4. How do clients find the active NameNode?
They use the logical nameservice with ConfiguredFailoverProxyProvider, which tries both NameNodes and remembers the active one. A StandbyException triggers failover to the other.
5. What happens to running jobs when the active ResourceManager fails?
With RM HA and work-preserving recovery, the standby becomes active, loads application state from ZooKeeper and NodeManagers re-register their running containers. ApplicationMasters re-sync, so jobs usually continue.
Storage Features
6. Erasure coding versus replication: trade-offs?
RS-6-3 stores 50 percent overhead instead of 200 percent and tolerates 3 failures, but needs at least 9 nodes, costs more CPU and network for writes and repairs, and suits large, cold files. Hot or small-file data is better replicated.
7. Explain HDFS transparent encryption and who can read the data.
Files in an encryption zone are encrypted by clients using per-file keys, which are themselves encrypted with the zone key held in KMS. HDFS and DataNodes only see ciphertext. With proper KMS ACLs even HDFS superusers cannot decrypt, which separates duties.
8. How would you find which directories hold the most small files?
Dump the fsimage with hdfs oiv -p Delimited, load it into Hive or awk, aggregate file count and average size per directory. This avoids hammering a live NameNode.
9. What is the NameNode's memory model and how do you size the heap?
All inodes and blocks are Java objects in heap. A rule of thumb is about 1 GB per million blocks as a start, plus headroom. I verify with real heap-after-GC data and growth trends and plan increases early.
Security
10. Walk through Kerberos authentication for hdfs dfs -ls.
The user gets a TGT from the KDC (kinit). The client asks the KDC for a service ticket for nn/host@REALM using the TGT, then presents the ticket to the NameNode over SASL/GSSAPI. The NameNode decrypts it with its keytab key and trusts the user. Block access tokens then authorise DataNode reads.
11. What is auth_to_local for?
It maps Kerberos principals to local short user names, for example nn/host@REALM to hdfs and alice@REALM to alice.
12. Ranger versus HDFS ACLs?
HDFS ACLs are stored in the NameNode and only control HDFS paths. Ranger gives central policies across many services, tag-based rules, masking, row filters and rich audit. In practice you keep tight HDFS permissions and add Ranger on top.
13. Delegation tokens: why are they needed?
Long-running distributed jobs cannot contact the KDC from every task. The client obtains tokens for HDFS (and others) at submit time and the job uses them. Tokens have renewal and maximum lifetimes, so very long jobs need keytab-based re-login (for example Spark --principal --keytab).
14. What is the risk of exposing Hadoop ports directly to users?
Many internal ports carry privileged operations and old versions had vulnerabilities. Use a gateway such as Knox, firewalls, TLS and Kerberos, and keep services patched.
Performance and Troubleshooting
15. The NameNode is slow. How do you investigate?
Check RPC queue time and call queue length in JMX, per-user call patterns in the audit log, GC logs and heap, and take thread dumps. Typical fixes: find and throttle abusive clients (FairCallQueue), service RPC port, more handlers, heap and GC tuning, reduce small files.
16. An application is killed with exit code 143. What now?
Read the NodeManager and AM diagnostics to see why: memory limit exceeded, preemption or manual kill. For memory, raise the container and overhead and fix the heap ratio; for preemption, adjust queue and design.
17. How do you handle one very slow DataNode?
Find it through slow-write warnings and peer outlier metrics, check disks (iostat, SMART) and network errors, then decommission or fix hardware. Speculative execution helps jobs meanwhile.
18. What causes frequent NameNode failovers?
Long GC pauses, slow JournalNode disks, ZooKeeper session timeouts or overload of the NameNode RPC handlers. Evidence comes from ZKFC logs, GC logs and JournalNode latency metrics.
Operations and Design
19. Describe a safe rolling upgrade.
Test on a lab, back up metadata and databases, rollingUpgrade prepare, upgrade the standby NameNode, fail over, upgrade the other, then DataNodes rack by rack with shutdownDatanode ... upgrade, validate, and finalize only after a soak period. Keep the rollback path until finalize.
20. How do you design DR for a 2 PB cluster with 24 hour RPO?
Replicate HDFS with snapshot-based incremental distcp daily, replicate Hive metadata (DB replication or Hive replication), HBase and Kafka with native tools, mirror security configs and KMS keys, keep DNS aliases for switching, and rehearse the failover with measured RTO.
21. How do you decide when to buy more hardware?
Forecast storage from growth trends and set triggers (for example 70 percent used triggers procurement, 80 percent urgent). For compute use queue wait times and utilisation. Include lead times of weeks or months.
22. How do you migrate from on-premises Hadoop to cloud storage?
Inventory data and jobs, build the cloud landing zone and security, replicate data with distcp in waves, move metadata and catalogs, rework file paths and committers for object storage, validate results in parallel, then cut over by domain.
23. What monitoring would you set up first on a new cluster?
Host health (disk, memory, network), HDFS capacity and missing blocks, NameNode and ResourceManager state, DataNode and NodeManager counts, heap and GC, YARN pending apps, certificate expiry and backup success. Each alert has a runbook.
24. How do you give multiple teams fair access to one cluster?
Hierarchical queues with guaranteed capacity and ACLs, user limits, preemption, quotas on HDFS, Ranger policies per group, chargeback reporting and clear onboarding rules.
25. Tell me about a hard production incident you handled.
Prepare a real story: timeline, evidence, root cause, fix, prevention. Use one of the case studies from the troubleshooting section if you lack your own, and be honest that it came from lab practice.
Conclusion
Advanced answers connect mechanisms to consequences: how HA and fencing work, how security flows, how to find root causes with evidence, and how to plan upgrades, DR and capacity. Practise with real labs.

