Q:

Does Hadoop MapReduce run on each and ever machine?

If I have Hadoop running on a grid of 50 machines, And I run a job of determining which are the most common words, can I specify that I only want to search in documents abc1.txt and abc2.txt? 
How does Hadoop know on which machines to look for this files, or will it try to find the files on each of the 50 machines?

A:

Yes you should specify the path to files in HDFS as input for your MapReduce job. But the good thing - you don't need to know where actually these files are stored.
When you upload abc1.txt and abc2.txt to HDFS - distributed file system, Hadoop would store data blocks from this files on several machines in cluster called nodes (3 by default). If the files size is bigger that one machine can store - Hadoop would split files into several blocks and would store the every block on several nodes.
So the job doesn't need to know where the files are actually stored. Your job program would just identify files by URI like hdfs://abc1.txt and hdfs://abc2.txt.
Hadoop tries its best to run job (or part of job) at the same node where the data is stored.
When Hadoop will schedule your job it will take into account which nodes has the data for the job and what node is available at that time. Then it will schedule job to run on the node.
In case if each file fits to one node, the job would be scheduled to run at one node per file. So it won't be run on all 50 nodes of cluster.

