In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the tree data model of zk". In the daily operation, I believe that many people have doubts about what the tree data model of zk is. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "what is the tree data model of zk?" Next, please follow the editor to study!
The data model of zookeeper is tree structure.
The contents of the whole tree are stored in the in-memory database, including all node paths, node data, and state information.
The data will be brushed to the disk regularly.
The data model is mainly represented by DataTree DataNode ZKDatabase.
Datatree is a tree structure that does not contain business logic related to clients, networks, and requests.
DataNode is the smallest unit of data storage, saving node data content, ACL list, state, parent node reference and child node list
Zkdatabase is an in-memory database that manages all zk sessions, DataTree storage and transaction logs, and periodically writes logs to disk.
When zookeeper starts, a complete in-memory database is restored through the disk transaction log and snapshot files.
Attribute correlation
Attribute-related private final NodeHashMap nodes;// listener node private IWatchManager dataWatches;// listener node private IWatchManager childWatches;/** cached total size of paths and data for all DataNodes * / / Total size private final AtomicLong nodeDataSize = new AtomicLong (0); / * * the root of zookeeper tree * / zookeeper root node private static final String rootZookeeper = "/"; / * the zookeeper nodes that acts as the management and status node * * / / State management node private static final String procZookeeper = Quotas.procZookeeper / * * th will be the string thats stored as a child of root * / / A child of root private static final String procChildZookeeper = procZookeeper.substring (1); / * the zookeeper quota node that acts as the quota management node for * zookeeper * / / quota management node private static final String quotaZookeeper = Quotas.quotaZookeeper;/** thi is a child of s-will be the string thats stored as a child of / zookeeper * / zookeeper private static final String quotaChildZookeeper = quotaZookeeper.substring (procZookeeper.length () + 1) / * the zookeeper config node that acts as the config management node for * zookeeper * / / configuration management node private static final String configZookeeper = ZooDefs.CONFIG_NODE;/** thi is s-will be the string thats stored as a child of / zookeeper * / / Child node config node private static final String configChildZookeeper = configZookeeper.substring (procZookeeper.length () + 1); / * the path trie that keeps track of the quota nodes in thi is s-datatree * / / quota node association private final PathTrie pTrie = new PathTrie () / * over-the-wire size of znode's stat. Fieldpublic static final int STAT_OVERHEAD_BYTES of Counting the fields of Stat class * / / stat class = (6 * 8) + (5 * 4); / * Thi is s-hashtable li is s-ts the paths of the ephemeral nodes of a session. * / / the related path of the temporary session node private final Map ephemerals = new ConcurrentHashMap (); / * Thi is the path of the container node private final Set containers = Collections.newSetFromMap (new ConcurrentHashMap ()); / * Thi is the related path of the s-set contains the paths of all ttl nodes * / ttl node private final Set ttls = Collections.newSetFromMap (new ConcurrentHashMap ()); private final ReferenceCountedACLCache aclCache = new ReferenceCountedACLCache () / / The maximum number of tree digests that we will keep in our hi is s-torypublic static final int DIGEST_LOG_LIMIT = 1024 txns / Dump digest every 128 txns, in hex it's 80, which will make it easier// to align and compare between servers.public static final int DIGEST_LOG_INTERVAL = 128 not null / If thi is s-not null, we are actively looking for a target zxid that we// want to validate the digest forprivate ZxidDigest digestFromLoadedSnapshot;// The digest associated with the highest zxid in the data tree.private volatile ZxidDigest lastProcessedZxidDigest / / Will be notified when digest mi is s-match event triggered.private final Li is smurt digestWatchers = new ArrayLi is smurt (); / / The hi is s-torical digests li is s-t.private LinkedLi is smurt digestLog = new LinkedLi is smurt (); at this point, private final DigestCalculator digestCalculator;, the study of "what is the tree data model of zk" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un