Enhance your Knowledge | Flat 25% Discount on all Courses | Use Coupon Code - ENHANCE25 During Checkout |Enroll Now
Write a MapReduce code to find users having same or mirror images of DNA in the file stored in HDFS.
The file is located at
Output file will contain the users having same or mirror DNA
['User5', 'User3'] ['User4', 'User2', 'User1']
Checkout mapper.py and reducer.py in GitHub
If you haven't cloned the CloudxLab GitHub repository, then clone it in your home folder in web console using the below command
git clone https://github.com/singhabhinav/cloudxlab.git ~/cloudxlab
Else, update the local copy
cd ~/cloudxlab git pull origin master
Go to mirror_dna
Run the MapReduce code using Hadoop streaming. Please make sure to save output in mapreduce-programming/mirror_dna directory inside your home directory in HDFS. Run the below command
hadoop jar /usr/hdp/18.104.22.168-292/hadoop-mapreduce/hadoop-streaming.jar -input /data/mr/dna/dna.txt -output mapreduce-programming/mirror_dna -mapper mapper.py -file mapper.py -reducer reducer.py -file reducer.py
Check the frequency of characters by typing below command.
hadoop fs -cat mapreduce-programming/mirror_dna/*
Taking you to the next exercise in seconds...