Core services always in pairs.
ZooKeeper coordinates the switchover.
See how redundancy, quorum, replication, distribution across machines, and coordinated maintenance keep TDP Datacenter services available.
Topics on this page
- High availability mechanisms by service
- NameNode in high availability
- ResourceManager in high availability
- Data replication and distribution
- Quorum and service placement
- Maintenance and continuity
High availability mechanisms by service
In the core services, high availability uses each service's own mechanism, enabled per service in Ambari. HDFS block replication is already configured.
| Service | Mechanism, when enabled |
|---|---|
| HDFS (NameNode) | Active and standby NameNode pair under a nameservice, shared log on JournalNodes and automatic failover through ZKFC |
| YARN (ResourceManager) | Active and standby ResourceManager pair, with the application state in ZooKeeper and recovery of running work |
| HDFS (data) | Block replication, with a factor of 3, configurable |
| Ozone (Ozone Manager and SCM) | Service replicated with Ratis |
| ZooKeeper | Ensemble with quorum, used in the HDFS and YARN election |
The number of instances and their distribution across hosts are defined in the topology of each environment.
NameNode in high availability
HDFS can operate with active and standby NameNodes.
What the figure shows:
- The HDFS clients access HDFS through the nameservice name, not through the address of a NameNode.
- The logical nameservice points to the active NameNode and, after the failover, to the standby NameNode. This way, the switch between active and standby does not change the address used by applications.
- The active NameNode writes the log of changes to the JournalNodes.
- The JournalNode quorum, in the Quorum Journal Manager model, keeps the shared log of changes.
- The standby NameNode follows these changes so that it can take over the service.
- ZooKeeper and the ZKFC processes take part in detection and election in the automatic failover.
The configuration includes mechanisms to prevent two active NameNodes from writing at the same time.
The Secondary NameNode, used in the topology without high availability, performs checkpoints and does not replace a standby NameNode.
HDFS components in Ambari and the nameservice, JournalNode and failover properties in HDFS → Configs. Reference: HA with QJM.
ResourceManager in high availability
YARN can use active and standby ResourceManagers.
State storage and election make it possible to recover control of the applications when the switch happens, according to the configured recovery mechanisms.
In the ZooKeeper model, the configuration brings together the list of ResourceManagers, state recovery and the ZKRMStateStore, which keeps the application state in ZooKeeper.
Continuity also depends on the NodeManagers, the ApplicationMasters and the recovery policies of the applications.
With work-preserving recovery enabled in Ambari (yarn.resourcemanager.work-preserving-recovery.enabled), containers keep running during a ResourceManager restart and, with high availability enabled, during the switch between ResourceManagers. The NodeManagers can also have recovery enabled (yarn.nodemanager.recovery.enabled).
YARN → Configs, including yarn.resourcemanager.ha.enabled, recovery and state storage. Reference: ResourceManager HA.
Data replication and distribution
Replicated HDFS blocks make it possible to serve reads from other copies when a DataNode becomes unavailable.
The HDFS replication factor (dfs.replication), configurable in Ambari, defines how many copies of each block the cluster keeps.
The replication factor, the number of nodes and the free capacity are defined together.
Storage
HDFS
DataNodes and replicas can be distributed across the planned failure domains, with rack topology when applicable.
Events
Kafka
Topic availability depends on partition replication, in-sync replicas and the settings of producers and consumers.
Dependencies
Databases and catalogs
Metadata databases and identity services are also part of the availability design.
Replicas preserve operational copies of the data. The continuity mechanisms are described in Maintenance and continuity.
Quorum and service placement
Coordination services must keep the majority of members required by the protocol.
A ZooKeeper ensemble with three servers, for example, tolerates the loss of one member as long as the other two can communicate.
In TDP Datacenter, the recommendation is to install ZooKeeper on an odd number of machines, greater than one: initially, on at least three.
The components responsible for the high availability of a service are placed on distinct machines, and rack, power and network failures are also taken into account in the distribution.
Two processes on the same host share the risk of losing that host.
Assignment of components to hosts in Ambari and infrastructure topology. Details in ZooKeeper and Datacenter Architecture.
Maintenance and continuity
Ambari offers two upgrade flows.
The Express Upgrade is faster, but requires a full stop of the services.
The Rolling Upgrade upgrades the components without completely interrupting the services, provided they are in high availability or operate in a distributed architecture, without a single point of coordination. Continuity depends on the prerequisites of the version and on the topology of each service.
A maintenance starts from the health of the services, replicas, quorums and the capacity of the remaining nodes.
Node removal follows the specific procedures of each service, with the return monitored before the next step.
Each continuity mechanism addresses one type of failure:
- Failover: the standby instance takes over the process when the active one fails, as in the NameNode and the ResourceManager with high availability enabled.
- Replicas: operational copies of the data on other machines, such as HDFS blocks and Kafka partitions.
Procedures in Upgrade prerequisites and Component upgrade.
Scenario: replacing a machine with a NameNode and a ResourceManager
Situation: in a cluster with the NameNode and the ResourceManager in high availability, enabled through Ambari, a machine that hosts the active NameNode and one of the ResourceManagers needs to be replaced.
What TDP does: with automatic failover, ZKFC monitors the NameNode and, when the active one goes out of service, the standby NameNode takes over the active role. In YARN, another ResourceManager is elected active and resumes control of the applications from the state stored in ZooKeeper.
Clients keep using the HDFS nameservice, with no change of address.
The Ambari alerts for NameNode high availability health, JournalNode and ZooKeeper availability and the ZKFC process indicate the state of the pairs and quorums before and after the machine is replaced.
Effect: HDFS and YARN service passes to the standby instances during the switch, and the team only moves on to another machine after the alerts confirm the return.
This procedure is adjusted to the topology of each environment.