您好,登錄后才能下訂單哦!
這篇文章主要介紹“zk的樹(shù)形數(shù)據(jù)模型是什么”,在日常操作中,相信很多人在zk的樹(shù)形數(shù)據(jù)模型是什么問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”zk的樹(shù)形數(shù)據(jù)模型是什么”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!
zookeeper的數(shù)據(jù)模型是樹(shù)結(jié)構(gòu)
在內(nèi)存數(shù)據(jù)庫(kù)中存儲(chǔ)了整顆樹(shù)內(nèi)容,包含所有節(jié)點(diǎn)路徑,節(jié)點(diǎn)數(shù)據(jù),狀態(tài)信息
會(huì)定時(shí)將數(shù)據(jù)刷到磁盤(pán)上
數(shù)據(jù)模型表示主要有DataTree DataNode ZKDatabase
datatree是一顆樹(shù)結(jié)構(gòu),不包含和客戶端,網(wǎng)絡(luò),請(qǐng)求相關(guān)的業(yè)務(wù)邏輯
dataNode是數(shù)據(jù)存儲(chǔ)的最小單元,保存了節(jié)點(diǎn)數(shù)據(jù)內(nèi)容,ACL列表,狀態(tài),父節(jié)點(diǎn)引用和子節(jié)點(diǎn)列表
zkdatabase是內(nèi)存數(shù)據(jù)庫(kù),管理zk所有會(huì)話,DataTree存儲(chǔ)和事務(wù)日志,定時(shí)將日志刷寫(xiě)到磁盤(pán)
在zookeeper啟動(dòng)時(shí),會(huì)通過(guò)磁盤(pán)的事務(wù)日志和快照文件恢復(fù)一個(gè)完整的內(nèi)存數(shù)據(jù)庫(kù)
屬性相關(guān)
屬性相關(guān) private final NodeHashMap nodes; //監(jiān)聽(tīng)節(jié)點(diǎn) private IWatchManager dataWatches; //監(jiān)聽(tīng)節(jié)點(diǎn) 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é)點(diǎn) private static final String rootZookeeper = "/"; /** the zookeeper nodes that acts as the management and status node **/ //狀態(tài)管理節(jié)點(diǎn) private static final String procZookeeper = Quotas.procZookeeper; /** th will be the string thats stored as a child of root */ //root的一個(gè)子節(jié)點(diǎn) private static final String procChildZookeeper = procZookeeper.substring(1); /** * the zookeeper quota node that acts as the quota management node for * zookeeper */ //限額管理節(jié)點(diǎn) private static final String quotaZookeeper = Quotas.quotaZookeeper; /** thi是s- will be the string thats stored as a child of /zookeeper */ // /zookeeper的子節(jié)點(diǎn) private static final String quotaChildZookeeper = quotaZookeeper.substring(procZookeeper.length() + 1); /** * the zookeeper config node that acts as the config management node for * zookeeper */ //配置管理節(jié)點(diǎn) private static final String configZookeeper = ZooDefs.CONFIG_NODE; /** thi是s- will be the string thats stored as a child of /zookeeper */ // 子節(jié)點(diǎn)config節(jié)點(diǎn) 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é)點(diǎn)關(guān)聯(lián) private final PathTrie pTrie = new PathTrie(); /** * over-the-wire size of znode's stat. Counting the fields of Stat class */ //stat 類(lèi)的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. */ //臨時(shí)會(huì)話節(jié)點(diǎn)的相關(guān)路徑 private final Map<Long, HashSet<String>> ephemerals = new ConcurrentHashMap<Long, HashSet<String>>(); /** * Thi是s- set contains the paths of all container nodes */ // 容器節(jié)點(diǎn)的路徑 private final Set<String> containers = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); /** * Thi是s- set contains the paths of all ttl nodes */ //ttl node的相關(guān)路徑 private final Set<String> ttls = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); 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<DigestWatcher> digestWatchers = new ArrayLi是s-t<>(); // The hi是s-torical digests li是s-t. private LinkedLi是s-t<ZxidDigest> digestLog = new LinkedLi是s-t<>(); private final DigestCalculator digestCalculator;
到此,關(guān)于“zk的樹(shù)形數(shù)據(jù)模型是什么”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。