2026-10-31·作者 Sijie Wang

namenode

NameNode keeps directory tree, block lists and block locations, no file content; a role, not special hardware; one logical NameNode with or without HA.

NameNode: the bookkeeper that holds no data at all

What it keeps: three things, and nothing else. The NameNode stores the directory tree, each file's block list in order, and each block's DataNode locations. It stores no file content at all. If you want an analogy, it is the front desk catalogue of a library: the catalogue tells you which shelf every book is on, but the books themselves are on the shelves, and the catalogue contains no book text. The shelves are the DataNodes.

It is a role, not special hardware. Nothing about a NameNode requires a special kind of machine. In production it usually gets a dedicated ordinary server, dedicated because the metadata lives entirely in memory and needs a lot of RAM — not because the hardware is exotic. In a test setup it can be co-located with other roles. The leader analogy is accurate: like a Raft leader or a Kafka controller, it is a position one machine occupies, with the authority that comes with the position.

One machine, or two? Without high availability, it is literally one machine, and a single point of failure: if it dies, the cluster's map is gone until it restarts (its ledger is persisted, see ledger-persistence, but nothing serves while it is down). With high availability there are two machines, but only one active writer at a time, and the standby keeps its own copy of the ledger in sync. Externally it is still one NameNode: clients use one logical name and do not care which physical machine is active today.

What follows from this shape. Because the ledger is in memory, its capacity is bounded by file count, not data volume — the arithmetic is in block-size-and-metadata-math. Because it holds no data, it never becomes a data bottleneck: reads and writes bypass it entirely, see read-path and write-path. And because it is a single logical authority, every other mechanism in this cluster — leases, safe mode, fencing — exists to protect the one property that matters: there is exactly one writer of this ledger at a time. Those mechanisms are writer-lease, safe-mode and ha-and-fencing.

关于这一条

sijie 的一条 wiki 条目。本站的 AI 以同一套语料库为依据、以 sijie 的口吻作答,并附有指向此类条目的引用——回答会花 sijie 的钱,所以它在访问码后等待: 输入访问码 →