﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-上善若水-随笔分类-Hadoop</title><link>http://www.blogjava.net/DLevin/category/51369.html</link><description>In general the OO style is to use a lot of little objects with a lot of little methods that give us a lot of plug points for overriding and variation.
To do is to be -Nietzsche, To bei is to do -Kant, Do be do be do -Sinatra</description><language>zh-cn</language><lastBuildDate>Fri, 04 Dec 2015 19:18:47 GMT</lastBuildDate><pubDate>Fri, 04 Dec 2015 19:18:47 GMT</pubDate><ttl>60</ttl><item><title>[转]HDFS Metadata Directories Explained - An overview of files and configurations under the HDFS meta-directory</title><link>http://www.blogjava.net/DLevin/archive/2015/01/25/422428.html</link><dc:creator>DLevin</dc:creator><author>DLevin</author><pubDate>Sun, 25 Jan 2015 15:28:00 GMT</pubDate><guid>http://www.blogjava.net/DLevin/archive/2015/01/25/422428.html</guid><wfw:comment>http://www.blogjava.net/DLevin/comments/422428.html</wfw:comment><comments>http://www.blogjava.net/DLevin/archive/2015/01/25/422428.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/DLevin/comments/commentRss/422428.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/DLevin/services/trackbacks/422428.html</trackback:ping><description><![CDATA[转自：http://zh.hortonworks.com/blog/hdfs-metadata-directories-explained/<br /><p style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">HDFS metadata represents the structure of HDFS directories and files in a tree. It also includes the various attributes of directories and files, such as ownership, permissions, quotas, and replication factor. In this blog post, I&#8217;ll describe how HDFS persists its metadata in Hadoop 2 by exploring the underlying local storage directories and files. All examples shown are from testing a build of the soon-to-be-released Apache Hadoop 2.6.0.</p><p style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;"><strong style="box-sizing: border-box;">WARNING</strong>: Do not attempt to modify metadata directories or files. Unexpected modifications can cause HDFS downtime, or even permanent data loss. This information is provided for educational purposes only.</p><p style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">Persistence of HDFS metadata broadly breaks down into 2 categories of files:</p><ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;"><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">fsimage</strong>&nbsp;&#8211; An fsimage file contains the complete state of the file system at a point in time. Every file system modification is assigned a unique, monotonically increasing transaction ID. An fsimage file represents the file system state after all modifications up to a specific transaction ID.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">edits</strong>&nbsp;&#8211; An edits file is a log that lists each file system change (file creation, deletion or modification) that was made after the most recent fsimage.</li></ul><p style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">Checkpointing is the process of merging the content of the most recent fsimage with all edits applied after that fsimage is merged in order to create a new fsimage. Checkpointing is triggered automatically by configuration policies or manually by HDFS administration commands.</p><h3>NameNode</h3><p style="box-sizing: border-box; margin-top: 0px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">Here is an example of an HDFS metadata directory taken from a NameNode. This shows the output of running the tree command on the metadata directory, which is configured by setting d<em style="box-sizing: border-box;">fs.namenode.name.dir</em>&nbsp;in<em style="box-sizing: border-box;">&nbsp;hdfs-site.xml</em>.</p><p style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">data/dfs/name<br style="box-sizing: border-box;" />&#9500;&#9472;&#9472; current<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; VERSION<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; edits_0000000000000000001-0000000000000000007<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; edits_0000000000000000008-0000000000000000015<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; edits_0000000000000000016-0000000000000000022<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; edits_0000000000000000023-0000000000000000029<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; edits_0000000000000000030-0000000000000000030<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; edits_0000000000000000031-0000000000000000031<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; edits_inprogress_0000000000000000032<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; fsimage_0000000000000000030<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; fsimage_0000000000000000030.md5<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; fsimage_0000000000000000031<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; fsimage_0000000000000000031.md5<br style="box-sizing: border-box;" />&#9474; &#9492;&#9472;&#9472; seen_txid<br style="box-sizing: border-box;" />&#9492;&#9472;&#9472; in_use.lock</p><p style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">In this example, the same directory has been used for both fsimage and edits. Alternatively, configuration options are available that allow separating fsimage and edits into different directories. Each file within this directory serves a specific purpose in the overall scheme of metadata persistence:</p><ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;"><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">VERSION</strong>&nbsp;&#8211; Text file that contains:</li><ul style="box-sizing: border-box; padding: 0px;"><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">layoutVersion</strong>&nbsp;&#8211; The version of the HDFS metadata format. When we add new features that require changing the metadata format, we change this number. An HDFS upgrade is required when the current HDFS software uses a layout version newer than what is currently tracked here.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">namespaceID/clusterID/blockpoolID</strong>&nbsp;&#8211; These are unique identifiers of an HDFS cluster. The identifiers are used to prevent DataNodes from registering accidentally with an incorrect NameNode that is part of a different cluster. These identifiers also are particularly important in a federated deployment. Within a federated deployment, there are multiple NameNodes working independently. Each NameNode serves a unique portion of the namespace (namespaceID) and manages a unique set of blocks (blockpoolID). The clusterID ties the whole cluster together as a single logical unit. It&#8217;s the same across all nodes in the cluster.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">storageType</strong>&nbsp;&#8211; This is either NAME_NODE or JOURNAL_NODE. Metadata on a JournalNode in an HA deployment is discussed later.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">cTime</strong>&nbsp;&#8211; Creation time of file system state. This field is updated during HDFS upgrades.</li></ul><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">edits_start transaction ID-end transaction ID</strong>&nbsp;&#8211; These are finalized (unmodifiable) edit log segments. Each of these files contains all of the edit log transactions in the range defined by the file name&#8217;s&nbsp;<start transaction="" id="" style="box-sizing: border-box;">through&nbsp;<end transaction="" id="" style="box-sizing: border-box;">. In an HA deployment, the standby can only read up through the finalized log segments. It will not be up-to-date with the current edit log in progress (described next). However, when an HA failover happens, the failover finalizes the current log segment so that it&#8217;s completely caught up before switching to active.</end></start></li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">edits_inprogress__start transaction ID</strong>&nbsp;&#8211; This is the current edit log in progress. All transactions starting from&nbsp;<start transaction="" id="" style="box-sizing: border-box;">are in this file, and all new incoming transactions will get appended to this file. HDFS pre-allocates space in this file in 1 MB chunks for efficiency, and then fills it with incoming transactions. You&#8217;ll probably see this file&#8217;s size as a multiple of 1 MB. When HDFS finalizes the log segment, it truncates the unused portion of the space that doesn&#8217;t contain any transactions, so the finalized file&#8217;s space will shrink down.</start></li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">fsimage_end transaction ID</strong>&nbsp;&#8211; This contains the complete metadata image up through&nbsp;<end transaction="" id="" style="box-sizing: border-box;">. Each fsimage file also has a corresponding .md5 file containing a MD5 checksum, which HDFS uses to guard against disk corruption.</end></li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">seen_txid&nbsp;</strong>- This contains the last transaction ID of the last checkpoint (merge of edits into a fsimage) or edit log roll (finalization of current edits_inprogress and creation of a new one). Note that this is not the last transaction ID accepted by the NameNode. The file is not updated on every transaction, only on a checkpoint or an edit log roll. The purpose of this file is to try to identify if edits are missing during startup. It&#8217;s possible to configure the NameNode to use separate directories for fsimage and edits files. If the edits directory accidentally gets deleted, then all transactions since the last checkpoint would go away, and the NameNode would start up using just fsimage at an old state. To guard against this, NameNode startup also checks seen_txid to verify that it can load transactions at least up through that number. It aborts startup if it can&#8217;t.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">in_use.lock</strong>&nbsp;&#8211; This is a lock file held by the NameNode process, used to prevent multiple NameNode processes from starting up and concurrently modifying the directory.</li></ul><h3>JournalNode</h3><p style="box-sizing: border-box; margin-top: 0px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">In an HA deployment, edits are logged to a separate set of daemons called JournalNodes. A JournalNode&#8217;s metadata directory is configured by setting&nbsp;<em style="box-sizing: border-box;">dfs.journalnode.edits.dir</em>. The JournalNode will contain a VERSION file, multiple edits_<start transaction="" id="" style="box-sizing: border-box;">_<end transaction="" id="" style="box-sizing: border-box;">&nbsp;files and an edits_inprogress_<start transaction="" id="" style="box-sizing: border-box;">, just like the NameNode. The JournalNode will not have fsimage files or seen_txid. In addition, it contains several other files relevant to the HA implementation. These files help prevent a split-brain scenario, in which multiple NameNodes could think they are active and all try to write edits.</start></end></start></p><ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;"><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">committed-txid</strong>&nbsp;&#8211; Tracks last transaction ID committed by a NameNode.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">last-promised-epoch</strong>&nbsp;&#8211; This file contains the &#8220;epoch,&#8221; which is a monotonically increasing number. When a new writer (a new NameNode) starts as active, it increments the epoch and presents it in calls to the JournalNode. This scheme is the NameNode&#8217;s way of claiming that it is active and requests from another NameNode, presenting a lower epoch, must be ignored.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">last-writer-epoch</strong>&nbsp;&#8211; Similar to the above, but this contains the epoch number associated with the writer who last actually wrote a transaction. (This was a bug fix for an edge case not handled by last-promised-epoch alone.)</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">paxos</strong>&nbsp;&#8211; Directory containing temporary files used in implementation of the Paxos distributed consensus protocol. This directory often will appear as empty.</li></ul><h3>DataNode</h3><p style="box-sizing: border-box; margin-top: 0px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">Although DataNodes do not contain metadata about the directories and files stored in an HDFS cluster, they do contain a small amount of metadata about the DataNode itself and its relationship to a cluster. This shows the output of running the tree command on the DataNode&#8217;s directory, configured by setting&nbsp;<em style="box-sizing: border-box;">dfs.datanode.data.dir</em>&nbsp;in<em style="box-sizing: border-box;">&nbsp;hdfs-site.xml</em>.</p><p style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">data/dfs/data/<br style="box-sizing: border-box;" />&#9500;&#9472;&#9472; current<br style="box-sizing: border-box;" />&#9474; &#9500;&#9472;&#9472; BP-1079595417-192.168.2.45-1412613236271<br style="box-sizing: border-box;" />&#9474; &#9474; &#9500;&#9472;&#9472; current<br style="box-sizing: border-box;" />&#9474; &#9474; &#9474; &#9500;&#9472;&#9472; VERSION<br style="box-sizing: border-box;" />&#9474; &#9474; &#9474; &#9500;&#9472;&#9472; finalized<br style="box-sizing: border-box;" />&#9474; &#9474; &#9474; &#9474; &#9492;&#9472;&#9472; subdir0<br style="box-sizing: border-box;" />&#9474; &#9474; &#9474; &#9474; &#9492;&#9472;&#9472; subdir1<br style="box-sizing: border-box;" />&#9474; &#9474; &#9474; &#9474; &#9500;&#9472;&#9472; blk_1073741825<br style="box-sizing: border-box;" />&#9474; &#9474; &#9474; &#9474; &#9492;&#9472;&#9472; blk_1073741825_1001.meta<br style="box-sizing: border-box;" />&#9474; &#9474; &#9474; &#9474;&#9472;&#9472; lazyPersist<br style="box-sizing: border-box;" />&#9474; &#9474; &#9474; &#9492;&#9472;&#9472; rbw<br style="box-sizing: border-box;" />&#9474; &#9474; &#9500;&#9472;&#9472; dncp_block_verification.log.curr<br style="box-sizing: border-box;" />&#9474; &#9474; &#9500;&#9472;&#9472; dncp_block_verification.log.prev<br style="box-sizing: border-box;" />&#9474; &#9474; &#9492;&#9472;&#9472; tmp<br style="box-sizing: border-box;" />&#9474; &#9492;&#9472;&#9472; VERSION<br style="box-sizing: border-box;" />&#9492;&#9472;&#9472; in_use.lock</p><p style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">The purpose of these files is:</p><ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;"><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">BP-random integer-NameNode-IP address-creation time</strong>&nbsp;&#8211; The naming convention on this directory is significant and constitutes a form of cluster metadata. The name is a block pool ID. &#8220;BP&#8221; stands for &#8220;block pool,&#8221; the abstraction that collects a set of blocks belonging to a single namespace. In the case of a federated deployment, there will be multiple &#8220;BP&#8221; sub-directories, one for each block pool. The remaining components form a unique ID: a random integer, followed by the IP address of the NameNode that created the block pool, followed by creation time.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">VERSION</strong>&nbsp;&#8211; Much like the NameNode and JournalNode, this is a text file containing multiple properties, such as layoutVersion, clusterId and cTime, all discussed earlier. There is a VERSION file tracked for the entire DataNode as well as a separate VERSION file in each block pool sub-directory. In addition to the properties already discussed earlier, the DataNode&#8217;s VERSION files also contain:</li><ul style="box-sizing: border-box; padding: 0px;"><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">storageType</strong>&nbsp;&#8211; In this case, the storageType field is set to DATA_NODE.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">blockpoolID</strong>&nbsp;&#8211; This repeats the block pool ID information encoded into the sub-directory name.</li></ul><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">finalized/rbw&nbsp;</strong>- Both finalized and rbw contain a directory structure for block storage. This holds numerous block files, which contain HDFS file data and the corresponding .meta files, which contain checksum information. &#8220;Rbw&#8221; stands for &#8220;replica being written&#8221;. This area contains blocks that are still being written to by an HDFS client. The finalized sub-directory contains blocks that are not being written to by a client and have been completed.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">lazyPersist</strong>&nbsp;&#8211; HDFS is incorporating a new feature to support writing transient data to memory, followed by lazy persistence to disk in the background. If this feature is in use, then a lazyPersist sub-directory is present and used for lazy persistence of in-memory blocks to disk. We&#8217;ll cover this exciting new feature in greater detail in a future blog post.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dncp_block_verification.log</strong>&nbsp;&#8211; This file tracks the last time each block was verified by checking its contents against its checksum. The last verification time is significant for deciding how to prioritize subsequent verification work. The DataNode orders its background block verification work in ascending order of last verification time. This file is rolled periodically, so it&#8217;s typical to see a .curr file (current) and a .prev file (previous).</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">in_use.lock</strong>&nbsp;&#8211; This is a lock file held by the DataNode process, used to prevent multiple DataNode processes from starting up and concurrently modifying the directory.</li></ul><h3>Commands</h3><p style="box-sizing: border-box; margin-top: 0px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">Various HDFS commands impact the metadata directories</p><table border="1" cellspacing="0" cellpadding="0" style="box-sizing: border-box; border-collapse: collapse; border-spacing: 0px; line-height: 24px; font-size: 16px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; color: #333333; background-color: #ffffff;"><tbody style="box-sizing: border-box;"><tr style="box-sizing: border-box;"><td valign="top" width="450" style="box-sizing: border-box; vertical-align: top;"><strong style="box-sizing: border-box;">Commands</strong></td><td valign="top" width="450" style="box-sizing: border-box; vertical-align: top;"><strong style="box-sizing: border-box;">Description</strong></td></tr><tr style="box-sizing: border-box;"><td valign="top" width="450" style="box-sizing: border-box; vertical-align: top;"><strong style="box-sizing: border-box;">hdfs namenode</strong></td><td valign="top" width="450" style="box-sizing: border-box; vertical-align: top;">NameNode startup automatically saves a new checkpoint. As stated earlier, checkpointing is the process of merging any outstanding edit logs with the latest fsimage, saving the full state to a new fsimage file, and rolling edits. Rolling edits means finalizing the current edits_inprogress and starting a new one.</td></tr><tr style="box-sizing: border-box;"><td valign="top" width="450" style="box-sizing: border-box; vertical-align: top;"><strong style="box-sizing: border-box;">hdfs dfsadmin -safemode enter</strong><br style="box-sizing: border-box;" /><strong style="box-sizing: border-box;">hdfs dfsadmin -saveNamespace</strong></td><td valign="top" width="450" style="box-sizing: border-box; vertical-align: top;">This saves a new checkpoint (much like restarting NameNode) while the NameNode process remains running. Note that the NameNode must be in safe mode, so all attempted write activity would fail while this is running.</td></tr><tr style="box-sizing: border-box;"><td valign="top" width="450" style="box-sizing: border-box; vertical-align: top;"><strong style="box-sizing: border-box;">hdfs dfsadmin -rollEdits</strong></td><td valign="top" width="450" style="box-sizing: border-box; vertical-align: top;">This manually rolls edits. Safe mode is not required. This can be useful if a standby NameNode is lagging behind the active and you want it to get caught up more quickly. (The standby NameNode can only read finalized edit log segments, not the current in progress edits file.)</td></tr><tr style="box-sizing: border-box;"><td valign="top" width="450" style="box-sizing: border-box; vertical-align: top;"><strong style="box-sizing: border-box;">hdfs dfsadmin -fetchImage</strong></td><td valign="top" width="450" style="box-sizing: border-box; vertical-align: top;">Downloads the latest fsimage from the NameNode. This can be helpful for a remote backup type of scenario.</td></tr></tbody></table><h3>Configuration Properties</h3><p style="box-sizing: border-box; margin-top: 0px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">Several configuration properties in hdfs-site.xml control the behavior of HDFS metadata directories.</p><ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;"><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dfs.namenode.name.dir</strong>&nbsp;&#8211; Determines where on the local filesystem the DFS name node should store the name table (fsimage). If this is a comma-delimited list of directories then the name table is replicated in all of the directories, for redundancy.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dfs.namenode.edits.dir&nbsp;</strong>- Determines where on the local filesystem the DFS name node should store the transaction (edits) file. If this is a comma-delimited list of directories then the transaction file is replicated in all of the directories, for redundancy. Default value is same as dfs.namenode.name.dir.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dfs.namenode.checkpoint.period&nbsp;</strong>- The number of seconds between two periodic checkpoints.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dfs.namenode.checkpoint.txns</strong>&nbsp;&#8211; The standby will create a checkpoint of the namespace every &#8216;dfs.namenode.checkpoint.txns&#8217; transactions, regardless of whether &#8216;dfs.namenode.checkpoint.period&#8217; has expired.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dfs.namenode.checkpoint.check.period</strong>&nbsp;&#8211; How frequently to query for the number of uncheckpointed transactions.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dfs.namenode.num.checkpoints.retained&nbsp;</strong>- The number of image checkpoint files that will be retained in storage directories. All edit logs necessary to recover an up-to-date namespace from the oldest retained checkpoint will also be retained.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dfs.namenode.num.extra.edits.retained</strong>&nbsp;&#8211; The number of extra transactions which should be retained beyond what is minimally necessary for a NN restart. This can be useful for audit purposes or for an HA setup where a remote Standby Node may have been offline for some time and need to have a longer backlog of retained edits in order to start again.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dfs.namenode.edit.log.autoroll.multiplier.threshold</strong>&nbsp;&#8211; Determines when an active namenode will roll its own edit log. The actual threshold (in number of edits) is determined by multiplying this value by dfs.namenode.checkpoint.txns. This prevents extremely large edit files from accumulating on the active namenode, which can cause timeouts during namenode startup and pose an administrative hassle. This behavior is intended as a failsafe for when the standby fails to roll the edit log by the normal checkpoint threshold.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dfs.namenode.edit.log.autoroll.check.interval.ms</strong>&nbsp;&#8211; How often an active namenode will check if it needs to roll its edit log, in milliseconds.</li><li style="box-sizing: border-box;"><strong style="box-sizing: border-box;">dfs.datanode.data.dir</strong>&nbsp;&#8211; Determines where on the local filesystem an DFS data node should store its blocks. If this is a comma-delimited list of directories, then data will be stored in all named directories, typically on different devices. Directories that do not exist are ignored. Heterogeneous storage allows specifying that each directory resides on a different type of storage: DISK, SSD, ARCHIVE or RAM_DISK.</li></ul><h3>Conclusion</h3><p style="box-sizing: border-box; margin-top: 0px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">We briefly discussed how HDFS persists its metadata in Hadoop 2 by exploring the underlying local storage directories and files, the relevant configurations that drive specific behaviors, and appropriate HDFS metadata directory commands that print out the directory tree, initiate checkpoint, and create a fsimage.</p><p style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', 'Lucida Grande', sans-serif; font-size: 16px; line-height: 24px; background-color: #ffffff;">In a future blog, we&#8217;ll explore lazy persistence, a scheme to persist in-memory data to disk, in more in details.</p><img src ="http://www.blogjava.net/DLevin/aggbug/422428.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/DLevin/" target="_blank">DLevin</a> 2015-01-25 23:28 <a href="http://www.blogjava.net/DLevin/archive/2015/01/25/422428.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>eclipse下使用cygwin直接运行shell文件配置</title><link>http://www.blogjava.net/DLevin/archive/2012/04/12/373875.html</link><dc:creator>DLevin</dc:creator><author>DLevin</author><pubDate>Wed, 11 Apr 2012 16:38:00 GMT</pubDate><guid>http://www.blogjava.net/DLevin/archive/2012/04/12/373875.html</guid><wfw:comment>http://www.blogjava.net/DLevin/comments/373875.html</wfw:comment><comments>http://www.blogjava.net/DLevin/archive/2012/04/12/373875.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/DLevin/comments/commentRss/373875.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/DLevin/services/trackbacks/373875.html</trackback:ping><description><![CDATA[最近事情挺多的，好久不写博客了。今天在看hadoop的时候，突然心血来潮，想在windows的eclipse下跑hadoop的shell脚本，这样就方便多了，查了一个晚上，终于看似找到了，泪奔。记录&amp;分享一下，如果有人也有这样的需求或者备以后自己看。<br /><br />当然在windows下跑shell当然是要先安装cygwin了，关于这个cygwin的安装就不在这里说了，另外关于如何在cygwin配置hadoop貌似已经有人写过了，也不在这里介绍了，有兴趣的童鞋可以参考：<a href="http://blog.csdn.net/yanical/article/details/4474830">http://blog.csdn.net/yanical/article/details/4474830</a><br /><br />所以本文只关注如何将cygwin引入到eclipse中以运行shell脚本。<br />在eclipse中，通过External Tools方式来支持嵌入包括cygwin在内的其他工具，以下是这些步骤：<br />1. eclipse-&gt;Run-&gt;External Tools-&gt;External Tools Configuration....<br />2. 在配置页面中，那么可以按你的爱好随便指定，如cywin_hadoop，location是指externl tools的地址，这里就是解释shell的bash，简单一点的，可以直接指定：C:\cygwin\bin\bash.exe，这样可以执行一些简单的命令，但是如果要引用其他解释器，那就有问题了，比如执行hadoop的shell文件，就会发现dirname命令找不到的提示。所以一种解决方法是自己写一个bat脚本，把需要用到的目录都写道PATH中，比如我编写了如下的bat脚本（当然如果需要其他更多其他目录的命令，可以往PATH中添加）：<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000">@echo&nbsp;off<br />rem&nbsp;上一行关闭命令回显<br /><br />PATH</span><span style="color: #000000">=</span><span style="color: #000000">C:\cygwin\bin\;</span><span style="color: #000000">%</span><span style="color: #000000">PATH</span><span style="color: #000000">%</span><span style="color: #000000"><br /><br />bash&nbsp;</span><span style="color: #000000">%</span><span style="color: #000000">1</span><span style="color: #000000"><br /><br />rem&nbsp;开启命令回显<br />echo&nbsp;on</span></div>然后把location指向该文件。<br />3. Work Directory是指工作目录，可以指定你脚本所在目录，如我的hadoop脚本在scripts下，那么我就指定了：${workspace_loc:/hadoop/scripts}<br />4. Arguments我指定了当前的文件名：${resource_name}，如果在实际运行hadoop脚本时参数可以往后再添加。<br /><br />这样就配置好了，直接点击Run就可以运行了。这样感觉以后开发就方便多了。<br /><br />另外，还发现了一个非常有趣的东东，一同记录分享。<br />为了在windows下点击shell脚本文件就可以直接运行shell脚本，有人想出了如下命令（出自：<a href="http://stackoverflow.com/questions/105075/how-can-i-associate-sh-files-with-cygwin">http://stackoverflow.com/questions/105075/how-can-i-associate-sh-files-with-cygwin</a>）：<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000">assoc&nbsp;.sh</span><span style="color: #000000">=</span><span style="color: #000000">bashscript<br /><br />ftype&nbsp;bashscript</span><span style="color: #000000">=</span><span style="color: #000000">C:\cygwin\bin\bash.exe&nbsp;</span><span style="color: #000000">--</span><span style="color: #000000">login&nbsp;</span><span style="color: #000000">-</span><span style="color: #000000">i&nbsp;</span><span style="color: #000000">-</span><span style="color: #000000">c&nbsp;</span><span style="color: #000000">'</span><span style="color: #000000">cd&nbsp;"$(dirname&nbsp;"$(cygpath&nbsp;-u&nbsp;"%1")")";&nbsp;bash&nbsp;"$(cygpath&nbsp;-u&nbsp;"%1")"</span><span style="color: #000000">'</span></div>即设置*.sh文件的默认执行软件是bash，如果在win7下需要用管理员身份打开cmd，然后运行这两个指令。可惜我好像木有运行成功，没有仔细找原因，不过我尝试了一下命令确实可以运行：<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000">assoc&nbsp;.sh</span><span style="color: #000000">=</span><span style="color: #000000">bashscript</span><span style="color: #000000"><br />ftype&nbsp;bashscript</span><span style="color: #000000">=</span><span style="color: #000000">C:\cygwin\bin\bash.exe&nbsp;</span><span style="color: #000000">%</span><span style="color: #000000">1</span></div>感觉挺好玩的。。。。 <img src ="http://www.blogjava.net/DLevin/aggbug/373875.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/DLevin/" target="_blank">DLevin</a> 2012-04-12 00:38 <a href="http://www.blogjava.net/DLevin/archive/2012/04/12/373875.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>