Zookeeper transaction log files contain transactions tagged with zxids, but to ease recovery and allow for quick lookup, each log file's suffix is the first zxid of the log file in hexadecimal. To view Zookeeper's transaction log file, you can use the following command:
Note: $ZK_LIB is /opt/cloudera/parcels/CDH/lib/zookeeper/
$ java -cp $ZK_LIB/zookeeper.jar:$ZK_LIB/lib/slf4j-api-1.6.1.jar:$ZK_LIB/lib/slf4j-log4j12-1.6.1.jar:$ZK_LIB/lib/log4j-1.2.15.jar:$ZK_LIB/lib/jline-0.9.94.jar org.apache.zookeeper.server.LogFormatter version-2/log.200000001 ZooKeeper Transactional Log File with dbid 0 txnlog format version 2 2/4/14 2:52:38 PM EST session 0x343fe7543670000 cxid 0x0 zxid 0x3d00000001 createSession 5000 2/4/14 2:52:39 PM EST session 0x343fe7543670001 cxid 0x0 zxid 0x3d00000002 createSession 5000 2/4/14 2:52:40 PM EST session 0x343fe7543670000 cxid 0x2 zxid 0x3d00000003 closeSession null 2/4/14 2:52:40 PM EST session 0x343fe7543670001 cxid 0x2 zxid 0x3d00000004 closeSession null 2/4/14 2:52:44 PM EST session 0x243fe75435e0000 cxid 0x0 zxid 0x3d00000005 createSession 5000 2/4/14 2:52:44 PM EST session 0x243fe75435e0000 cxid 0x1 zxid 0x3d00000006 create '/hadoop-ha/nameservice1/ActiveStandbyElectorLock,#ac6e616d65736572766963653112b6e616d656e6 f64653538321a1772746c6e6e322e72657461696c6967656e63652e636f6d20ffffffd43e28ffffffd33e,v{s{31,s{'world,'anyone}}},T,127
Each transaction in the log file is output as its own line in human-readable form. Because
only change operations result in a transaction, you will not see read transactions in the
transaction log.
Snapshots:
Snapshot file is similar to log file, but snapshot files are not preallocated, so the size more accurately reflects the amount of data they contain. The snapshot file is actually a fuzzy snapshot; it is not a valid snapshot on its own until the transaction log is replayed over it. Specifically, to restore a system, you must start replaying the transaction log starting at the zxid of the snapshot suffix or earlier.
To read a snapshot file, use the following command:
$ java -cp $ZK_LIB/zookeeper.jar:$ZK_LIB/lib/slf4j-api-1.6.1.jar:$ZK_LIB/lib/slf4j-log4j12-1.6.1.jar:$ZK_LIB/lib/log4j-1.2.15.jar:$ZK_LIB/lib/jline-0.9.94.jar org.apache.zookeeper.server.SnapshotFormatter version-2/snapshot.100000009 ZNode Details (count=54): ---- / cZxid = 0x00000000000000 ctime = Wed Dec 31 19:00:00 EST 1969 mZxid = 0x00000000000000 mtime = Wed Dec 31 19:00:00 EST 1969 pZxid = 0x00003d00024c87 cversion = 313155 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x00000000000000 dataLength = 0 ---- /hive_zookeeper_namespace_hue1 cZxid = 0x000026000033a1 ctime = Wed Sep 11 10:01:51 EDT 2013 mZxid = 0x000026000033a1 mtime = Wed Sep 11 10:01:51 EDT 2013 pZxid = 0x000026000033a1 cversion = 0 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x00000000000000 dataLength = 0 ----
No comments:
Post a Comment