Hadoop learning notes

Source: Internet
Author: User
Document directory
  • Master:
  • Status information
  • Interface
  • Architecture
  • System interaction
  • Master node operations
Map-reduce

Original article: http://blademaster.ixiezi.com/2010/03/27/google-mapreduce%E4%B8%AD%E6%96%87%E7%89%88/

Problem:

Because the input data volume is huge, to complete the original simple computation within an acceptable period of time, only the computation is distributed on hundreds of thousands of hosts. How to handle parallel computing, how to distribute data, and how to handle errors? All these problems are combined and require a lot of code processing, which makes the original simple operation hard to handle.

Map-reduce Solution Model

The principle of MapReduce programming model is that an Input key/value pair set is used to generate an output key/value pair set. Users of the MapReduce library use two functions to express this computing: Map and Reduce.

Implementation Method:

The MapReduce model can be implemented in different ways. Correct selection depends on the specific environment. For example, one implementation method is applicable to small-sized machines with shared memory, and the other is applicable to hosts with multiple processors in a large-scale NUMA architecture, some implementations are more suitable for large network connection clusters.

Master: the Master holds some data structures that store the status of each Map and Reduce task (idle, working or finished) and the ID of the Worker machine (non-idle machine. The Master is like a data pipeline. The location information of the intermediate file storage area is transmitted from the pipeline to Reduce through the Map. Save network bandwidth by storing input data (managed by GFS) on the local disk of the machine in the cluster. GFS separates each file into 64 MB blocks. Each Block is stored on multiple machines, and multiple copies (usually three copies) are stored in the environment ). When scheduling a Map task, the MapReduce master considers the location information of the input file and tries to schedule a Map task to a machine that copies the relevant input data. If the above efforts fail, the master will try to execute the Map task (for example, allocate to a machine that contains input data and execute it on a worker machine in a switch ). When a large enough MapReduce operation is run on a cluster, most of the input data can be read from the local machine, which consumes a very small amount of network bandwidth. The owner of the withdrawal leg:

There is a general mechanism to reduce the number of failures. When a MapReduce operation is nearing completion, the master schedules the standby task process to execute the remaining in-progress tasks. Whether the initial execution process or the backup Task Process has completed the task, we mark the task as completed.

Status information: the master uses an embedded HTTP server (such as Jetty) to display a set of status information pages. You can monitor various invocation statuses. The status information page displays the progress of computing execution, for example, how many tasks have been completed, how many tasks are being processed, the number of input bytes, the number of intermediate data bytes, the number of output bytes, and the processing percentage. The page also contains links to the stderr and stdout files of each task. Based on the data, the user predicts how long the computing will take and whether additional computing resources need to be added. These pages can also be used to analyze when computing execution is slower than expected. Ease of use

The success of MapReduce depends on the ability to write a simple program in less than half an hour using the MapReduce library. This simple program can perform large-scale concurrent processing on clusters composed of thousands of machines, this greatly accelerates the development and prototype design cycle. In addition, the MapReduce library allows programmers who have no experience in distributed and/or parallel system development to easily use a large amount of resources to develop distributed and/or parallel processing applications.


The Google File System Chinese Version

Original article: http://blademaster.ixiezi.com/2010/03/27/the-google-file-system%E4%B8%AD%E6%96%87%E7%89%88/

Definition:

A Scalable Distributed File System for large-scale data-intensive applications. Although GFS runs on cheap and universal hardware devices, it still provides disaster redundancy and provides high-performance services for a large number of clients.

Design Concept:

Continuous monitoring, error detection, disaster redundancy, and automatic recovery mechanisms must be integrated into GFS. Design assumptions and parameters, such as I/O operations and Block sizes need to be reconsidered. For this access mode for massive files, the client has no significance for the data block cache, and data append operations are the main considerations for performance optimization and atomic guarantee. Collaborative Design of applications and file system APIs improves the flexibility of the entire system. The requirements for GFS consistency model are relaxed, which reduces the demanding requirements of file systems on applications and greatly simplifies the design of GFS.

