Skip to main content
dbains
Gold ⭐️
Gold ⭐️
Mar 25, 2017 12:51 AM UTC

How to configure GC logging for Zookeeper

  • Oct 5, 2026 9:26 AM UTC
  • 0 replies
  • 5724 views
  • Translate All
PROBLEM: Enable GC logging for Zookeeper SOLUTION: When Using Ambari web UI: 1. Click on the Zookeeper Service 2. Click on Configs tab 3. Navigate to 'Advanced Zookeeper-env'

4. Locate the setting 'zookeeper-env template'

5. Append the following to 'export SERVER_JVMFLAGS=-Xmx1024m' :

-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$ZOO_LOG_DIR/zookeeper.gc.`date +'%Y%m%d%H%M'`"

To be precise it should look like :

export SERVER_JVMFLAGS="-Xmx1024m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$ZOOKEEPER_LOG_DIR/zookeeper.gc.`date +'%Y%m%d%H%M'`"

6. Save the changes and restart the Zookeeper service when prompted When the cluster is managed outside Ambari: 1. On application cluster node open zookeeper-env.sh

2. Append the above mentioned parameter to SERVER_JVMFLAGS values. You can find the zookeeper-env.sh at /etc/zookeeper/conf/