HADOOP - get nodename inside mapper

I'm writing a mapper and would like to know if it is possible to get the nodename, where the mapper is running.

Answers


Hadoop automatically moves your MapReduce program to where your data is so I think you can just do getHostName() (if you're using Java that is) and it should return the name of the node on which your program is running.

java.net.InetAddress.getLocalHost().getHostName();

If you're using other languages such as Python, Ruby, etc. (i.e. using HadoopStreaming), the same idea holds true so you should be able to use the appropriate function/method available in those languages to get the host name.


The configuration value fs.default.name will most probably give you a URL to the namenode, and if you get an instance of the FileSystem (Filesystem.get(conf)) you should be able to call the getUri() method to get the same information.


Need Your Help

FastScrollBar go out of screen, when SectionIndexer implemented

android listview android-listview

I do ListView with custom adapter which implement SectionIndexer. When I type only minSdkVersion = 8 in Manifest file, all works fine. But if I add targetSdkVersion = 11 (or more) to Manifest, fast

Laravel 4 save dates on database

php date laravel-4 save eloquent

I want to save dates using laravel 4, I have been looking on the internet but the only good solution that I found was using