Amazon EMR
"Elastic MapReduce" — managed Hadoop clusters on EC2 for big-data processing. You bring the framework (Spark, Hive, HBase, Presto, Flink…), EMR provisions and configures hundreds of EC2 instances for you. The answer whenever the question says "Hadoop", "Spark", or "we already have this MapReduce/Hive job".
"Elastic MapReduce" — cluster Hadoop managed chạy trên EC2 để xử lý big data. Bạn chọn framework (Spark, Hive, HBase, Presto, Flink…), EMR lo provision và cấu hình hàng trăm EC2 instance. Đáp án mỗi khi đề nhắc "Hadoop", "Spark", hoặc "job MapReduce/Hive có sẵn".
Reach for itNên dùng
- Existing Hadoop / Spark / Hive / Presto jobs to lift into AWS unchangedĐã có job Hadoop / Spark / Hive / Presto, muốn bê nguyên lên AWS
- Petabyte-scale data processing, machine learning, web indexingXử lý dữ liệu, machine learning, web indexing quy mô petabyte
- You need control of the cluster: custom AMIs, bootstrap actions, framework versions, YARN tuningCần kiểm soát cluster: AMI tuỳ biến, bootstrap action, version framework, tinh chỉnh YARN
- Big cost lever available: task nodes on Spot + a transient cluster that dies when the job endsĐòn bẩy chi phí lớn: task node dùng Spot + cluster transient tự tắt khi job xong
Not the right toolKhông hợp
- Ad-hoc SQL over S3, no cluster to run → AthenaSQL ad-hoc trên S3, không muốn nuôi cluster → Athena
- Sustained BI / warehouse queries → RedshiftQuery BI / warehouse đều đặn → Redshift
- Just containerised jobs, no Hadoop semantics → AWS BatchChỉ là job đóng container, không cần semantics Hadoop → AWS Batch
- Serverless streaming SQL / Flink without ops → Managed Apache FlinkStreaming SQL / Flink serverless, không muốn vận hành → Managed Apache Flink
1 · Overview1 · Tổng quan
- EMR stands for "Elastic MapReduce".EMR viết tắt của "Elastic MapReduce".
- EMR helps creating Hadoop clusters (Big Data) to analyze and process vast amounts of data.EMR giúp tạo cluster Hadoop (Big Data) để phân tích và xử lý khối lượng dữ liệu khổng lồ.
- The clusters can be made of hundreds of EC2 instances.Cluster có thể gồm hàng trăm EC2 instance.
- Also supports Apache Spark, HBase, Presto, Flink… — the whole Hadoop ecosystem, not just MapReduce.Hỗ trợ cả Apache Spark, HBase, Presto, Flink… — cả hệ sinh thái Hadoop, không riêng MapReduce.
- EMR takes care of all the provisioning and configuration of EC2 — that's the whole value proposition.EMR lo toàn bộ việc provision và cấu hình EC2 — đó chính là giá trị của nó.
- Auto-scaling with CloudWatch.Auto-scaling qua CloudWatch.
- Use cases: data processing, machine learning, web indexing, big data…Use case: xử lý dữ liệu, machine learning, web indexing, big data…
2 · Integrations & storage2 · Tích hợp & storage
Nodes keep HDFS on attached EBS — temporary. Anything that must survive the cluster goes to S3 through EMRFS (with server-side encryption). Hive can read straight from DynamoDB.
Node giữ HDFS trên EBS gắn kèm — chỉ là tạm. Cái gì cần sống lâu hơn cluster thì đẩy sang S3 qua EMRFS (có server-side encryption). Hive đọc thẳng từ DynamoDB được.
3 · Node types3 · Các loại node
Core nodes hold the data, so keep them on reliable capacity. Task nodes hold nothing — that's exactly why they're the ones you put on Spot.
Core node giữ data nên phải đặt trên capacity đáng tin. Task node không giữ gì — chính vì thế nó là chỗ để dùng Spot.
- Master Node: manage the cluster, coordinate, manage health — long running.Master Node: quản cluster, điều phối, theo dõi health — long running.
- Core Node: run tasks and store data — long running.Core Node: chạy task và lưu data — long running.
- Task Node (optional): just to run tasks — usually Spot.Task Node (tuỳ chọn): chỉ chạy task — thường dùng Spot.
Purchasing optionsLựa chọn mua
| On-Demand | Reserved | Spot | |
|---|---|---|---|
| CharacterĐặc điểm | Reliable, predictable, won't be terminatedTin cậy, đoán trước được, không bị thu hồi | Cost savings — min 1 yearTiết kiệm chi phí — tối thiểu 1 năm | Cheaper, can be terminated, less reliableRẻ hơn, có thể bị thu hồi, kém tin cậy |
| NoteGhi chú | Default for master + coreMặc định cho master + core | EMR will automatically use it if available — nothing to configureEMR tự dùng nếu có sẵn — không cần cấu hình gì | Put task nodes hereĐặt task node ở đây |
4 · Instance configuration4 · Cấu hình instance
Groups = "give me N of this instance". Fleets = "give me this much capacity, from any of these types, split this way between On-Demand and Spot" — far better Spot availability.
Group = "cho tôi N con loại này". Fleet = "cho tôi bằng này capacity, lấy từ các loại này, chia On-Demand / Spot theo tỉ lệ này" — khả năng kiếm được Spot tốt hơn hẳn.
- Uniform instance groups: select a single instance type and purchasing option for each node type.Uniform instance group: chọn một loại instance và một kiểu mua cho mỗi loại node.
- Instance fleet: select target capacity, mix instance types and purchasing options. The master fleet is always exactly one EC2 instance.Instance fleet: chọn target capacity, trộn nhiều loại instance và kiểu mua. Fleet master luôn đúng một EC2 instance.
Exam reflexesPhản xạ khi thi
- "Existing Hadoop / Spark / Hive / HBase / Presto workload" → EMR. Nothing else in the exam runs those frameworks."Workload Hadoop / Spark / Hive / HBase / Presto có sẵn" → EMR. Trong đề không dịch vụ nào khác chạy các framework này.
- "Cut EMR cost" → task nodes on Spot + instance fleets + transient cluster + data in S3/EMRFS. Reserved only for a long-running cluster."Giảm chi phí EMR" → task node dùng Spot + instance fleet + transient cluster + data trên S3/EMRFS. Reserved chỉ hợp cluster long-running.
- "Data must survive the cluster" → EMRFS / S3, never HDFS."Data phải sống lâu hơn cluster" → EMRFS / S3, đừng để HDFS.
- "Spot for core nodes to save money" → trap. Core nodes hold HDFS; losing them loses data."Dùng Spot cho core node cho rẻ" → bẫy. Core node giữ HDFS; mất nó là mất data.
- "Multi-AZ EMR cluster for HA" → trap. A cluster is single-AZ; resilience comes from S3 + re-launching the cluster."Cluster EMR multi-AZ để HA" → bẫy. Cluster chỉ nằm một AZ; khả năng phục hồi đến từ S3 + dựng lại cluster.
- "Query S3 occasionally, no cluster" → Athena, not EMR."Thỉnh thoảng query S3, không muốn cluster" → Athena, không phải EMR.