hdfs_user_guide.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta content="Apache Forrest" name="Generator">
  6. <meta name="Forrest-version" content="0.8">
  7. <meta name="Forrest-skin-name" content="pelt">
  8. <title>
  9. HDFS User Guide
  10. </title>
  11. <link type="text/css" href="skin/basic.css" rel="stylesheet">
  12. <link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
  13. <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
  14. <link type="text/css" href="skin/profile.css" rel="stylesheet">
  15. <script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
  16. <link rel="shortcut icon" href="images/favicon.ico">
  17. </head>
  18. <body onload="init()">
  19. <script type="text/javascript">ndeSetTextSize();</script>
  20. <div id="top">
  21. <!--+
  22. |breadtrail
  23. +-->
  24. <div class="breadtrail">
  25. <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a> &gt; <a href="http://hadoop.apache.org/core/">Core</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
  26. </div>
  27. <!--+
  28. |header
  29. +-->
  30. <div class="header">
  31. <!--+
  32. |start group logo
  33. +-->
  34. <div class="grouplogo">
  35. <a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
  36. </div>
  37. <!--+
  38. |end group logo
  39. +-->
  40. <!--+
  41. |start Project Logo
  42. +-->
  43. <div class="projectlogo">
  44. <a href="http://hadoop.apache.org/core/"><img class="logoImage" alt="Hadoop" src="images/core-logo.gif" title="Scalable Computing Platform"></a>
  45. </div>
  46. <!--+
  47. |end Project Logo
  48. +-->
  49. <!--+
  50. |start Search
  51. +-->
  52. <div class="searchbox">
  53. <form action="http://www.google.com/search" method="get" class="roundtopsmall">
  54. <input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp;
  55. <input name="Search" value="Search" type="submit">
  56. </form>
  57. </div>
  58. <!--+
  59. |end search
  60. +-->
  61. <!--+
  62. |start Tabs
  63. +-->
  64. <ul id="tabs">
  65. <li>
  66. <a class="unselected" href="http://hadoop.apache.org/core/">Project</a>
  67. </li>
  68. <li>
  69. <a class="unselected" href="http://wiki.apache.org/hadoop">Wiki</a>
  70. </li>
  71. <li class="current">
  72. <a class="selected" href="index.html">Hadoop 0.20 Documentation</a>
  73. </li>
  74. </ul>
  75. <!--+
  76. |end Tabs
  77. +-->
  78. </div>
  79. </div>
  80. <div id="main">
  81. <div id="publishedStrip">
  82. <!--+
  83. |start Subtabs
  84. +-->
  85. <div id="level2tabs"></div>
  86. <!--+
  87. |end Endtabs
  88. +-->
  89. <script type="text/javascript"><!--
  90. document.write("Last Published: " + document.lastModified);
  91. // --></script>
  92. </div>
  93. <!--+
  94. |breadtrail
  95. +-->
  96. <div class="breadtrail">
  97. &nbsp;
  98. </div>
  99. <!--+
  100. |start Menu, mainarea
  101. +-->
  102. <!--+
  103. |start Menu
  104. +-->
  105. <div id="menu">
  106. <div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Documentation</div>
  107. <div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
  108. <div class="menuitem">
  109. <a href="index.html">Overview</a>
  110. </div>
  111. <div class="menuitem">
  112. <a href="quickstart.html">Hadoop Quick Start</a>
  113. </div>
  114. <div class="menuitem">
  115. <a href="cluster_setup.html">Hadoop Cluster Setup</a>
  116. </div>
  117. <div class="menuitem">
  118. <a href="mapred_tutorial.html">Hadoop Map/Reduce Tutorial</a>
  119. </div>
  120. <div class="menuitem">
  121. <a href="commands_manual.html">Hadoop Command Guide</a>
  122. </div>
  123. <div class="menuitem">
  124. <a href="hdfs_shell.html">Hadoop FS Shell Guide</a>
  125. </div>
  126. <div class="menuitem">
  127. <a href="distcp.html">Hadoop DistCp Guide</a>
  128. </div>
  129. <div class="menuitem">
  130. <a href="native_libraries.html">Hadoop Native Libraries</a>
  131. </div>
  132. <div class="menuitem">
  133. <a href="streaming.html">Hadoop Streaming</a>
  134. </div>
  135. <div class="menuitem">
  136. <a href="hadoop_archives.html">Hadoop Archives</a>
  137. </div>
  138. <div class="menupage">
  139. <div class="menupagetitle">HDFS User Guide</div>
  140. </div>
  141. <div class="menuitem">
  142. <a href="hdfs_design.html">HDFS Architecture</a>
  143. </div>
  144. <div class="menuitem">
  145. <a href="hdfs_permissions_guide.html">HDFS Admin Guide: Permissions</a>
  146. </div>
  147. <div class="menuitem">
  148. <a href="hdfs_quota_admin_guide.html">HDFS Admin Guide: Quotas</a>
  149. </div>
  150. <div class="menuitem">
  151. <a href="SLG_user_guide.html">HDFS Utilities</a>
  152. </div>
  153. <div class="menuitem">
  154. <a href="libhdfs.html">HDFS C API</a>
  155. </div>
  156. <div class="menuitem">
  157. <a href="hod_user_guide.html">HOD User Guide</a>
  158. </div>
  159. <div class="menuitem">
  160. <a href="hod_admin_guide.html">HOD Admin Guide</a>
  161. </div>
  162. <div class="menuitem">
  163. <a href="hod_config_guide.html">HOD Config Guide</a>
  164. </div>
  165. <div class="menuitem">
  166. <a href="capacity_scheduler.html">Capacity Scheduler</a>
  167. </div>
  168. <div class="menuitem">
  169. <a href="vaidya.html">Hadoop Vaidya</a>
  170. </div>
  171. <div class="menuitem">
  172. <a href="api/index.html">API Docs</a>
  173. </div>
  174. <div class="menuitem">
  175. <a href="jdiff/changes.html">API Changes</a>
  176. </div>
  177. <div class="menuitem">
  178. <a href="http://wiki.apache.org/hadoop/">Wiki</a>
  179. </div>
  180. <div class="menuitem">
  181. <a href="http://wiki.apache.org/hadoop/FAQ">FAQ</a>
  182. </div>
  183. <div class="menuitem">
  184. <a href="releasenotes.html">Release Notes</a>
  185. </div>
  186. <div class="menuitem">
  187. <a href="changes.html">Change Log</a>
  188. </div>
  189. </div>
  190. <div id="credit"></div>
  191. <div id="roundbottom">
  192. <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
  193. <!--+
  194. |alternative credits
  195. +-->
  196. <div id="credit2"></div>
  197. </div>
  198. <!--+
  199. |end Menu
  200. +-->
  201. <!--+
  202. |start content
  203. +-->
  204. <div id="content">
  205. <div title="Portable Document Format" class="pdflink">
  206. <a class="dida" href="hdfs_user_guide.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
  207. PDF</a>
  208. </div>
  209. <h1>
  210. HDFS User Guide
  211. </h1>
  212. <div id="minitoc-area">
  213. <ul class="minitoc">
  214. <li>
  215. <a href="#Purpose">Purpose</a>
  216. </li>
  217. <li>
  218. <a href="#Overview"> Overview </a>
  219. </li>
  220. <li>
  221. <a href="#Pre-requisites"> Pre-requisites </a>
  222. </li>
  223. <li>
  224. <a href="#Web+Interface"> Web Interface </a>
  225. </li>
  226. <li>
  227. <a href="#Shell+Commands">Shell Commands</a>
  228. <ul class="minitoc">
  229. <li>
  230. <a href="#DFSAdmin+Command"> DFSAdmin Command </a>
  231. </li>
  232. </ul>
  233. </li>
  234. <li>
  235. <a href="#Secondary+NameNode"> Secondary NameNode </a>
  236. </li>
  237. <li>
  238. <a href="#Rebalancer"> Rebalancer </a>
  239. </li>
  240. <li>
  241. <a href="#Rack+Awareness"> Rack Awareness </a>
  242. </li>
  243. <li>
  244. <a href="#Safemode"> Safemode </a>
  245. </li>
  246. <li>
  247. <a href="#fsck"> fsck </a>
  248. </li>
  249. <li>
  250. <a href="#Upgrade+and+Rollback"> Upgrade and Rollback </a>
  251. </li>
  252. <li>
  253. <a href="#File+Permissions+and+Security"> File Permissions and Security </a>
  254. </li>
  255. <li>
  256. <a href="#Scalability"> Scalability </a>
  257. </li>
  258. <li>
  259. <a href="#Related+Documentation"> Related Documentation </a>
  260. </li>
  261. </ul>
  262. </div>
  263. <a name="N1000D"></a><a name="Purpose"></a>
  264. <h2 class="h3">Purpose</h2>
  265. <div class="section">
  266. <p>
  267. This document is a starting point for users working with
  268. Hadoop Distributed File System (HDFS) either as a part of a
  269. <a href="http://hadoop.apache.org/">Hadoop</a>
  270. cluster or as a stand-alone general purpose distributed file system.
  271. While HDFS is designed to "just work" in many environments, a working
  272. knowledge of HDFS helps greatly with configuration improvements and
  273. diagnostics on a specific cluster.
  274. </p>
  275. </div>
  276. <a name="N1001B"></a><a name="Overview"></a>
  277. <h2 class="h3"> Overview </h2>
  278. <div class="section">
  279. <p>
  280. HDFS is the primary distributed storage used by Hadoop applications. A
  281. HDFS cluster primarily consists of a NameNode that manages the
  282. file system metadata and DataNodes that store the actual data. The
  283. <a href="hdfs_design.html">HDFS Architecture</a> describes HDFS in detail. This user guide primarily deals with
  284. the interaction of users and administrators with HDFS clusters.
  285. The <a href="images/hdfsarchitecture.gif">HDFS architecture diagram</a> depicts
  286. basic interactions among NameNode, the DataNodes, and the clients.
  287. Clients contact NameNode for file metadata or file modifications and perform
  288. actual file I/O directly with the DataNodes.
  289. </p>
  290. <p>
  291. The following are some of the salient features that could be of
  292. interest to many users.
  293. </p>
  294. <ul>
  295. <li>
  296. Hadoop, including HDFS, is well suited for distributed storage
  297. and distributed processing using commodity hardware. It is fault
  298. tolerant, scalable, and extremely simple to expand.
  299. <a href="mapred_tutorial.html">Map/Reduce</a>,
  300. well known for its simplicity and applicability for large set of
  301. distributed applications, is an integral part of Hadoop.
  302. </li>
  303. <li>
  304. HDFS is highly configurable with a default configuration well
  305. suited for many installations. Most of the time, configuration
  306. needs to be tuned only for very large clusters.
  307. </li>
  308. <li>
  309. Hadoop is written in Java and is supported on all major platforms.
  310. </li>
  311. <li>
  312. Hadoop supports shell-like commands to interact with HDFS directly.
  313. </li>
  314. <li>
  315. The NameNode and Datanodes have built in web servers that makes it
  316. easy to check current status of the cluster.
  317. </li>
  318. <li>
  319. New features and improvements are regularly implemented in HDFS.
  320. The following is a subset of useful features in HDFS:
  321. <ul>
  322. <li>
  323. File permissions and authentication.
  324. </li>
  325. <li>
  326. <em>Rack awareness</em>: to take a node's physical location into
  327. account while scheduling tasks and allocating storage.
  328. </li>
  329. <li>
  330. Safemode: an administrative mode for maintenance.
  331. </li>
  332. <li>
  333. <span class="codefrag">fsck</span>: a utility to diagnose health of the file system, to
  334. find missing files or blocks.
  335. </li>
  336. <li>
  337. Rebalancer: tool to balance the cluster when the data is
  338. unevenly distributed among DataNodes.
  339. </li>
  340. <li>
  341. Upgrade and rollback: after a software upgrade,
  342. it is possible to
  343. rollback to HDFS' state before the upgrade in case of unexpected
  344. problems.
  345. </li>
  346. <li>
  347. Secondary NameNode: performs periodic checkpoints of the
  348. namespace and helps keep the size of file containing log of HDFS
  349. modifications within certain limits at the NameNode.
  350. </li>
  351. </ul>
  352. </li>
  353. </ul>
  354. </div>
  355. <a name="N10067"></a><a name="Pre-requisites"></a>
  356. <h2 class="h3"> Pre-requisites </h2>
  357. <div class="section">
  358. <p>
  359. The following documents describe installation and set up of a
  360. Hadoop cluster :
  361. </p>
  362. <ul>
  363. <li>
  364. <a href="quickstart.html">Hadoop Quick Start</a>
  365. for first-time users.
  366. </li>
  367. <li>
  368. <a href="cluster_setup.html">Hadoop Cluster Setup</a>
  369. for large, distributed clusters.
  370. </li>
  371. </ul>
  372. <p>
  373. The rest of this document assumes the user is able to set up and run a
  374. HDFS with at least one DataNode. For the purpose of this document,
  375. both the NameNode and DataNode could be running on the same physical
  376. machine.
  377. </p>
  378. </div>
  379. <a name="N10085"></a><a name="Web+Interface"></a>
  380. <h2 class="h3"> Web Interface </h2>
  381. <div class="section">
  382. <p>
  383. NameNode and DataNode each run an internal web server in order to
  384. display basic information about the current status of the cluster.
  385. With the default configuration, the NameNode front page is at
  386. <span class="codefrag">http://namenode-name:50070/</span>.
  387. It lists the DataNodes in the cluster and basic statistics of the
  388. cluster. The web interface can also be used to browse the file
  389. system (using "Browse the file system" link on the NameNode front
  390. page).
  391. </p>
  392. </div>
  393. <a name="N10092"></a><a name="Shell+Commands"></a>
  394. <h2 class="h3">Shell Commands</h2>
  395. <div class="section">
  396. <p>
  397. Hadoop includes various shell-like commands that directly
  398. interact with HDFS and other file systems that Hadoop supports.
  399. The command
  400. <span class="codefrag">bin/hadoop fs -help</span>
  401. lists the commands supported by Hadoop
  402. shell. Furthermore, the command
  403. <span class="codefrag">bin/hadoop fs -help command-name</span>
  404. displays more detailed help for a command. These commands support
  405. most of the normal files ystem operations like copying files,
  406. changing file permissions, etc. It also supports a few HDFS
  407. specific operations like changing replication of files.
  408. </p>
  409. <a name="N100A1"></a><a name="DFSAdmin+Command"></a>
  410. <h3 class="h4"> DFSAdmin Command </h3>
  411. <p>
  412. The <span class="codefrag">bin/hadoop dfsadmin</span>
  413. command supports a few HDFS administration related operations.
  414. The <span class="codefrag">bin/hadoop dfsadmin -help</span> command
  415. lists all the commands currently supported. For e.g.:
  416. </p>
  417. <ul>
  418. <li>
  419. <span class="codefrag">-report</span>
  420. : reports basic statistics of HDFS. Some of this information is
  421. also available on the NameNode front page.
  422. </li>
  423. <li>
  424. <span class="codefrag">-safemode</span>
  425. : though usually not required, an administrator can manually enter
  426. or leave Safemode.
  427. </li>
  428. <li>
  429. <span class="codefrag">-finalizeUpgrade</span>
  430. : removes previous backup of the cluster made during last upgrade.
  431. </li>
  432. <li>
  433. <span class="codefrag">-refreshNodes</span>
  434. : Updates the set of hosts allowed to connect to namenode.
  435. Re-reads the config file to update values defined by dfs.hosts and
  436. dfs.host.exclude and reads the entires (hostnames) in those files.
  437. Each entry not defined in dfs.hosts but in dfs.hosts.exclude
  438. is decommissioned. Each entry defined in dfs.hosts and also in
  439. dfs.host.exclude is stopped from decommissioning if it has aleady
  440. been marked for decommission. Entires not present in both the lists
  441. are decommissioned.
  442. </li>
  443. </ul>
  444. <p>
  445. For command usage, see <a href="commands_manual.html#dfsadmin">dfsadmin command</a>.
  446. </p>
  447. </div>
  448. <a name="N100D4"></a><a name="Secondary+NameNode"></a>
  449. <h2 class="h3"> Secondary NameNode </h2>
  450. <div class="section">
  451. <p>
  452. The NameNode stores modifications to the file system as a log
  453. appended to a native file system file (<span class="codefrag">edits</span>).
  454. When a NameNode starts up, it reads HDFS state from an image
  455. file (<span class="codefrag">fsimage</span>) and then applies edits from the
  456. edits log file. It then writes new HDFS state to the <span class="codefrag">fsimage</span>
  457. and starts normal
  458. operation with an empty edits file. Since NameNode merges
  459. <span class="codefrag">fsimage</span> and <span class="codefrag">edits</span> files only during start up,
  460. the edits log file could get very large over time on a busy cluster.
  461. Another side effect of a larger edits file is that next
  462. restart of NameNode takes longer.
  463. </p>
  464. <p>
  465. The secondary NameNode merges the fsimage and the edits log files periodically
  466. and keeps edits log size within a limit. It is usually run on a
  467. different machine than the primary NameNode since its memory requirements
  468. are on the same order as the primary NameNode. The secondary
  469. NameNode is started by <span class="codefrag">bin/start-dfs.sh</span> on the nodes
  470. specified in <span class="codefrag">conf/masters</span> file.
  471. </p>
  472. <p>
  473. The start of the checkpoint process on the secondary NameNode is
  474. controlled by two configuration parameters.
  475. </p>
  476. <ul>
  477. <li>
  478. <span class="codefrag">fs.checkpoint.period</span>, set to 1 hour by default, specifies
  479. the maximum delay between two consecutive checkpoints, and
  480. </li>
  481. <li>
  482. <span class="codefrag">fs.checkpoint.size</span>, set to 64MB by default, defines the
  483. size of the edits log file that forces an urgent checkpoint even if
  484. the maximum checkpoint delay is not reached.
  485. </li>
  486. </ul>
  487. <p>
  488. The secondary NameNode stores the latest checkpoint in a
  489. directory which is structured the same way as the primary NameNode's
  490. directory. So that the check pointed image is always ready to be
  491. read by the primary NameNode if necessary.
  492. </p>
  493. <p>
  494. The latest checkpoint can be imported to the primary NameNode if
  495. all other copies of the image and the edits files are lost.
  496. In order to do that one should:
  497. </p>
  498. <ul>
  499. <li>
  500. Create an empty directory specified in the
  501. <span class="codefrag">dfs.name.dir</span> configuration variable;
  502. </li>
  503. <li>
  504. Specify the location of the checkpoint directory in the
  505. configuration variable <span class="codefrag">fs.checkpoint.dir</span>;
  506. </li>
  507. <li>
  508. and start the NameNode with <span class="codefrag">-importCheckpoint</span> option.
  509. </li>
  510. </ul>
  511. <p>
  512. The NameNode will upload the checkpoint from the
  513. <span class="codefrag">fs.checkpoint.dir</span> directory and then save it to the NameNode
  514. directory(s) set in <span class="codefrag">dfs.name.dir</span>.
  515. The NameNode will fail if a legal image is contained in
  516. <span class="codefrag">dfs.name.dir</span>.
  517. The NameNode verifies that the image in <span class="codefrag">fs.checkpoint.dir</span> is
  518. consistent, but does not modify it in any way.
  519. </p>
  520. <p>
  521. For command usage, see <a href="commands_manual.html#secondarynamenode"><span class="codefrag">secondarynamenode</span> command</a>.
  522. </p>
  523. </div>
  524. <a name="N1013B"></a><a name="Rebalancer"></a>
  525. <h2 class="h3"> Rebalancer </h2>
  526. <div class="section">
  527. <p>
  528. HDFS data might not always be be placed uniformly across the
  529. DataNode. One common reason is addition of new DataNodes to an
  530. existing cluster. While placing new blocks (data for a file is
  531. stored as a series of blocks), NameNode considers various
  532. parameters before choosing the DataNodes to receive these blocks.
  533. Some of the considerations are:
  534. </p>
  535. <ul>
  536. <li>
  537. Policy to keep one of the replicas of a block on the same node
  538. as the node that is writing the block.
  539. </li>
  540. <li>
  541. Need to spread different replicas of a block across the racks so
  542. that cluster can survive loss of whole rack.
  543. </li>
  544. <li>
  545. One of the replicas is usually placed on the same rack as the
  546. node writing to the file so that cross-rack network I/O is
  547. reduced.
  548. </li>
  549. <li>
  550. Spread HDFS data uniformly across the DataNodes in the cluster.
  551. </li>
  552. </ul>
  553. <p>
  554. Due to multiple competing considerations, data might not be
  555. uniformly placed across the DataNodes.
  556. HDFS provides a tool for administrators that analyzes block
  557. placement and rebalanaces data across the DataNode. A brief
  558. administrator's guide for rebalancer as a
  559. <a href="http://issues.apache.org/jira/secure/attachment/12368261/RebalanceDesign6.pdf">PDF</a>
  560. is attached to
  561. <a href="http://issues.apache.org/jira/browse/HADOOP-1652">HADOOP-1652</a>.
  562. </p>
  563. <p>
  564. For command usage, see <a href="commands_manual.html#balancer">balancer command</a>.
  565. </p>
  566. </div>
  567. <a name="N10166"></a><a name="Rack+Awareness"></a>
  568. <h2 class="h3"> Rack Awareness </h2>
  569. <div class="section">
  570. <p>
  571. Typically large Hadoop clusters are arranged in racks and
  572. network traffic between different nodes with in the same rack is
  573. much more desirable than network traffic across the racks. In
  574. addition NameNode tries to place replicas of block on
  575. multiple racks for improved fault tolerance. Hadoop lets the
  576. cluster administrators decide which rack a node belongs to
  577. through configuration variable <span class="codefrag">dfs.network.script</span>. When this
  578. script is configured, each node runs the script to determine its
  579. rack id. A default installation assumes all the nodes belong to
  580. the same rack. This feature and configuration is further described
  581. in <a href="http://issues.apache.org/jira/secure/attachment/12345251/Rack_aware_HDFS_proposal.pdf">PDF</a>
  582. attached to
  583. <a href="http://issues.apache.org/jira/browse/HADOOP-692">HADOOP-692</a>.
  584. </p>
  585. </div>
  586. <a name="N1017B"></a><a name="Safemode"></a>
  587. <h2 class="h3"> Safemode </h2>
  588. <div class="section">
  589. <p>
  590. During start up the NameNode loads the file system state from the
  591. fsimage and the edits log file. It then waits for DataNodes
  592. to report their blocks so that it does not prematurely start
  593. replicating the blocks though enough replicas already exist in the
  594. cluster. During this time NameNode stays in Safemode.
  595. Safemode
  596. for the NameNode is essentially a read-only mode for the HDFS cluster,
  597. where it does not allow any modifications to file system or blocks.
  598. Normally the NameNode leaves Safemode automatically after the DataNodes
  599. have reported that most file system blocks are available.
  600. If required, HDFS could be placed in Safemode explicitly
  601. using <span class="codefrag">'bin/hadoop dfsadmin -safemode'</span> command. NameNode front
  602. page shows whether Safemode is on or off. A more detailed
  603. description and configuration is maintained as JavaDoc for
  604. <a href="http://hadoop.apache.org/core/docs/current/api/org/apache/hadoop/dfs/NameNode.html#setSafeMode(org.apache.hadoop.dfs.FSConstants.SafeModeAction)"><span class="codefrag">setSafeMode()</span></a>.
  605. </p>
  606. </div>
  607. <a name="N1018D"></a><a name="fsck"></a>
  608. <h2 class="h3"> fsck </h2>
  609. <div class="section">
  610. <p>
  611. HDFS supports the <span class="codefrag">fsck</span> command to check for various
  612. inconsistencies.
  613. It it is designed for reporting problems with various
  614. files, for example, missing blocks for a file or under-replicated
  615. blocks. Unlike a traditional <span class="codefrag">fsck</span> utility for native file systems,
  616. this command does not correct the errors it detects. Normally NameNode
  617. automatically corrects most of the recoverable failures. By default
  618. <span class="codefrag">fsck</span> ignores open files but provides an option to select all files during reporting.
  619. The HDFS <span class="codefrag">fsck</span> command is not a
  620. Hadoop shell command. It can be run as '<span class="codefrag">bin/hadoop fsck</span>'.
  621. For command usage, see <a href="commands_manual.html#fsck"><span class="codefrag">fsck</span> command</a>.
  622. <span class="codefrag">fsck</span> can be run on the whole file system or on a subset of files.
  623. </p>
  624. </div>
  625. <a name="N101AF"></a><a name="Upgrade+and+Rollback"></a>
  626. <h2 class="h3"> Upgrade and Rollback </h2>
  627. <div class="section">
  628. <p>
  629. When Hadoop is upgraded on an existing cluster, as with any
  630. software upgrade, it is possible there are new bugs or
  631. incompatible changes that affect existing applications and were
  632. not discovered earlier. In any non-trivial HDFS installation, it
  633. is not an option to loose any data, let alone to restart HDFS from
  634. scratch. HDFS allows administrators to go back to earlier version
  635. of Hadoop and rollback the cluster to the state it was in
  636. before
  637. the upgrade. HDFS upgrade is described in more detail in
  638. <a href="http://wiki.apache.org/hadoop/Hadoop%20Upgrade">upgrade wiki</a>.
  639. HDFS can have one such backup at a time. Before upgrading,
  640. administrators need to remove existing backup using <span class="codefrag">bin/hadoop
  641. dfsadmin -finalizeUpgrade</span> command. The following
  642. briefly describes the typical upgrade procedure:
  643. </p>
  644. <ul>
  645. <li>
  646. Before upgrading Hadoop software,
  647. <em>finalize</em> if there an existing backup.
  648. <span class="codefrag">dfsadmin -upgradeProgress status</span>
  649. can tell if the cluster needs to be <em>finalized</em>.
  650. </li>
  651. <li>Stop the cluster and distribute new version of Hadoop.</li>
  652. <li>
  653. Run the new version with <span class="codefrag">-upgrade</span> option
  654. (<span class="codefrag">bin/start-dfs.sh -upgrade</span>).
  655. </li>
  656. <li>
  657. Most of the time, cluster works just fine. Once the new HDFS is
  658. considered working well (may be after a few days of operation),
  659. finalize the upgrade. Note that until the cluster is finalized,
  660. deleting the files that existed before the upgrade does not free
  661. up real disk space on the DataNodes.
  662. </li>
  663. <li>
  664. If there is a need to move back to the old version,
  665. <ul>
  666. <li> stop the cluster and distribute earlier version of Hadoop. </li>
  667. <li> start the cluster with rollback option.
  668. (<span class="codefrag">bin/start-dfs.h -rollback</span>).
  669. </li>
  670. </ul>
  671. </li>
  672. </ul>
  673. </div>
  674. <a name="N101ED"></a><a name="File+Permissions+and+Security"></a>
  675. <h2 class="h3"> File Permissions and Security </h2>
  676. <div class="section">
  677. <p>
  678. The file permissions are designed to be similar to file permissions on
  679. other familiar platforms like Linux. Currently, security is limited
  680. to simple file permissions. The user that starts NameNode is
  681. treated as the superuser for HDFS. Future versions of HDFS will
  682. support network authentication protocols like Kerberos for user
  683. authentication and encryption of data transfers. The details are discussed in the
  684. <a href="hdfs_permissions_guide.html">HDFS Admin Guide: Permissions</a>.
  685. </p>
  686. </div>
  687. <a name="N101FB"></a><a name="Scalability"></a>
  688. <h2 class="h3"> Scalability </h2>
  689. <div class="section">
  690. <p>
  691. Hadoop currently runs on clusters with thousands of nodes.
  692. <a href="http://wiki.apache.org/hadoop/PoweredBy">Powered By Hadoop</a>
  693. lists some of the organizations that deploy Hadoop on large
  694. clusters. HDFS has one NameNode for each cluster. Currently
  695. the total memory available on NameNode is the primary scalability
  696. limitation. On very large clusters, increasing average size of
  697. files stored in HDFS helps with increasing cluster size without
  698. increasing memory requirements on NameNode.
  699. The default configuration may not suite very large clustes.
  700. <a href="http://wiki.apache.org/hadoop/FAQ">Hadoop FAQ</a> page lists
  701. suggested configuration improvements for large Hadoop clusters.
  702. </p>
  703. </div>
  704. <a name="N1020D"></a><a name="Related+Documentation"></a>
  705. <h2 class="h3"> Related Documentation </h2>
  706. <div class="section">
  707. <p>
  708. This user guide is a good starting point for
  709. working with HDFS. While the user guide continues to improve,
  710. there is a large wealth of documentation about Hadoop and HDFS.
  711. The following list is a starting point for further exploration:
  712. </p>
  713. <ul>
  714. <li>
  715. <a href="http://hadoop.apache.org/">Hadoop Home Page</a>: The start page for everything Hadoop.
  716. </li>
  717. <li>
  718. <a href="http://wiki.apache.org/hadoop/FrontPage">Hadoop Wiki</a>
  719. : Front page for Hadoop Wiki documentation. Unlike this
  720. guide which is part of Hadoop source tree, Hadoop Wiki is
  721. regularly edited by Hadoop Community.
  722. </li>
  723. <li>
  724. <a href="http://wiki.apache.org/hadoop/FAQ">FAQ</a> from Hadoop Wiki.
  725. </li>
  726. <li>
  727. Hadoop <a href="http://hadoop.apache.org/core/docs/current/api/">
  728. JavaDoc API</a>.
  729. </li>
  730. <li>
  731. Hadoop User Mailing List :
  732. <a href="mailto:core-user@hadoop.apache.org">core-user[at]hadoop.apache.org</a>.
  733. </li>
  734. <li>
  735. Explore <span class="codefrag">conf/hadoop-default.xml</span>.
  736. It includes brief
  737. description of most of the configuration variables available.
  738. </li>
  739. <li>
  740. <a href="commands_manual.html">Hadoop Command Guide</a>: commands usage.
  741. </li>
  742. </ul>
  743. </div>
  744. </div>
  745. <!--+
  746. |end content
  747. +-->
  748. <div class="clearboth">&nbsp;</div>
  749. </div>
  750. <div id="footer">
  751. <!--+
  752. |start bottomstrip
  753. +-->
  754. <div class="lastmodified">
  755. <script type="text/javascript"><!--
  756. document.write("Last Published: " + document.lastModified);
  757. // --></script>
  758. </div>
  759. <div class="copyright">
  760. Copyright &copy;
  761. 2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
  762. </div>
  763. <!--+
  764. |end bottomstrip
  765. +-->
  766. </div>
  767. </body>
  768. </html>