mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
Every EMR cluster runs HDFS: its primary node "also runs the HDFS
NameNode service". In the docker runner mode a cluster's HDFS was a
folder of its /mnt volume behind a view of the hdfs scheme, so an
hdfs:// path naming a host was not served, hadoop fs -ls / failed, and
Hive, which looks up the encryption zone of any hdfs:// path, reached it
under viewfs, where a table at an hdfs:// location failed. Each cluster
now runs a NameNode and a DataNode.
- EmrClusterStorage starts them in a container of their own, from the
release's EMR Serverless Hive image, which has HDFS's daemons where
the release's image has only the client. It runs as root only to add
the primary node's name to its hosts file and give its data volume to
the hadoop user, then runs both daemons as that user, with one copy of
each block and permissions off, and makes /tmp and /user/hadoop once
the DataNode has joined. The data is in a volume of its own, so the
first container to mount the cluster's /mnt volume is still a step's,
which fills it with what the bootstrap actions left there. It is on a
Docker network of the cluster's own, which only the cluster's steps
join besides theirs, as its HDFS serves its files to any client that
reaches it, so another cluster's steps, another account's too, do not.
- The AWS runtime for Apache Spark's releases, emr-spark-8.0.0 on,
publish no Hive image, so their clusters run HDFS from emr-7.5.0's.
Hadoop keeps its client-server protocols compatible across a major
version's minor releases, so their newer client reaches its NameNode.
- A step's thread starts it after the cluster's volumes, from the id
its image's pull, when it is missing, resolves, and waits up to two
minutes from then, the
NameNode on its port its own, the DataNode joined and the NameNode out
of safe mode, as the NameNode's JMX says; a step that comes while
it starts waits, and one that finds it running uses it. A failure
fails the step ("The step could not start: ..."), and one whose
container Docker cannot tell the state of leaves it as it is.
- The daemons log their warnings and errors to the container's output.
- When either daemon exits, the container ends and its readiness goes,
so the next step starts it again on the data its volume keeps; one
that finds it about to stop starts it again once.
- Steps reach it by the primary instance's PrivateDnsName, as
ListInstances gives it, on port 8020: their containers resolve that
name to the HDFS container's address, and fs.defaultFS names it, so
hdfs:// paths without a host and paths without a scheme lead there.
ListInstances numbers the MASTER group's instance first, so the name
holds while other groups resize.
In a namespace the steps share, the host's or another container's,
which the HDFS container joins too, they reach it on its loopback, and
its daemons listen there only, so no other interface serves its files,
which any client could change; one cluster's HDFS runs there at a
time, another's refused while it does. One a process with another
docker-network left running, in another namespace than the steps', is
started again in theirs on its data. With none, steps have no network,
so the cluster runs no HDFS.
- Hadoop's local job runner copies a job's -files to
/tmp/hadoop/mapred/staging on the local file system, then looks for
them at that path of the default file system, as JobResourceUploader
drops the folder's scheme. So in the hadoop command's configuration,
which a custom JAR's MapReduce in the driver reads too, the hdfs
scheme is a view of the cluster's HDFS in which that one folder is
the container's own. Spark and Hive keep HDFS's own client, as Hive
casts an hdfs:// file system to it to look up its encryption zone,
so a Spark step writes a Hive table in HDFS too.
- A reset or a shutdown removes the HDFS containers this process
started, found running or kept from an earlier process, after the
drivers that use them are stopped, and a step or a bootstrap handed to
its thread before it, however it then ends, starts no HDFS, driver or
successor after it but is left as one whose driver was stopped, and
none is handed to a thread until the reset is over; a container Docker
refuses to remove stays known for the next; a cluster's next step
starts its HDFS again on the data its volume keeps. The container and
its network go with the cluster's storage, and the startup sweep
removes those of clusters that are gone or have ended.
Every cluster now needs a Hive image, so the documentation of
image-template and hive-image-template says a mirror sets both.
The Docker-gated tests now cover a Hive table at an hdfs:// location, a
bootstrap action's file in /mnt, a structured streaming query keeping
its checkpoints in HDFS, a Spark step writing a Hive table there, hadoop
fs -ls /, and a DataNode that exits, after which the next step reads an
earlier step's file. The CI prefetch queues the Hive image for
EmrDockerRunnerDockerIntegrationTest's shard too.