{"id":15792,"date":"2022-10-06T21:11:09","date_gmt":"2022-10-06T13:11:09","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=15792"},"modified":"2022-10-06T21:11:38","modified_gmt":"2022-10-06T13:11:38","slug":"hdfs-concept","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/hdfs-concept.html","title":{"rendered":"HDFS\u6df1\u5165\u6d45\u6790"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nHadoop\u5206\u5e03\u5f0f\u6587\u4ef6\u7cfb\u7edf(HDFS)\u88ab\u8bbe\u8ba1\u6210\u9002\u5408\u8fd0\u884c\u5728\u901a\u7528\u786c\u4ef6(commodity hardware)\u4e0a\u7684\u5206\u5e03\u5f0f\u6587\u4ef6\u7cfb\u7edf\u3002\u5b83\u548c\u73b0\u6709\u7684\u5206\u5e03\u5f0f\u6587\u4ef6\u7cfb\u7edf\u6709\u5f88\u591a\u5171\u540c\u70b9\u3002\u4f46\u540c\u65f6\uff0c\u5b83\u548c\u5176\u4ed6\u7684\u5206\u5e03\u5f0f\u6587\u4ef6\u7cfb\u7edf\u7684\u533a\u522b\u4e5f\u662f\u5f88\u660e\u663e\u7684\u3002HDFS\u662f\u4e00\u4e2a\u9ad8\u5ea6\u5bb9\u9519\u6027\u7684\u7cfb\u7edf\uff0c\u9002\u5408\u90e8\u7f72\u5728\u5ec9\u4ef7\u7684\u673a\u5668\u4e0a\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4e00\u3001HDFS\u7684\u80cc\u666f\u4ecb\u7ecd<\/strong><\/div>\n

\u968f\u7740\u6570\u636e\u91cf\u8d8a\u6765\u8d8a\u5927\uff0c \u5728 \u4e00\u4e2a\u64cd\u4f5c\u7cfb\u7edf\u7ba1\u8f96\u7684\u8303\u56f4\u5b58\u4e0d\u4e0b\u4e86\uff0c \u90a3\u4e48\u5c31 \u5206\u914d\u5230\u66f4\u591a\u7684\u64cd\u4f5c\u7cfb\u7edf\u7ba1\u7406\u7684\u78c1\u76d8\u4e2d\uff0c \u4f46\u662f\u4e0d\u65b9\u4fbf\u7ba1\u7406\u548c\u7ef4\u62a4\uff0c\u8feb\u5207\u9700\u8981\u4e00\u79cd\u7cfb\u7edf\u6765\u7ba1\u7406\u591a\u53f0\u673a\u5668\u4e0a\u7684\u6587\u4ef6\uff0c\u8fd9\u5c31\u662f\u5206\u5e03\u5f0f\u6587\u4ef6\u7ba1\u7406\u7cfb\u7edf\u3002<\/p>\n

\u5b66\u672f\u4e00\u70b9\u7684\u5b9a\u4e49\u5c31\u662f\uff1a \u5206\u5e03\u5f0f\u6587\u4ef6\u7cfb\u7edf\u662f\u4e00\u79cd\u5141\u8bb8\u6587\u4ef6\u901a\u8fc7\u7f51\u7edc\u5728\u591a\u53f0\u4e3b\u673a\u4e0a\u5206\u4eab\u7684 \u6587\u4ef6\u7684\u7cfb\u7edf\uff0c\u53ef\u8ba9\u591a\u673a\u5668\u4e0a\u7684\u591a\u7528\u6237\u5206\u4eab\u6587\u4ef6\u548c\u5b58\u50a8\u7a7a\u95f4\u3002\u5206\u5e03\u5f0f\u6587\u4ef6\u7ba1\u7406\u7cfb\u7edf\u5f88\u591a\uff0chdfsHDFS \u53ea\u662f\u5176\u4e2d\u4e00\u79cd\u3002\u9002\u7528\u4e8e\u4e00\u6b21\u5199\u5165\u3001\u591a\u6b21\u67e5\u8be2\u7684\u60c5\u51b5\uff0c\u4e0d\u652f\u6301\u5e76\u53d1\u5199\u60c5\u51b5\uff0c\u5c0f\u6587\u4ef6\u4e0d\u5408\u9002\u3002\u56e0\u4e3a\u5c0f\u6587\u4ef6\u4e5f\u5360\u7528\u4e00\u4e2a\u5757\uff0c\u5c0f\u6587\u4ef6\u8d8a\u591a\uff081000\u4e2a1k\u6587\u4ef6\uff09\u5757\u8d8a \u591a\uff0cNameNode\u538b\u529b\u8d8a\u5927\u3002<\/p>\n

\u4e8c\u3001 HDFS\u7684\u57fa\u672c\u6982\u5ff5<\/strong><\/div>\n

\u6211\u4eec\u901a\u8fc7 hadoop shell\u4e0a\u4f20\u7684\u6587\u4ef6\u662f\u5b58\u653e\u5728 DataNode\u7684block\u4e2d\uff0c \u901a\u8fc7 linux shell\u662f\u770b \u4e0d\u5230\u6587\u4ef6\u7684\uff0c\u53ea\u80fd\u770b\u5230block\u3002 \u53ef\u4ee5\u4e00\u53e5\u8bdd\u63cf\u8ff0HDFS\uff1a \u628a\u5ba2\u6237\u7aef\u7684\u5927\u6587\u4ef6\u5b58\u653e\u5728\u5f88\u591a\u8282\u70b9\u7684\u6570\u636e\u5757\u4e2d<\/strong> \u3002\u5728\u8fd9\u91cc\uff0c\u51fa\u73b0\u4e86\u4e09\u4e2a\u5173\u952e\u8bcd\uff1a\u6587\u4ef6\u3001\u8282\u70b9\u3001\u6570\u636e\u5757\u3002HDFS\u5c31\u662f\u56f4\u7ed5\u7740\u8fd9\u4e09\u4e2a\u5173\u952e\u8bcd\u8bbe\u8ba1\u7684\uff0c\u6211\u4eec\u5728\u5b66\u4e60\u7684\u65f6\u5019\u4e5f\u8981\u7d27\u6293\u4f4f\u8fd9\u4e09\u4e2a\u5173\u952e\u8bcd\u6765\u5b66\u4e60\u3002<\/p>\n

\u4e09\u3001 HDFS\u7684\u57fa\u672c\u7ed3\u6784\u4e4b NameNode<\/strong><\/div>\n
1. \u4f5c\u7528<\/span><\/div>\n

NameNode\u7684\u4f5c\u7528\u662f \u7ba1\u7406\u6587\u4ef6\u76ee\u5f55\u7ed3\u6784\uff0c\u63a5\u53d7\u7528\u6237\u7684\u64cd\u4f5c\u8bf7\u6c42,\u662f\u7ba1\u7406\u6570\u636e\u8282\u70b9\u7684\u3002\u540d\u5b57\u8282\u70b9\u7ef4\u62a4\u4e24\u5957\u6570\u636e\uff0c \u4e00\u5957 \u662f\u6587\u4ef6 \u76ee\u5f55\u4e0e\u6570\u636e\u5757\u4e4b\u95f4\u7684\u5173\u7cfb \uff0c \u53e6\u4e00\u5957 \u662f \u6570\u636e\u5757\u4e0e\u8282\u70b9\u4e4b\u95f4\u7684\u5173\u7cfb \u3002 \u524d\u4e00\u5957 \u6570\u636e\u662f \u9759\u6001\u7684 \uff0c\u662f\u5b58\u653e\u5728\u78c1\u76d8\u4e0a\u7684\uff0c \u901a\u8fc7fsimage\u548cedits\u6587\u4ef6\u6765\u7ef4\u62a4 \uff1b \u540e\u4e00\u5957 \u6570\u636e\u662f \u52a8\u6001\u7684 \uff0c\u4e0d\u6301\u4e45\u653e\u5230\u5230\u78c1\u76d8\u7684\uff0c\u6bcf\u5f53\u96c6\u7fa4\u542f\u52a8\u7684\u65f6\u5019\uff0c\u4f1a\u81ea\u52a8\u5efa\u7acb\u8fd9\u4e9b\u4fe1\u606f\uff0c\u6240\u4ee5\u4e00\u822c\u90fd\u653e\u5728\u5185\u5b58\u4e2d\u3002<\/p>\n

\u6240\u4ee5\u4ed6\u662f\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u7684 \u7ba1\u7406\u8282\u70b9\u3002 \u5b83\u7ef4\u62a4\u7740\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u7684 \u6587\u4ef6\u76ee\u5f55\u6811\uff0c\u6587\u4ef6\/\u76ee\u5f55\u7684 \u5143\u4fe1\u606f\u548c\u6bcf\u4e2a\u6587\u4ef6\u5bf9\u5e94\u7684 \u6570\u636e\u5757\u5217\u8868\u3002\u63a5\u6536\u7528\u6237\u7684\u64cd\u4f5c\u8bf7\u6c42 \u3002<\/p>\n

\u6587\u4ef6\u5305\u62ec\uff1a<\/p>\n

\u2460 fsimage \uff08\u6587\u4ef6\u7cfb\u7edf\u955c\u50cf\uff09:\u5143\u6570\u636e\u955c\u50cf\u6587\u4ef6\u3002\u5b58\u50a8\u67d0\u4e00\u65f6\u6bb5NameNode\u5185\u5b58 \u5143\u6570\u636e\u4fe1\u606f\u3002<\/p>\n

\u2461 edits: \u64cd\u4f5c\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n

\u2462 fstime: \u4fdd\u5b58\u6700\u8fd1\u4e00\u6b21checkpoint\u7684\u65f6\u95f4<\/p>\n

\u4ee5\u4e0a\u8fd9\u4e9b\u6587\u4ef6\u662f\u4fdd\u5b58\u5728linux\u7684\u6587\u4ef6\u7cfb\u7edf\u4e2d<\/p>\n

2. \u7279\u70b9<\/strong><\/span><\/div>\n

<1>\u662f\u4e00\u79cd\u5141\u8bb8\u6587\u4ef6 \u901a\u8fc7\u7f51\u7edc\u5728\u591a\u53f0\u4e3b\u673a\u4e0a\u5206\u4eab\u7684\u6587\u4ef6\u7cfb\u7edf\uff0c\u53ef\u8ba9\u591a\u673a\u5668\u4e0a\u7684\u591a\u7528\u6237\u5206\u4eab\u6587\u4ef6\u548c\u5b58\u50a8\u7a7a\u95f4\u3002<\/p>\n

<2>\u901a\u900f\u6027\u3002\u8ba9\u5b9e\u9645\u4e0a\u662f\u901a\u8fc7\u7f51\u7edc\u6765\u8bbf\u95ee\u6587\u4ef6\u7684\u52a8\u4f5c\uff0c\u7531\u7a0b\u5e8f\u4e0e\u7528\u6237\u770b\u6765\uff0c\u5c31\u50cf\u662f\u8bbf\u95ee\u672c\u5730\u7684\u78c1\u76d8\u4e00\u822c\u3002<\/p>\n

<3>\u5bb9\u9519\u3002\u5373\u4f7f\u7cfb\u7edf\u4e2d\u6709\u67d0\u4e9b\u8282\u70b9\u8131\u673a\uff0c\u6574\u4f53\u6765\u8bf4\u7cfb\u7edf\u4ecd\u7136\u53ef\u4ee5\u6301\u7eed\u8fd0\u4f5c\u800c\u4e0d\u4f1a\u6709\u6570\u636e\u635f\u5931\u3002<\/p>\n

<4>\u9002\u7528\u4e8e \u4e00\u6b21\u5199\u5165\u3001 \u591a\u6b21\u67e5\u8be2\u7684\u60c5\u51b5\uff0c\u4e0d\u652f\u6301\u5e76\u53d1\u5199\u60c5\u51b5\uff0c\u5c0f\u6587\u4ef6\u4e0d\u5408\u9002<\/p>\n

3. \u76ee\u5f55\u7ed3\u6784<\/strong><\/span><\/div>\n

<1>\u65e2\u7136NameNode\u7ef4\u62a4\u8fd9\u4e48\u591a\u7684\u4fe1\u606f,\u90a3\u4e48 \u8fd9\u4e9b\u4fe1\u606f\u90fd\u5b58\u653e\u5728\u54ea\u91cc\u5462?<\/p>\n

\u5728hadoop\u6e90\u4ee3\u7801\u4e2d\u6709\u4e2a\u6587\u4ef6\u53eb\u505a hdfs-default.xml<\/p>\n

\"3.1\"<\/p>\n

<2>\u6253\u5f00\u8fd9\u4e2a\u6587\u4ef6<\/p>\n

\u5728\u7b2c149\u884c\u548c\u7b2c158\u884c\uff0c\u6709\u4e24\u4e2a\u914d\u7f6e\u4fe1\u606f\uff0c\u4e00\u4e2a\u662f dfs.name.dir\uff0c \u53e6\u4e00\u4e2a\u662fdfs.name.edits.dir \u3002\u8fd9\u4e24\u4e2a\u6587\u4ef6\u8868\u793a\u7684\u662f NameNode\u7684\u6838\u5fc3\u6587\u4ef6fsimage\u548cedits\u7684\u5b58\u653e\u4f4d\u7f6e<\/strong>\uff0c\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n

\"3.2\"<\/p>\n

\u5728\u5bf9\u5e94\u914d\u7f6e\u7684value\u503c\u6709 ${}\uff0c\u8fd9\u662f \u53d8\u91cf\u7684\u8868\u793a\u65b9\u5f0f\uff0cER\u8868\u8fbe\u5f0f \uff0c\u5728\u7a0b\u5e8f\u8bfb\u53d6\u6587\u4ef6\u65f6\uff0c\u4f1a\u628a\u53d8\u91cf\u7684\u503c\u8bfb\u53d6\u51fa\u6765\u3002\u90a3\u4e48\uff0c\u7b2c150\u884c\u7684\u53d8\u91cf hadoop.tmp.dir\u7684\u503c (\u5373hadoop\u4e34\u65f6\u5b58\u50a8\u8def\u5f84)\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

\"3.3\"<\/p>\n

\u4f46\u662f\u5728\u6211\u4eec\u5728\u4e0a\u4e00\u7ae0\u7684\u914d\u7f6e\u6587\u4ef6 core-site.xml\u4e2d\uff0c \u914d\u7f6e\u7684\u503c\u662f\/usr\/local\/hadoop\/tmp\u3002<\/p>\n

<3>\u6211\u4eec\u53ef\u4ee5\u8fdb\u5165linux\u6587\u4ef6\u7cfb\u7edf<\/p>\n

\u6267\u884c\u547d\u4ee4 cd \/usr\/local\/hadoop\/conf,more core-site.xml \u67e5\u770b\uff0c\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n

\"3.4\"<\/p>\n

\u53ef\u4ee5\u770b\u51fa\uff0c\u8fd9 \u4e24\u4e2a\u6587\u4ef6\u7684\u5b58\u50a8\u4f4d\u7f6e \u662f\u5728linux\u6587\u4ef6\u7cfb\u7edf\u7684\/usr\/local\/hadoop\/tmp\/dfs\/name\u76ee\u5f55\u4e0b\u3002<\/p>\n

<4>\u6211\u4eec\u8fdb\u5165\u8fd9\u4e2a\u76ee\u5f55<\/p>\n

\u67e5\u770b\u8fd9\u4e2a\u76ee\u5f55\u7684\u5185\u5bb9\uff0c\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n

\"3.5\"<\/p>\n

\u4ece\u56fe\u4e2d\u53ef\u77e5\uff0cNameNode\u7684\u6838\u5fc3\u6587\u4ef6 fsimage\u548c edits\u7684\u5b58\u653e\u5728current\u76ee\u5f55\u4e0b\uff0c \u4e0e\u6b64\u540c\u65f6 name\u76ee\u5f55\u4e0b\u6709\u4e00\u4e2a\u6587\u4ef6 in_use.lock \u800c\u67e5\u770b\u5176\u5185\u5bb9\u7684\u65f6\u5019\u53d1\u73b0\uff0c\u5185\u5bb9\u4e3a\u7a7a\uff0c\u4e5f\u5c31\u662f\u8bf4\u53ea\u80fd\u6709\u4e00\u4e2aNamenode\u8fdb\u7a0b\u80fd\u591f\u8bbf\u95ee\u8be5\u76ee\u5f55\uff0c\u8bfb\u8005\u53ef\u4ee5\u81ea\u5df1\u8bd5\u4e00\u4e0b\uff0c\u5f53\u6ca1\u6709\u5f00\u542fhadoop\u65f6\uff0c\u8be5\u76ee\u5f55\u4e0b\u662f\u6ca1\u6709\u6587\u4ef6 in_use.lock \u7684\uff0c\u5f53hadoop\u542f\u52a8\u4ee5\u540e\u624d\u4f1a\u751f\u6210\u8be5\u6587\u4ef6\u3002<\/p>\n

<5>\u6587\u4ef6 fsimage \u662fNameNode\u7684\u6838\u5fc3\u6587\u4ef6<\/p>\n

\u8fd9\u4e2a\u6587\u4ef6\u975e\u5e38\u91cd\u8981\uff0c\u4e22\u5931\u7684\u8bdd\uff0cNamenode\u65e0\u6cd5\u4f7f\u7528\uff0c \u90a3\u4e48\u5982\u4f55\u9632\u6b62\u8be5\u6587\u4ef6\u4e22\u5931\u800c\u9020\u6210\u4e0d\u826f\u540e\u679c\u5462\u3002\u6211\u53ef\u4ee5\u4e0b\u518d\u6b21\u770b\u4e00\u4e0bhdfs-default.xml\u4e2d\u7684\u4e00\u6bb5\u4ee3\u7801\uff0c\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n

\"3.6\"<\/p>\n

\u7531\u5176\u4e2d\u7684\u63cf\u8ff0\u53ef\u77e5\uff0c\u8be5\u53d8\u91cf\uff0c\u51b3\u5b9aDFS NameNode \u7684NameTable(fsimage)\u5e94\u8be5\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u7684\u5b58\u50a8\u4f4d\u7f6e\u3002\u5982\u679c\u8fd9\u662f \u4e00\u4e2a\u7528\u9017\u53f7\u5206\u9694\u7684\u5217\u8868\u7684\u76ee\u5f55\uff0c\u90a3\u4e48nametable\uff0c\u4f1a\u88ab\u590d\u590d\u5236\u5230\u6240\u6709\u7684\u76ee\u5f55\u4e2d,\u6765\u5197\u4f59\uff08\u5907\u4efd\u6765\u4fdd\u8bc1\u6570\u636e\u7684\u5b89\u5168\u6027\uff09\u3002 \u5982${hadoop.tmp.dir}\/dfs\/name\uff0c~\/name2\uff0c~\/name3\uff0c~\/name4\u3002\u90a3\u4e48fsimage\u4f1a\u5206\u522b\u590d\u5236\u5230~\/name1\uff0c~\/name2\uff0c~\/name3\uff0c~\/name4 \u76ee\u5f55\u4e2d\u3002\u6240\u4ee5\u8fd9\u4e9b\u76ee\u5f55\u4e00\u822c\u662f\u5728\u4e0d\u540c\u7684\u673a\u5668,\u4e0d\u540c\u7684\u78c1\u76d8\uff0c\u4e0d\u540c\u7684\u6587\u4ef6\u5939\u4e0a\uff0c\u603b\u4e4b\u8d8a\u5206\u6563\u8d8a\u597d\uff0c\u8fd9\u6837\u80fd\u4fdd\u8bc1\u6570\u636e\u7684\u5b89\u5168\u6027\u3002\u6709\u4eba\u4f1a\u95ee\u5728\u591a\u53f0\u673a\u4e0a\u600e\u4e48\u5b9e\u73b0\u5462\uff1f\u5176\u5b9e\u5728Linux\u4e2d\u6709nfs\u6587\u4ef6\u5171\u4eab\u7cfb\u7edf\uff0c\u8fd9\u91cc\u4e0d\u505a\u8be6\u8ff0\u3002<\/p>\n

<6>\u770b\u4e00\u4e0bedits\u7684\u63cf\u8ff0<\/p>\n

\u67e5\u770b\u4e00\u4e0b hdfs-default.xml \u4e2d\u7684\u4e00\u6bb5\u4ee3\u7801\uff0c\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n

\"3.7\"<\/p>\n

\u7531\u5176\u4e2d\u7684\u63cf\u8ff0\u53ef\u77e5\uff0c\u8be5\u53d8\u91cf\uff0c\u51b3\u5b9aDFSNameNode\u7684 \u5b58\u50a8\u4e8b\u52a1\u6587\u4ef6\uff08edits\uff09\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u7684\u4f4d\u7f6e\u3002 \u5982\u679c\u8fd9\u662f\u4e00\u4e2a\u4ee5\u9017\u53f7\u5206\u9694\u7684\u76ee\u5f55\u5217\u8868\uff0c\u90a3\u4e48\uff0c\u4e8b\u52a1\u6587\u4ef6\u4f1a\u88ab\u590d\u5236\u6240\u6709\u7684\u76ee\u5f55\u4e2d,\u6765\u5197\u4f59\u3002\u9ed8\u8ba4\u503c\u662fdfs.name.dir\u4e00\u6837\u3002\uff08edit\u4fdd\u5b58\u4e8b\u52a1\u8fc7\u7a0b\uff09<\/p>\n

\u56db\u3001 HDFS\u7684\u57fa\u672c\u7ed3\u6784\u4e4b DataNode<\/strong><\/div>\n
1.\u4f5c\u7528<\/strong><\/span><\/div>\n

DataNode\u7684\u4f5c\u7528\u662fHDFS\u4e2d\u771f\u6b63\u5b58\u50a8\u6570\u636e\u7684\u3002<\/p>\n

2. block<\/strong><\/span><\/div>\n

<1>\u5982\u679c\u4e00\u4e2a\u6587\u4ef6\u975e\u5e38\u5927\uff0c\u6bd4\u5982100GB\uff0c\u90a3\u4e48\u600e\u4e48\u5b58\u50a8\u5728DataNode\u4e2d\u5462\uff1fDataNode\u5728\u5b58\u50a8\u6570\u636e\u7684\u65f6\u5019\u662f\u6309\u7167block\u4e3a\u5355\u4f4d\u8bfb\u5199\u6570\u636e\u7684\u3002block\u662fhdfs\u8bfb\u5199\u6570\u636e\u7684\u57fa\u672c\u5355\u4f4d\u3002<\/p>\n

<2>\u5047\u8bbe\u6587\u4ef6\u5927\u5c0f\u662f100GB\uff0c\u4ece\u5b57\u8282\u4f4d\u7f6e0\u5f00\u59cb\uff0c\u6bcf64MB\u5b57\u8282\u5212\u5206\u4e3a\u4e00\u4e2ablock\uff0c\u4f9d\u6b64\u7c7b\u63a8\uff0c\u53ef\u4ee5\u5212\u5206\u51fa\u5f88\u591a\u7684block\u3002\u6bcf\u4e2ablock\u5c31\u662f64MB\u5927\u5c0f\u3002<\/p>\n

2.1 \u6211\u4eec\u770b\u4e00\u4e0b org.apache.hadoop.hdfs.protocol.Block\u7c7b<\/p>\n

\u8fd9\u91cc\u9762\u7684\u5c5e\u6027\u6709\u4ee5\u4e0b\u51e0\u4e2a\uff0c\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

\"4.1\"<\/p>\n

\u7531\u4e0a\u56fe\u53ef\u77e5\uff0c\u7c7b\u4e2d\u7684\u5c5e\u6027\u6ca1\u6709\u4e00\u4e2a\u662f\u53ef\u4ee5\u5b58\u50a8\u6570\u636e\u7684\u3002 \u6240\u4ee5block\u672c\u8d28\u4e0a\u662f\u4e00\u4e2a \u903b\u8f91\u6982\u5ff5\uff0c\u610f\u5473\u7740block\u91cc\u9762\u4e0d\u4f1a\u771f\u6b63\u7684\u5b58\u50a8\u6570\u636e\uff0c\u53ea\u662f\u5212\u5206\u6587\u4ef6\u7684\u3002<\/p>\n

2.2 \u4e3a\u4ec0\u4e48\u4e00\u5b9a\u8981\u5212\u5206\u4e3a64MB\u5927\u5c0f\u5462\uff1f<\/p>\n

\u56e0\u4e3a\u8fd9\u662f\u5728\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u7684\uff0c\u6211\u4eec\u67e5\u770b core-default.xml \u6587\u4ef6\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

\"4.2\"<\/p>\n

\u4e0a\u56fe\u4e2d\u7684\u53c2\u6570ds.block.name\u6307\u7684\u5c31\u662fblock\u7684\u5927\u5c0f\uff0c\u503c\u662f67 108 864\u5b57\u8282\uff0c\u53ef\u4ee5\u6362\u7b97\u4e3a64MB\u3002\u5982\u679c\u6211\u4eec\u4e0d\u5e0c\u671b\u4f7f\u752864MB\u5927\u5c0f\uff0c\u53ef\u4ee5\u5728core-site.xml\u4e2d\u8986\u76d6\u8be5\u503c\u3002\u6ce8\u610f\u5355\u4f4d\u662f\u5b57\u8282\u3002<\/p>\n

2.3 \u526f\u672c<\/p>\n

<1>\u526f\u672c\u5c31\u662f\u5907\u4efd\uff0c\u76ee\u7684\u5f53\u65f6\u662f\u4e3a\u4e86 \u5b89\u5168\u3002 \u6b63\u662f\u56e0\u4e3a\u96c6\u7fa4\u73af\u5883\u7684 \u4e0d\u53ef\u9760 \uff0c\u6240\u4ee5\u624d\u4f7f\u7528\u526f\u672c\u673a\u5236\u6765\u4fdd\u8bc1\u6570\u636e\u7684 \u5b89\u5168\u6027 \u3002<\/p>\n

<2>\u526f\u672c\u7684\u7f3a\u70b9\u5c31\u662f\u4f1a\u5360\u7528\u5927\u91cf\u7684\u5b58\u50a8\u7a7a\u95f4\u3002\u526f\u672c\u8d8a\u591a\uff0c\u5360\u7528\u7684\u7a7a\u95f4\u8d8a\u591a\u3002\u76f8\u6bd4\u6570\u636e\u4e22\u5931\u7684\u98ce\u9669\uff0c\u5b58\u50a8\u7a7a\u95f4\u7684\u82b1\u8d39\u8fd8\u662f\u503c\u5f97\u7684\u3002<\/p>\n

<3>\u90a3\u4e48\uff0c\u4e00\u4e2a\u6587\u4ef6\u6709\u51e0\u4e2a\u526f\u672c\u5408\u9002\u5462\uff1f\u6211\u4eec\u67e5\u770bhdfs-default.xml\u6587\u4ef6\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

\"4.3\"<\/p>\n

\u4ece\u56fe4.3\u4e2d\u53ef\u4ee5\u770b\u5230\uff0c\u9ed8\u8ba4\u7684\u526f\u672c\u6570\u91cf\u662f3\u3002\u610f\u5473\u7740HDFS\u4e2d\u7684\u6bcf\u4e2a\u6570\u636e\u5757\u90fd\u67093\u4efd\u3002\u5f53\u7136\uff0c\u6bcf\u4e00\u4efd\u80af\u5b9a\u4f1a\u5c3d\u529b\u5206\u914d\u5728\u4e0d\u540c\u7684DataNode\u670d\u52a1\u5668\u4e2d\u3002\u8bd5\u60f3\uff1a\u5982\u679c\u5907\u4efd\u76843\u4efd\u6570\u636e\u90fd\u5728\u540c\u4e00\u53f0\u670d\u52a1\u5668\u4e0a\uff0c\u90a3\u4e48\u8fd9\u53f0\u670d\u52a1\u5668\u505c\u673a\u4e86\uff0c\u662f\u4e0d\u662f\u6240\u6709\u7684\u6570\u636e\u90fd\u4e22\u4e86\u554a\uff1f<\/p>\n

3. \u76ee\u5f55\u7ed3\u6784<\/strong><\/span><\/div>\n

3.1 DataNode\u662f\u6309block\u6765\u5212\u5206\u6587\u4ef6\u7684<\/p>\n

\u90a3\u4e48\u5212\u5206\u540e\u7684\u6587\u4ef6\u5230\u5e95\u5b58\u653e\u5728\u54ea\u91cc\u54ea\uff1f\u6211\u4eec\u67e5\u770b\u6587\u4ef6core-default.xml\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

\"4.4\"<\/p>\n

\u53c2\u6570 dfs.data.dir\u7684\u503c\u5c31\u662f block\u5b58\u653e\u5728linux\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4f4d\u7f6e\u3002\u53d8\u91cf hadoop.tmp.dir\u7684\u503c \u524d\u9762\u5df2\u7ecf\u4ecb\u7ecd\u4e86\uff0c\u662f \/usr\/local\/hadoop\/tmp \uff0c\u90a3\u4e48 dfs.data.dir \u7684\u5b8c\u6574\u8def\u5f84\u662f\/usr\/local\/hadoop\/tmp\/dfs\/data\u3002 \u901a\u8fc7linux\u547d\u4ee4\u67e5\u770b\uff0c\u7ed3\u679c\u5982\u56fe4.5\u6240\u793a\u3002<\/p>\n

3.2 \u4e0a\u4f20\u4e00\u4e2a\u6587\u4ef6<\/p>\n

\u6211\u4eec\u9996\u5148\u70b9\u51fbPieTTY\u6253\u5f00\u53e6\u4e00\u4e2aLinux\u7ec8\u7aef\uff0c\u4e0a\u4f20\u4e00\u4e2a\u6587\u4ef6 jdk-6u24-linux-i586.bin\uff0c\u6587\u4ef6\u5927\u5c0f\u4e3a 84927175k\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

\"4.5\"<\/p>\n

\u7136\u540e\u6211\u4eec\u53ef\u4ee5\u5728\u539f\u6765\u7ec8\u7aef\uff0c\u67e5\u770b\u4e0a\u4f20\u6587\u4ef6\uff0c\u5c31\u662f\u5728\u8be5Linux\u6587\u4ef6\u7cfb\u7edf\u7684\/usr\/local\/hadoop\/tmp\/dfs\/data\u76ee\u5f55\u4e0b\uff0c \u5982\u4e0b\u56fe\u6240\u793a<\/p>\n

\"4.6\"<\/p>\n

\u4e0a\u56fe\u4e2d\u4ee5 \u201cblk_\u201d\u5f00\u5934\u7684\u6587\u4ef6\u5c31\u662f \u5b58\u50a8\u6570\u636e\u7684block\u3002\u8fd9\u91cc\u7684\u547d\u540d\u662f\u6709\u89c4\u5f8b\u7684\uff0c\u9664\u4e86block\u6587\u4ef6\u5916\uff0c\u8fd8\u6709\u540e \u7f00\u662f\u201cmeta\u201d\u7684\u6587\u4ef6 \uff0c\u8fd9\u662fblock\u7684\u6e90\u6570\u636e\u6587\u4ef6\uff0c\u5b58\u653e\u4e00\u4e9b\u5143\u6570\u636e\u4fe1\u606f\u3002\u56e0\u6b64\uff0c\u4e0a\u56fe\u4e2d\u53ea\u67092\u4e2ablock\u6587\u4ef6\u3002<\/p>\n

\u6ce8\u610f\uff1a\u6211\u4eec\u4ecelinux<\/strong> \u78c1\u76d8\u4e0a\u4f20\u4e00\u4e2a\u5b8c\u6574\u7684\u6587\u4ef6\u5230hdfs<\/strong> \u4e2d\uff0c\u8fd9\u4e2a\u6587\u4ef6\u5728linux<\/strong> \u662f\u53ef\u4ee5\u770b\u5230\u7684\uff0c\u4f46\u662f\u4e0a\u4f20\u5230hdfs<\/strong> \u540e\uff0c\u5c31\u4e0d\u4f1a\u6709\u4e00\u4e2a\u5bf9\u5e94\u7684\u6587\u4ef6\u5b58\u5728\uff0c\u800c\u662f\u88ab\u5212\u5206\u6210\u5f88\u591a\u7684block<\/strong> \u5b58\u5728\u7684\u3002\u800c\u4e14\u7531\u4e8e\u6211\u4eec\u7684hadoop\u5b89\u88c5\u65b9\u5f0f\u662f \u4f2a\u5206\u5e03\u5b89\u88c5 \uff0c\u53ea\u6709\u4e00\u4e2a\u8282\u70b9\uff0cDataNode\u548cNameNode\u90fd\u5728\u8fd9\u4e00\u4e2a\u8282\u70b9\u4e0a\uff0c\u6240\u4ee5\u4e0a\u4f20\u7684block\u5757\u6700\u7ec8\u8fd8\u662f\u5728\u8be5Linux\u7cfb\u7edf\u4e2d\u3002<\/p>\n

\u4e94\u3001 HDFS\u7684\u57fa\u672c\u7ed3\u6784\u4e4b <\/strong>SecondaryNode<\/strong><\/div>\n

HA\u7684\u4e00\u4e2a\u89e3\u51b3\u65b9\u6848\u3002\u4f46\u4e0d\u652f\u6301\u70ed\u5907\u3002\u914d\u7f6e\u5373\u53ef\u3002\u7531\u4e8e\u6570\u636e\u64cd\u4f5c\u8d8a\u591aedits\u6587\u4ef6\u81a8\u80c0\u8d8a\u5927\uff0c\u4f46\u4e0d\u80fd\u8ba9\u4ed6\u65e0\u9650\u7684\u81a8\u80c0\u4e0b\u53bb\uff0c\u6240\u4ee5\u8981\u628a\u65e5\u5fd7\u8fc7\u7a0b\u8f6c\u6362\u51fa\u6765 \u653e\u5230fsimage\u4e2d\u3002\u7531\u4e8eNameNode\u8981\u63a5\u53d7\u7528\u6237\u7684\u64cd\u4f5c\u8bf7\u6c42\uff0c\u5fc5\u987b\u80fd\u591f\u5feb\u901f\u54cd\u5e94\u7528\u6237\u8bf7\u6c42\uff0c\u4e3a\u4e86\u4fdd\u8bc1NameNode\u7684\u5feb\u901f\u54cd\u5e94\u7ed9\u7528\u6237\uff0c\u6240\u4ee5\u5c06\u6b64\u9879\u5de5 \u4f5c\u4ea4\u7ed9\u4e86 SecondaryNode \uff0c\u6240\u4ee5\u4ed6\u4e5f\u5907\u4efd\u4e00\u90e8\u5206fsimage\u7684\u4e00\u90e8\u5206\u5185\u5bb9\u3002<\/p>\n

\u6267\u884c\u8fc7\u7a0b\uff1a\u4eceNameNode\u4e0a \u4e0b\u8f7d\u5143\u6570\u636e\u4fe1\u606f\uff08fsimage,edits\uff09\uff0c\u7136\u540e\u628a\u4e8c\u8005\u5408\u5e76\uff0c\u751f\u6210\u65b0\u7684fsimage\uff0c\u5728\u672c\u5730\u4fdd\u5b58\uff0c\u5e76\u5c06\u5176\u63a8\u9001\u5230NameNode\uff0c\u540c\u65f6\u91cd\u7f6eNameNode\u7684edits.\u9ed8\u8ba4\u5728\u5b89\u88c5\u5728NameNode\u8282\u70b9\u4e0a\uff0c\u4f46\u8fd9\u6837...\u4e0d\u5b89\u5168\uff01<\/p>\n

\u5408\u5e76\u539f\u7406 \u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

\"5.1\"<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.thebigdata.cn\/Hadoop\/11962.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/hdfs-concept.html<\/a>\u7f16\u8f91\uff1a\u6768\u9e4f\u98de\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb Hadoop\u5206\u5e03\u5f0f\u6587\u4ef6\u7cfb\u7edf(HDFS)\u88ab\u8bbe\u8ba1\u6210\u9002\u5408\u8fd0\u884c\u5728\u901a\u7528\u786c\u4ef6(commodity hardware) […]<\/p>\n","protected":false},"author":63,"featured_media":6695,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-15792","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/15792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=15792"}],"version-history":[{"count":19,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/15792\/revisions"}],"predecessor-version":[{"id":254321,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/15792\/revisions\/254321"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/6695"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=15792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=15792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=15792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}