7. Configure Garbage Collector for NameNode

These steps enable logging for Garbage Collector. By default the Garbage Collector logging is disabled.

To enable GC logging on NameNode:

  1. Open the Hadoop Environment script, %HADOOP_HOME%\etc\hadoop\hadoop-env.cmd.

  2. Prepend the following text in the HADOOP_NAMENODE_OPTS definition:

    -Xloggc:%HADOOP_LOG_DIR%/gc-namenode.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps 

    For example:

    set HADOOP_NAMENODE_OPTS=-Xloggc:%HADOOP_LOG_DIR%/gc-namenode.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Dhadoop.security.logger=%HADOOP_SECURITY_LOGGER% -Dhdfs.audit.logger=%HDFS_AUDIT_LOGGER% %HADOOP_NAMENODE_OPTS%
  3. Run the following command to recreate the NameNode service XML:

    %HADOOP_HOME%\bin\hdfs.cmd --service namenode > %HADOOP_HOME%\bin\namenode.xml
  4. Verify that the NameNode Service XML was updated.

  5. Restart the NameNode service.

The NameNode start up configuration is changed to enable GC logging.


loading table of contents...