Chainmapper/chainreducer is mainly designed to solve the linear chain-type mapper. That is, there are multiple mapper in the MAP or REDUCE phase, these mapper like the Linux pipeline, the output of the previous mapper is redirected directly to the input of the next mapper, forming a pipelined form similar to [Map+reduce map* ]。 Figure 1 shows a typical chainmapper/chainreducer scenario: in the map phase, the data is processed sequentially through Mapper1 and Mapper2, and in the reduce phase, after the data is shuffle and sort , which is processed by the corresponding reducer, but reducer is not written directly to HDFs, but is handed to another mapper processing, and the resulting results are written to the final HDFs output directory.
Figure 1 Chainmapper/chainreducer Application Example
It is important to note that for any mapreduce job, the MAP and reduce phases can have an unlimited number of mapper, but Reducer can only have one. In other words, the computational process shown in Figure 2 cannot be done using chainmapper/chainreducer, but it needs to be decomposed into two mapreduce jobs.
Figure 21 scenarios where a chainmapper/chainreducer is not applicable