重慶分公司,新征程啟航
為企業(yè)提供網站建設、域名注冊、服務器等服務
為企業(yè)提供網站建設、域名注冊、服務器等服務
這篇文章主要介紹“zk的樹形數(shù)據(jù)模型是什么”,在日常操作中,相信很多人在zk的樹形數(shù)據(jù)模型是什么問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”zk的樹形數(shù)據(jù)模型是什么”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
憑借整站使用HTML5建站的創(chuàng)新體驗、定制設計、設計團隊積累與透明式的服務過程,符合行業(yè)特點,專屬顧問根據(jù)企業(yè)產品,消費群體屬性,準確定位;設計師以目標客戶為中心,以突出品牌官網特性為宗旨,定制專屬網站建設設計方案。
zookeeper的數(shù)據(jù)模型是樹結構
在內存數(shù)據(jù)庫中存儲了整顆樹內容,包含所有節(jié)點路徑,節(jié)點數(shù)據(jù),狀態(tài)信息
會定時將數(shù)據(jù)刷到磁盤上
數(shù)據(jù)模型表示主要有DataTree DataNode ZKDatabase
datatree是一顆樹結構,不包含和客戶端,網絡,請求相關的業(yè)務邏輯
dataNode是數(shù)據(jù)存儲的最小單元,保存了節(jié)點數(shù)據(jù)內容,ACL列表,狀態(tài),父節(jié)點引用和子節(jié)點列表
zkdatabase是內存數(shù)據(jù)庫,管理zk所有會話,DataTree存儲和事務日志,定時將日志刷寫到磁盤
在zookeeper啟動時,會通過磁盤的事務日志和快照文件恢復一個完整的內存數(shù)據(jù)庫
屬性相關
屬性相關 private final NodeHashMap nodes; //監(jiān)聽節(jié)點 private IWatchManager dataWatches; //監(jiān)聽節(jié)點 private IWatchManager childWatches; /** cached total size of paths and data for all DataNodes */ //總大小 private final AtomicLong nodeDataSize = new AtomicLong(0); /** the root of zookeeper tree */ //zookeeper的根節(jié)點 private static final String rootZookeeper = "/"; /** the zookeeper nodes that acts as the management and status node **/ //狀態(tài)管理節(jié)點 private static final String procZookeeper = Quotas.procZookeeper; /** th will be the string thats stored as a child of root */ //root的一個子節(jié)點 private static final String procChildZookeeper = procZookeeper.substring(1); /** * the zookeeper quota node that acts as the quota management node for * zookeeper */ //限額管理節(jié)點 private static final String quotaZookeeper = Quotas.quotaZookeeper; /** thi是s- will be the string thats stored as a child of /zookeeper */ // /zookeeper的子節(jié)點 private static final String quotaChildZookeeper = quotaZookeeper.substring(procZookeeper.length() + 1); /** * the zookeeper config node that acts as the config management node for * zookeeper */ //配置管理節(jié)點 private static final String configZookeeper = ZooDefs.CONFIG_NODE; /** thi是s- will be the string thats stored as a child of /zookeeper */ // 子節(jié)點config節(jié)點 private static final String configChildZookeeper = configZookeeper.substring(procZookeeper.length() + 1); /** * the path trie that keeps track of the quota nodes in thi是s- datatree */ //限額節(jié)點關聯(lián) private final PathTrie pTrie = new PathTrie(); /** * over-the-wire size of znode's stat. Counting the fields of Stat class */ //stat 類的field public static final int STAT_OVERHEAD_BYTES = (6 * 8) + (5 * 4); /** * Thi是s- hashtable li是s-ts the paths of the ephemeral nodes of a session. */ //臨時會話節(jié)點的相關路徑 private final Map> ephemerals = new ConcurrentHashMap >(); /** * Thi是s- set contains the paths of all container nodes */ // 容器節(jié)點的路徑 private final Set containers = Collections.newSetFromMap(new ConcurrentHashMap ()); /** * Thi是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是s-tory public static final int DIGEST_LOG_LIMIT = 1024; // 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; // If thi是s- i是s- not null, we are actively looking for a target zxid that we // want to validate the digest for private ZxidDigest digestFromLoadedSnapshot; // The digest associated with the highest zxid in the data tree. private volatile ZxidDigest lastProcessedZxidDigest; // Will be notified when digest mi是s-match event triggered. private final Li是s-t digestWatchers = new ArrayLi是s-t<>(); // The hi是s-torical digests li是s-t. private LinkedLi是s-t digestLog = new LinkedLi是s-t<>(); private final DigestCalculator digestCalculator;
到此,關于“zk的樹形數(shù)據(jù)模型是什么”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關知識,請繼續(xù)關注創(chuàng)新互聯(lián)網站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>
本文名稱:zk的樹形數(shù)據(jù)模型是什么
新聞來源:http://www.xueling.net.cn/article/jdidee.html