Printing hadoop properties

The hadoop Configuration class implements the Iterable interface, so you can simply create a default configuration and list all properties, or pass a custom XML configuration file and print the properties from that.

Below is a simple example.

import java.util.*;
import org.apache.hadoop.conf.*;

class printHadoop {

  public static void main(String args[]) {
    Configuration conf = new Configuration();
    if ( args.length == 1)
      conf.addResource(args[0]);
    Iterator it = conf.iterator();
    while (it.hasNext()) {
      System.out.println(it.next());
    }
  }
}

1 comment for “Printing hadoop properties

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.