Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do one read the Zookeeper transaction log?

Tags:

Are there any existing tools that help to read the Zookeeper transaction log? By default, it is in binary format and I would like to read it in human readable form.

like image 311
Sriram Subramanian Avatar asked Jul 27 '13 06:07

Sriram Subramanian


People also ask

How do you read ZooKeeper logs?

You can enable ZooKeeper audit logs for ZooKeeper 3.6.o and upwards. To enable audit logs configure audit. enable=true in conf/zoo. cfg.

What is ZooKeeper snapshot?

The ZooKeeper Data Directory contains snapshot and transactional log files which are persistent copy of the znodes stored by an ensemble. Any changes to znodes are appended to transaction log and when the log file size increases, a snapshot of the current state of znodes is written to the filesystem.

Where does ZooKeeper keeps its data?

ZooKeeper stores its data in a data directory and its transaction log in a transaction log directory. By default these two directories are the same. The server can (and should) be configured to store the transaction log files in a separate directory than the data files.

Does ZooKeeper use log4j?

ZooKeeper logs messages using log4j -- more detail available in the Logging section of the Programmer's Guide. You will see log messages coming to the console (default) and/or a log file depending on the log4j configuration.


1 Answers

I don't know if u have solved this question.

Answer:

cd the zookeeper dir. 

If u want to read snapshots, use:

java -cp zookeeper-3.4.6.jar:lib/log4j-1.2.16.jar:lib/slf4j-log4j12-1.6.1.jar:lib/slf4j-api-1.6.1.jar org.apache.zookeeper.server.SnapshotFormatter version-2/snapshot.xxx 

If u want to read logs, use:

java -cp zookeeper-3.4.6.jar:lib/log4j-1.2.16.jar:lib/slf4j-log4j12-1.6.1.jar:lib/slf4j-api-1.6.1.jar org.apache.zookeeper.server.LogFormatter version-2/log.xxx 
like image 172
Oliver Avatar answered Nov 03 '22 04:11

Oliver