Interface GFS provides a set of API functions similar to the traditional file system, although not implemented in strict accordance with standard APIs such as POSIX. The file is organized as a hierarchical directory and identified by the path name. We support common operations, such as creating new files, deleting files, opening files, closing files, reading and writing files. In addition, GFS provides snapshot and record appending operations. A snapshot creates a copy of a file or directory tree at a very low cost. The record append operation allows multiple clients to append data to a file at the same time, and ensures that each client append operations are atomic. Architecture

We must reduce the read and write operations on the Master node to avoid the bottleneck of the Master node. The client does not read and write file data through the Master node. On the contrary, the client asks the Master node about the Chunk server it should contact.

A simple read process: first, the client converts the file name from the specified byte to the Chunk index of the file based on the fixed Chunk size. It then sends the file name and Chunk index to the Master node. The Master node sends the corresponding Chunk ID and Copy location information to the client. The client uses the file name and Chunk index as the key to cache the information.

Master Server(Alex Note: Pay attention to the differences between logical Master nodes and physical Master servers. In the future, we will talk about the behavior of each Master server, such as storage and memory. Therefore, we will use all physical names)Three types of metadata are stored, including the namespace of the file and Chunk, the correspondence between the file and Chunk, and the storage location of each Chunk copy.

Operation logs contain key metadata change history records. This is very important to GFS. This is not only because the operation log is the unique persistent storage record of metadata, but also serves as the logical time baseline for judging the synchronization operation sequence.

Modifications to the file namespace (for example, file creation) are atomic. They are only controlled by the Master node: The namespace lock guarantees atomicity and correctness. The operation logs of the Master node define the global sequence of these operations.

GFS applications can use some simple technologies to implement this loose consistency model. These technologies are also used to achieve some other target functions, including: Using append writing instead of overwriting, Checkpoint, self-verified write operations, self-identified records.

System interaction

A change is an operation that changes the Chunk content or metadata, such as a write operation or an append operation. The change operation is performed on all copies of the Chunk. We use the lease mechanism to maintain the consistency of the change sequence among multiple replicas.

To improve network efficiency, we have taken measures to separate the data stream from the control flow. While the control flow is from the client to the master Chunk, and then to all secondary copies, data is pushed along a carefully selected Chunk server chain in the form of pipelines.

GFS ensures that at least one atomic write operation is successfully executed (that is, writing an ordered byte stream), the written data is appended to the offset specified by GFS, and then GFS returns the offset to the client. This is similar to the behavior of multiple concurrent write operations on files opened in O_APPEND mode in a Unix operating system programming environment without competing conditions.

Snapshot operations can almost instantly copy a file or directory tree ("Source") without interfering with other ongoing operations.

We use the standard copy-on-write technology to implement snapshots.

Master node operations

We allow multiple operations to be performed at the same time, and use the locks on the namespace region to ensure the correct sequence of execution.

The GFS namespace is a full-path and metadata ing lookup table. With prefix compression, this table can be efficiently stored in the memory. In the tree structure of the bucket, each node (the file name of the absolute path or the Directory Name of the absolute path) has an associated read/write lock.

A gfs cluster is a highly distributed multi-layer layout structure, rather than a plane structure. The typical topology is that hundreds of Chunk servers are installed on many racks. Policy Service for selecting the Chunk Copy location: To maximize data reliability and availability, and to maximize network bandwidth utilization.

Chunk replicas have three purposes: Chunk creation, re-replication and re-load balancing.



A BigTable cluster stores many tables, each containing a Tablet set, and each Tablet contains all the relevant data of rows within a certain range. In the initial state, a table has only one Tablet. As the data in the table grows, it is automatically divided into multiple tablets. By default, the size of each Tablet is about 200 MB to MB.

BigTable uses the Chubby trace to record the status of the Tablet server. When a Tablet server is started, it creates a file with a unique name in a specified directory of Chubby and obtains the exclusive lock of the file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.