1.HDFSçº å ç
HDFSçº å ç
å¯æ¬æ¯æè´µç--å¨HDFSä¸é»è®¤ç3å¯æ¬æºå¶æ%çåå¨ç©ºé´åå ¶å®çèµæºï¼æ¯å¦ï¼ç½ç»å¸¦å®½ï¼å¼éãç¶èï¼ç¸å¯¹äºä½ I/O æ´»å¨çææ°æ®éåå·æ°æ®éï¼å¨æ£å¸¸çæä½æé´å¯¹å ¶é¢å¤çå¯æ¬å¾å°è®¿é®ï¼ä½æ¯ä»ç¶æ¶èä¸ç¬¬ä¸å¯æ¬ç¸åæ°éçèµæºã
å æ¤ï¼ä¸ä¸ªèªç¶çæ¹è¿æ¯ä½¿ç¨çº å ç ï¼Erasure Codingï¼æ¿ä»£å¯æ¬æºå¶ï¼å®ä½¿ç¨æ´å°çåå¨ç©ºé´æä¾ç¸åç容é级å«ï¼ä¸ä¸ªå ¸åççº å ç 设置ï¼ä¼ä½¿å¾åå¨ç©ºé´çå¼éä¸è¶ è¿%;ä¸ä¸ªECæ件çå¯æ¬å åæ¯æ æä¹çï¼å®ä¸ç´ä¿æ为1ï¼å¹¶ä¸ä¸è½éè¿å½ä»¤ -setrepä¿®æ¹ECçå¯æ¬å åçå¼ã
ç£çéµåï¼RAIDï¼æ¯å¨åå¨ç³»ç»ä¸ï¼ä½¿ç¨ECæåºåçãRAID使ç¨æ¡ 带çæ¹å¼å®ç°çECï¼å®æä¾é»è¾ä¸åºåçæ°æ®ï¼æ¯å¦æ件ï¼å°æ´å°çåå ï¼æ¯å¦æ¯ç¹ãåèãæåï¼ï¼å¹¶åå¨è¿ç»çåå å°ä¸åçç£çä¸ãå¨æ¬æåçå ¶ä½é¨åï¼è¿ç§æ¡å¸¦åå¸åå 被称为æ¡å¸¦åå ï¼æè åå ï¼ï¼å¯¹äºæ¯ä¸ä¸ªæ¡å¸¦åå§æ°æ®åå ï¼è®¡ç®å¹¶åå¨ä¸å®æ°éçå¥å¶æ ¡éªåå ï¼è¿ä¸ªè¿ç¨å«åç¼ç ãéè¿å¯¹å©ä½çæ°æ®åå¥å¶æ ¡éªåå 解ç 计ç®ï¼å¯ä»¥æ¢å¤ä»»ææ¡å¸¦åå çé误ã
å°ECåHDFSéæå¯ä»¥æé«åå¨æçï¼ç¶èåæ ·æä¾ä¼ ç»çåºäºå¯æ¬æºå¶çHDFSæä¹ åé¨ç½²ï¼ä¾å¦ï¼3å¯æ¬çæ件æ6个åï¼å°ä¼æ¶è 6*3 = 个åçç£ç空é´ï¼ä½æ¯ä½¿ç¨ECï¼6个æ°æ®ï¼3ä¸ªæ ¡éªï¼é¨ç½²ï¼ä»å°åªæ¶è9个åçç£ç空é´ã
å¨ECçç¯å¢ä¸ï¼æ¡å¸¦æè¥å¹²ä¸»è¦çä¼ç¹ï¼é¦å ï¼å®è½å¨çº¿ECï¼ä½¿ç¨ECçæ ¼å¼ç´æ¥åæ°æ®ï¼ï¼é¿å 转æ¢é¶æ®µï¼ç´æ¥èçåå¨ç©ºé´ãå¨çº¿ECéè¿å¹¶è¡å©ç¨å¤ç£ç主轴å¢å¼ºI/Oæ§è½ï¼è¿å¨é«æ§è½çç½ç»çé群ä¸å°¤å ¶éè¦ãå ¶æ¬¡ï¼å®èªç¶çååå°æ件å°å¤ä¸ªDataNodesï¼æ¶é¤äºå°å¤ä¸ªæ件ç»å®å°ä¸ä¸ªç¼ç ç»çéè¦ï¼è¿ä¼å¾å¤§çç®åæ件çæä½ï¼æ¯å¦å é¤ãé é¢æ±æ¥åå¨èé¦é群ä¸ä¸åçNamespaceä¹é´è¿ç§»æ°æ®çãå¨å ¸åçHDFSé群ä¸ï¼å°æ件å æ»åå¨ç©ºé´3/4以ä¸çæ¶èï¼ä¸ºäºæ´å¥½çæ¯æå°æ件ï¼å¨ç¬¬ä¸é¶æ®µå·¥ä½ä¸ï¼HDFSæ¯ææ¡å¸¦çECãå¨æªæ¥ï¼HDFSä¹ä¼æ¯æè¿ç»çECå¸å±ï¼æ¥ç设计ææ¡£ï¼æ´å¤çä¿¡æ¯å¨issue HDFS- ä¸è®¨è®ºã
æ¡å¸¦çHDFSæ件æ¯ç±é»è¾ä¸çåç»ææï¼æ¯ä¸ªåç»å å«ä¸å®æ°éçå é¨åï¼ä¸ºäºåå°é¢å¤çå对NameNodeå åæ¶èï¼æåºäºæ°çåå±åå½ååè®®ï¼åç»çIDå¯ä»¥ä»å®çå é¨åçä»»æ ID ä¸æ¨æåºæ¥ï¼è¿å 许åç»çº§å«ç管çï¼èä¸æ¯å级å«çã
客æ·ç«¯è¯»åè·¯å¾è¢«å¢å¼ºï¼å¯ä»¥å¹¶è¡å¤çä¸ä¸ªåç»çå¤ä¸ªå é¨åï¼å¨è¾åº/åå ¥è·¯å¾ï¼ DFSStripedOutputStream ç¨äºç®¡çä¸ç»æ°æ®æµï¼æ¯ä¸ªæ°æ®æµå¯¹åºä¸ä¸ªDataNodeï¼è¯¥DataNodeå¨å½ååç»ä¸åå¨ä¸ä¸ªå é¨åï¼è¿äºæ°æ®æµå¤§å¤æ¯å¼æ¥å·¥ä½ï¼åè°å¨è´è´£æä½æ´ä¸ªåç»ï¼å æ¬ç»æå½åçåç»ãåé æ°çåç»ççãå¨è¾å ¥ / 读路å¾ï¼ DFSStripedInputStream å°è¯·æ±çé»è¾åèèå´çæ°æ®è½¬æ¢ä¸ºåå¨å¨DataNodesä¸çå é¨åçèå´ï¼ç¶å并è¡çåå¸è¯»è¯·æ±ï¼å¨åºç°æ éæ¶ï¼å®ååºé¢å¤ç读请æ±ç¨äºè§£ç ã
DataNodeä¼è¿è¡ä¸ä¸ªé¢å¤ç ErasureCodingWorker (ECWorker) ä»»å¡ç¨äºåå°æ¢å¤å¤±è´¥çECåï¼å½NameNodeæ£æµå°ä¸ä¸ªå¤±è´¥çECåï¼å®ä¼éæ©ä¸ä¸ªDataNodeå»åæ¢å¤çå·¥ä½ï¼æ¢å¤ä»»å¡éè¿å¿è·³ååºä¼ éè³DataNodeï¼è¿ä¸ªè¿ç¨ç±»ä¼¼äºå¯æ¬åéæ°å¤å¶å¤±è´¥çæ°æ®åï¼é建失败çåæ3个主è¦çä»»å¡ï¼
使ç¨ä¸ç¨ç线ç¨æ± 并è¡ç读åè¾å ¥æ°æ®ï¼åºäºECçç¥ï¼å®å°ææç读请æ±è°åº¦å°ææçæºèç¹ï¼å¹¶ä¸åªè¯»åæå°æ°æ®éçè¾å ¥åæ°ç¨äºéæã
ä»è¾å ¥æ°æ®ä¸è§£ç åºæ°çæ°æ®ååå¥å¶æ ¡éªåï¼ææ丢失çæ°æ®ååæ ¡éªåä¸èµ·è§£ç ã
解ç å®æåï¼æ¢å¤çæ°æ®åè¢«ä¼ è¾å°ç®æ DataNodeèç¹ã
为äºä½¿çº å ç çç¥éåå¼æçå·¥ä½æ¹å¼ï¼æ们å 许HDFSé群ä¸çæ件åç®å½å ·æä¸åçå¯æ¬åçº å ç çç¥ï¼çº å ç çç¥å°è£ äºå¦ä½ç¼ç /解ç æ件ï¼æ¯ä¸ä¸ªçç¥ç±ä»¥ä¸ä¿¡æ¯é¨åå®ä¹ï¼
è¿ä¸ªå æ¬å¨ECç»ï¼æ¯å¦ï¼6+3ï¼ä¸æ°æ®ååæ ¡éªåçæ°éï¼ä»¥åç¼è§£ç å¨ç®æ³ï¼æ¯å¦ï¼ Reed-Solomon,源码性格源码才子 XOR ï¼
è¿å³å®äºæ¡å¸¦è¯»åçç²åº¦ï¼å æ¬ç¼å²åºå¤§å°åç¼ç å·¥ä½ã
çç¥è¢«å½å为æ°æ®åæ°é-æ ¡éªåæ°é-ååå ç大å°ï¼å½åæ¯æ6ç§å ç½®çç¥ï¼RS-3-2-k, RS-6-3-k, RS--4-k, RS-LEGACY-6-3-k, XOR-2-1-k åREPLICATIONã
REPLICATIONæ¯ä¸ç§ç¹æ®ççç¥ï¼å®åªè½è¢«è®¾ç½®å¨ç®å½ä¸ï¼å¼ºå¶ç®å½éç¨3å¯æ¬çç¥ï¼èä¸æ¯ç»§æ¿å®çç¥å ççº å ç çç¥ï¼è¯¥çç¥ä½¿3å¯æ¬ç®å½ä¸çº å ç ç®å½äº¤åæ为å¯è½ã
REPLICATION çç¥æ¯ä¸ç´å¯ç¨çï¼èå ¶å®çå ç½®çç¥å¨é»è®¤çæ åµä¸æ¯ç¦ç¨çã
类似äºHDFSåå¨çç¥ï¼çº å ç çç¥æ¯è®¾ç½®å¨ç®å½ä¸çï¼å½ä¸ä¸ªæ件被å建ï¼å®ç»§æ¿ç¦»å®æè¿çç¥å ç®å½çECçç¥ã
ç®å½çº§å«çECçç¥åªå½±åå¨è¯¥ç®å½ä¸å建çæ°æ件ï¼ä¸æ¦ä¸ä¸ªæ件已ç»è¢«å建ï¼å®ççº å ç çç¥å¯ä»¥è¢«æ¥è¯¢ï¼ä½æ¯ä¸è½æ¹åï¼å¦æä¸ä¸ªçº å ç æ件被éå½åå°ä¸ä¸ªä¸åçECçç¥çç®å½ä¸ï¼è¯¥æ件ä¼ä¿çå®ä¹ååå¨çECçç¥ï¼è½¬æ¢ä¸ä¸ªæ件å°ä¸åçECçç¥éè¦éåå®çæ°æ®ï¼éåæ°æ®æ¯éè¿æ·è´æ件ï¼æ¯å¦ï¼éè¿distcpï¼èä¸æ¯éå½åæ件ã
æ们å 许ç¨æ·éè¿XMLæ件çæ¹å¼å»å®ä¹å®ä»¬èªå·±çECçç¥ï¼è¯¥XMLæä»¶å¿ é¡»è¦æä¸é¢ç3é¨åï¼
1ï¼ layoutversion: 表示ECçç¥æä»¶æ ¼å¼ççæ¬ã
2ï¼ schemas: è¿ä¸ªå æ¬ææç¨æ·å®ä¹çEC约æ
3ï¼ policies: è¿ä¸ªå æ¬ææç¨æ·å®ä¹çECçç¥ï¼æ¯ä¸ªçç¥ç±schema idåæ¡å¸¦åå ç大å°ï¼cellsizeï¼ææï¼
å¨hadoop confç®å½ä¸æä¸ä¸ªåç§°å« user_ec_policies.xml.templateçæ ·æ¬ECçç¥çXMLæ件ã
å ç¹å° ISA-L 代表å ç¹å°æºè½åå¨å éåºï¼ ISA-L æ¯ä¸ºåå¨åºç¨ç¨åºä¼åçåºå±å½æ°å¼æºçéåï¼å®å æ¬å¨ AVX å AVX2 æ令éä¸å¿«éçå Reed-Solomon ç±»åççº å ç ä¼åï¼HDFSçº å ç å¯ä»¥å©ç¨ISA-Lå»å éç¼è§£ç 计ç®ï¼ISA-Læ¯æ大å¤æ°å¼æºçæä½ç³»ç»ï¼å æ¬linuxåwindowsï¼ISA-Lé»è®¤æ¯ä¸å¯å¨çï¼æå ³å¦ä½å¯å¨ISA-Lï¼è¯·çä¸é¢ç说æã
çº å ç å¨é群çCPUåç½ç»æ¹é¢æåºäºé¢å¤çè¦æ±ã
ç¼ç å解ç å·¥ä½ä¼æ¶èHDFS客æ·ç«¯åDataNodesä¸é¢å¤çCPUã
çº å ç æ件ä¹åå¸å¨æºæ¶ä¹é´ï¼ç¨äºæºæ¶å®¹éï¼è¿æå³çå½è¯»åååå ¥æ¡å¸¦æ件ï¼å¤§å¤æ°æä½æ¯å¨æºæ¶å¤çï¼å æ¤ï¼ç½ç»å¯¹å带宽é常éè¦çã
对äºæºæ¶å®¹éæ¥è¯´ï¼è³å°æ¥æä¸é ç½®çECæ¡å¸¦å®½åº¦ç¸åçæºæ¶æ°éä¹æ¯å¾éè¦çï¼å¯¹äºECçç¥RS (6,3)ï¼è¿æå³çè³å°è¦æ9个æºæ¶ï¼çæ³çæ åµä¸è¦ææè 个æºæ¶ç¨äºå¤ç计åå å计åå¤çåæºã对äºæºæ¶æ°éå°äºæ¡å¸¦å®½åº¦çé群ï¼HDFSä¸è½ç»´æ¤æºæ¶å®¹éï¼ä½æ¯ä»ç¶ä¼åæ£æ¡å¸¦æ件å°å¤ä¸ªèç¹ä¸ºäºèç¹çº§å«ç容éã
é»è®¤æ åµä¸ï¼ææå ç½®ççº å ç çç¥æ¯è¢«ç¦ç¨çï¼ä½æ¯å®ä¹å¨åæ°dfs.namenode.ec.system.default.policyä¸çé¤å¤ï¼è¯¥çç¥å¨é»è®¤æ åµä¸æ¯å¯ç¨çãé群管çåå¯ä»¥æ ¹æ®é群ç大å°åå¸æç容éå±æ§ä½¿ç¨å½ä»¤hdfs ec [-enablePolicy -policy <policyName>]å¯ç¨ä¸ç»çç¥ï¼ä¾å¦ï¼å¯¹äºä¸ä¸ªæ¥æ9个æºæ¶çé群ï¼ç±»ä¼¼RS--4-k è¿æ ·ççç¥ä¸è½è¾¾å°æºæ¶çº§å«ç容éï¼èçç¥RS-6-3-k æè RS-3-2-kæ´éåãå¦æ管çååªå ³å¿èç¹çº§å«ç容éï¼å¨è³å°æ个DataNodesçé群ä¸çç¥RS--4-kä¹æ¯éåçã
ç³»ç»é»è®¤çECçç¥å¯ä»¥éè¿åæ°âdfs.namenode.ec.system.default.policyâ æ¥é ç½®ï¼å¨è¿ç§é ç½®ä¸ï¼å½å½ä»¤ â-setPolicyâ没ææå®çç¥å称çåæ°æ¶ï¼é»è®¤ççç¥å°ä¼è¢«ä½¿ç¨ã
é»è®¤æ åµä¸ï¼åæ° âdfs.namenode.ec.system.default.policyâ çå¼ä¸ºâRS-6-3-kâï¼ä½¿ç¨Reed-SolomonåXORå®ç°çç¼è§£ç å¨å¯ä»¥ä½¿ç¨å®¢æ·ç«¯åDataNodeèç¹æå®å¦ä¸çå ³é®åé ç½®ï¼io.erasurecode.codec.rs.rawcodersç¨æ¥æå®é»è®¤çRSç¼è§£ç å¨ï¼io.erasurecode.codec.rs-legacy.rawcodersç¨äºæå®legacy RSç¼è§£ç å¨ï¼io.erasurecode.codec.xor.rawcodersç¨äºæå®XORç¼è§£ç å¨ï¼ç¨æ·ä¹å¯ä»¥ä½¿ç¨ç±»ä¼¼å ³é®åio.erasurecode.codec.self-defined-codec.rawcodersæ¥é ç½®èªå®ä¹çç¼è§£ç å¨ãè¿äºå ³é®åçå¼æ¯å¸¦æåéæºå¶çç¼ç å¨å称çå表ãè¿äºç¼è§£ç å¨å·¥å以æå®çé ç½®çå¼æåºç被å è½½ï¼ç´å°ä¸ä¸ªç¼è§£ç å¨è¢«æåçå è½½ï¼é»è®¤çRSåXORç¼è§£ç å¨é ç½®æ´å欢æ¬å°å®ç°ï¼èä¸æ¯çº¯javaå®ç°ï¼RS-LEGACY没ææ¬å°ç¼è§£ç å¨å®ç°ï¼å æ¤é»è®¤çåªè½æ¯çº¯javaçå®ç°ï¼ææè¿äºç¼è§£ç å¨é½æ纯javaçå®ç°ï¼å¯¹äºé»è®¤çRSç¼è§£ç å¨ï¼å®ä¹æä¸ä¸ªæ¬å°å®ç°ï¼å©ç¨è±ç¹å° ISA-Låºæé«ç¼è§£ç å¨æ§è½ï¼å¯¹äºXORç¼è§£ç å¨ï¼ä¹æ¯æå©ç¨è±ç¹å° ISA-Låºæåç¼è§£ç çæ§è½çæ¬å°å®ç°ï¼è¯·åé âEnable Intel ISA-Lâè·åæ´è¯¦ç»çä¿¡æ¯ãé»è®¤çRSLegacyçå®ç°æ¯çº¯javaçï¼é»è®¤çRSåXORæ¯ä½¿ç¨äºå ç¹å°ISA-Låºæ¬å°å®ç°çï¼å¨DataNodesä¸ççº å ç åå°æ¢å¤å·¥ä½ä¹å¯ä»¥ä½¿ç¨ä¸é¢çåæ°è¢«è°ä¼ï¼
1ï¼ dfs.datanode.ec.reconstruction.stripedread.timeout.millis --æ¡å¸¦è¯»åè¶ æ¶æ¶é´ï¼é»è®¤å¼ ms
2ï¼ dfs.datanode.ec.reconstruction.stripedread.buffer.size --读åæå¡çç¼å大å°ï¼é»è®¤å¼ K
3ï¼ dfs.datanode.ec.reconstruction.threads -- DataNodeç¨äºåå°éæå·¥ä½ç线ç¨æ°éï¼é»è®¤å¼ 8 个线ç¨
4ï¼ dfs.datanode.ec.reconstruction.xmits.weight -- ä¸å¯æ¬åæ¢å¤ ç¸æ¯ï¼ECåå°æ¢å¤ä»»å¡ä½¿ç¨çxmits çç¸å¯¹æéï¼é»è®¤å¼0.5ï¼è®¾ç½®å®çå¼ä¸º0å»ç¦ç¨è®¡ç®ECæ¢å¤ä»»å¡çæéï¼ä¹å°±æ¯è¯´ï¼ECä»»å¡æ»æ¯1 xmitsãéè¿è®¡ç®åºè¯»æ°æ®æµçæ°éååæ°æ®æµçæ°éçæ大å¼æ¥è®¡ç®åºçº å ç æ¢å¤ä»»å¡çxmitsãä¾å¦ï¼å¦æä¸ä¸ªECæ¢å¤ä»»å¡éè¦ä»6个èç¹è¯»åæ°æ®ï¼å¾2个èç¹åå ¥æ°æ®ï¼å®æ¥æç xmits æ¯max(6, 2) * 0.5 = 3ï¼å¤å¶æ件çæ¢å¤ä»»å¡æ»æ¯è®¡ç®ä¸º1xmitï¼NameNodeå©ç¨dfs.namenode.replication.max-streamsåå»DataNodeä¸æ»çxmitsInProgressï¼å并æ¥èªå¯æ¬æ件åECæ件çxmitsï¼ ï¼ä»¥ä¾¿è°åº¦æ¢å¤ä»»å¡å°è¿ä¸ªDataNodeã
HDFSå©ç¨å ç¹å°ISA-Låºå»æé«é»è®¤çRSæ¬å°å®ç°çç¼è§£ç å¨çç¼è§£ç 计ç®é度ï¼å¼å¯å¹¶ä½¿ç¨è±ç¹å°ISA-Låºï¼éè¦3æ¥ï¼
1ï¼æ建ISA-Låºï¼è¯·åé å®æ¹çç½ç« â /org/isa-l/ â è·å详æ ä¿¡æ¯ã
2ï¼æ建带æISA-Læ¯æçHadoopï¼è¯·åé æºç ä¸BUILDING.txtæ件ä¸ç âBuild instructions for Hadoopâä¸çâIntel ISA-L build optionsâé¨åã
3ï¼ä½¿ç¨-Dbundle.isalæ·è´ isal.lib ç®å½ä¸çå 容å°æç»çtaræ件ä¸ã
使ç¨è¯¥taræ件é¨ç½²Hadoopï¼ç¡®ä¿ISA-Læ¯å¨HDFS客æ·ç«¯åDataNodes端æ¯å¯ç¨çã为äºéªè¯ISA-Lè½å¤è¢«Hadoopæ£ç¡®çæ£æµå°ï¼è¿è¡å½ä»¤ hadoop checknativeæ¥éªè¯ã
HDFSæä¾äºECçåå½ä»¤ç¨äºæ§è¡çº å ç ç¸å ³ç管çå½ä»¤ã
hdfs ec [generic options] [-setPolicy -path <path> [-policy <policyName>] [-replicate]] [-getPolicy -path <path>] [-unsetPolicy -path <path>] [-listPolicies] [-addPolicies -policyFile <file>] [-listCodecs] [-enablePolicy -policy <policyName>] [-disablePolicy -policy <policyName>] [-help [cmd ...]]
ä¸é¢æ¯å ³äºæ¯ä¸ªå½ä»¤ç详æ ï¼
[-setPolicy -path <path> [-policy <policyName>] [-replicate]]
å¨æå®çç®å½çè·¯å¾ä¸è®¾ç½®çº å ç çç¥ã
path:HDFSä¸çç®å½ï¼è¿æ¯ä¸ä¸ªå¼ºå¶çåæ°ï¼è®¾ç½®ä¸ä¸ªçç¥åªå½±åæ°å建çæ件ï¼ä¸å½±åå·²ç»åå¨çæ件ã
policyName:å¨è¿ä¸ªç®å½ä¸çæ件ä¸ä½¿ç¨ççº å ç çç¥ï¼å¦æé ç½®äºåæ°âdfs.namenode.ec.system.default.policyâï¼è¿ä¸ªåæ°å¯ä»¥è¢«çç¥ï¼è¿æ¶è·¯å¾çECçç¥å°ä¼è¢«è®¾ç½®æé ç½®æ件ä¸çé»è®¤å¼ã
-replicateï¼å¨ç®å½ä¸åºç¨æå®çREPLICATIONçç¥ï¼å¼ºå¶ç®å½éç¨3å¯æ¬å¤å¶æ¹æ¡ã
-replicate å-policy <policyName>æ¯å¯éçåæ°ï¼å®ä»¬ä¸è½åæ¶è¢«æå®ã
[-getPolicy -path <path>]
è·åå¨æå®è·¯å¾ä¸ç®å½æè æ件ççº å ç çç¥ç详æ ã
[-unsetPolicy -path <path>]
åæ¶ä¹å使ç¨setPolicy å¨ç®å½ä¸è®¾ç½®ççº å ç çç¥ãå¦æç®å½æ¯ä»ç¥å ä¸ç»§æ¿ççº å ç çç¥ï¼unsetPolicy æ¯ä¸ä¸ªç©ºæä½ï¼å³å¨æ²¡ææ确设置çç¥çç®å½ä¸åæ¶çç¥å°ä¸ä¼è¿åé误ã
[-listPolicies ]
ååºææå¨HDFSä¸æ³¨åççº å ç çç¥ï¼åªæå¯ç¨ççç¥æè½ä½¿ç¨setPolicy å½ä»¤ã
[-addPolicies -policyFile <file>]
æ·»å ä¸ä¸ªçº å ç çç¥çå表ï¼è¯·åé 模æ¿çç¥æ件etc/hadoop/user_ec_policies.xml.templateï¼æ大çæ¡å¸¦åå 大å°è¢«å®ä¹å¨å±æ§ âdfs.namenode.ec.policies.max.cellsizeâ ä¸ï¼é»è®¤å¼æ¯4MBï¼å½åçHDFSä¸æ»å ±å 许ç¨æ·æ·»å 个çç¥ï¼è¢«æ·»å ççç¥IDçèå´æ¯~ï¼å¦æå·²ç»æ个çç¥è¢«æ·»å ï¼åæ·»å çç¥å°ä¼å¤±è´¥ã
[-listCodecs]
è·åç³»ç»ä¸æ¯æççº å ç ç¼è§£ç å¨åcoderå表ãä¸ä¸ªcoderæ¯ä¸ä¸ªç¼è§£ç å¨çå®ç°ï¼ä¸ä¸ªç¼è§£ç å¨å¯ä»¥æä¸åçå®ç°ï¼å æ¤ä¼æä¸åçcoderï¼ç¼è§£ç å¨çcoderséç¨åå¤ç顺åºè¢«ååºã
[-removePolicy -policy <policyName>]
移é¤ä¸ä¸ªçº å ç çç¥ã
[-enablePolicy -policy <policyName>]
å¯ç¨ä¸ä¸ªçº å ç çç¥
[-disablePolicy -policy <policyName>]
ç¦ç¨ä¸ä¸ªçº å ç çç¥ã
ç±äºå¤§éçææ¯ææï¼å¨çº å ç æ件ä¸ä¸æ¯ææäºHDFSçåæä½ï¼æ¯å¦hflush, hsync åappendæä½ã
å¨çº å ç æ件ä¸ä½¿ç¨append()å°ä¼æåºIOExceptionã
å¨DFSStripedOutputStream ä¸æ§è¡hflush() åhsync()æ¯ç©ºæä½ï¼å æ¤ï¼å¨çº å ç æ件ä¸è°ç¨hflush() æè hsync()ä¸è½ä¿è¯æ°æ®è¢«æä¹ åã
客æ·ç«¯å¯ä»¥ä½¿ç¨ StreamCapabilities æä¾çAPIå»æ¥è¯¢ä¸ä¸ªOutputStream æ¯å¦æ¯æhflush() åhsync()ï¼å¦æ客æ·ç«¯æ¸´ææ°æ®éè¿hflush() åhsync()æä¹ åï¼å½åçè¡¥ææªæ½æ¯å¨éçº å ç ç®å½ä¸å建3å¯æ¬æ件ï¼æå使ç¨FSDataOutputStreamBuilder#replicate()æä¾çAPIå¨çº å ç ç®å½ä¸å建3å¯æ¬æ件ã