




下載本文檔
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
分布式文件系統(tǒng)HDF|2018年9
121233441什么是概Hadoop分布式文件系統(tǒng)(HadoopDistributedFile2003年10 了 FileHDFS是GFS的開(kāi)源實(shí)HDFS是ApacheHadoop 子項(xiàng)在開(kāi)源大數(shù)據(jù)技術(shù)體設(shè)計(jì)目運(yùn)行在大量廉 機(jī)器上:硬件錯(cuò)誤是常態(tài),提供容錯(cuò)機(jī)簡(jiǎn)單一致性模型:一次寫(xiě)入多 ,支持追加,不允許修改,保證數(shù)據(jù)一致流式數(shù) :批量讀而非隨機(jī)讀,關(guān)注吞吐量而非時(shí)大規(guī)模數(shù)據(jù)集:典型文件大小GB~TB
HDFS簡(jiǎn) 優(yōu)高容錯(cuò)、高可用、高擴(kuò)海量數(shù)
HDFS簡(jiǎn)缺不適合低延遲數(shù)不適合大量小文-元數(shù)據(jù)占用NameNode大量?jī)?nèi)存-磁盤(pán)尋道時(shí)間超 時(shí)不支持并發(fā)寫(xiě)-典型文件大小GB~TB,百萬(wàn)以上文件數(shù)量,PB以上數(shù)據(jù)規(guī)構(gòu)建成本低、安全可-構(gòu)建在廉價(jià) 服務(wù)器-適合大規(guī)模離線批處-
-不支持文件隨機(jī)修- 2系統(tǒng)架構(gòu)圖
Namespace/MetadataNamespace/Metadata
HDFS原Heartbeats,Heartbeats,Balancing,ReplicationHDFSNodesWritetoLocalNodesWritetoLocal系統(tǒng)架構(gòu)圖
HDFS原 Active活動(dòng)Master管理節(jié)點(diǎn)(集群中唯一管理命名空管理元數(shù)據(jù):文件的位置、所有者、權(quán)限、數(shù)據(jù)塊管理Block副本策略:默認(rèn)3個(gè)副處理客戶(hù)端讀寫(xiě)請(qǐng)求,為DataNode分配任Standby熱備Master管理節(jié)點(diǎn)(ActiveNameNode的熱備節(jié)點(diǎn)-Hadoop3.0允許配置多個(gè)StandbyActiveNameNode宕機(jī)后,快速升級(jí)為新的周期性同步edits編輯日志,定期合并fsimage與edits到本地磁
HDFS原
HDFS原NameNode元數(shù)據(jù)文edits(編輯日志文件):保存了 檢查點(diǎn)(Checkpoint)之后的所有文件更新操fsimage(元數(shù)據(jù)檢查點(diǎn)鏡像文件):保存了文件系統(tǒng)中所有 和文件信息,如:某個(gè)錄下有哪些 和文件,以及文件名、文件副本數(shù)、文件由哪些Block組成ActiveNameNode內(nèi)存中有一 的元數(shù)據(jù)(=fsimage+StandbyNameNode在檢查點(diǎn)定期將內(nèi)存中的元數(shù)據(jù)保存到fsimage文件Slave工作節(jié)點(diǎn)(可大規(guī)模擴(kuò)展Block和數(shù)據(jù)校驗(yàn)執(zhí)行客戶(hù)端發(fā)送的讀寫(xiě)操通過(guò)心跳機(jī)制定期(默認(rèn)3秒)向NameNode匯報(bào)運(yùn)行狀態(tài)和Block列表信集群?jiǎn)?dòng)時(shí),DataNode向NameNode提供Block列表信 Block數(shù)據(jù)HDFS最 單文件寫(xiě)入HDFS會(huì)被切分成若干個(gè)Block大小固定,默認(rèn)為128MB,可自定若一個(gè)Block的大小小于設(shè)定值,不會(huì)占用整個(gè)塊空默認(rèn)情況下每個(gè)Block有3個(gè)副將文件切分為與NameNode交互,獲取文件元數(shù)與DataNode交互 或?qū)懭霐?shù)管理
HDFS原 Block是HDFS的最 單如何設(shè)置Block大-塊太大:Map任務(wù)數(shù)太少,作業(yè)執(zhí)行Block和元數(shù)據(jù)分 于DataNode,元數(shù) 于Block多副-以DataNode節(jié)點(diǎn)為備份對(duì)
HDFS原 Block副本放置策副本1:放在Client所在節(jié)-對(duì) 副本2:放在不同的機(jī)架節(jié)點(diǎn)副本N:隨機(jī)選節(jié)點(diǎn)選
HDFS原
HDFS原Block文Block文件是DataNode本地磁盤(pán)中名為“blk_blockId”的Linux文 -DataNode的 │├──│├── ││└──││├──││├──││ ├──││ ├── ││ ├──││ └──- ││└──│└──
├├── ├── ├── ├── ├── ├── ├── └──└──元數(shù)據(jù)的兩 形內(nèi)存元數(shù)據(jù)文件元數(shù)據(jù)(editsedits(編輯日志文件Client請(qǐng)求變更操作時(shí),操作首先被寫(xiě)入再寫(xiě)入內(nèi)TransactionIdfsimage(元數(shù)據(jù)鏡像檢查點(diǎn)文件fsimage文件名會(huì)標(biāo)記對(duì)應(yīng)的Transaction
HDFS原 edits與fsimage的合并機(jī)
HDFS原上傳
HDFS原
HDFS原
HDFS原什么是安全模安全模式是HDFHDFS安全模式是HDFS確保Block數(shù)據(jù)安全的一種保護(hù)機(jī)ActiveNameNode啟動(dòng)時(shí),HDFS會(huì)進(jìn)入安全模式,DataNode NameNode匯報(bào)可用列表等信息,在系統(tǒng)達(dá)到安全標(biāo)準(zhǔn)前,HDFS一直處于“只讀”狀何時(shí)正常離開(kāi)安全模Block上報(bào)率:DataNode上報(bào)的可用Block個(gè)數(shù)/NameNode元數(shù)據(jù)記錄的Block個(gè)當(dāng)Block上報(bào)率>=閾值時(shí),HDFS才能離開(kāi)安全模式,默認(rèn)閾值為不建議手動(dòng)強(qiáng)制退出安全模 觸發(fā)安全模式的原NameNode重NameNode磁盤(pán)空間不Block上報(bào)率低于閾DataNode無(wú)法正常啟日志中出現(xiàn)嚴(yán)重異用戶(hù)操作不當(dāng),如:強(qiáng)制關(guān)機(jī)(特別注意故障排找到DataNode不能正常啟動(dòng)的原因,重啟清理NameNode磁謹(jǐn)慎操
HDFS原
HDFS原ActiveNN與StandbyNN的主備切利用QJM實(shí)現(xiàn)元數(shù)據(jù)高可QJM機(jī)制(QuorumJournal-只要保證Quorum(法定人數(shù))數(shù)量的QJM共 系-部署奇數(shù)(2N+1)個(gè) -寫(xiě)edits的時(shí)候,只要超過(guò)半數(shù)(N+1)JournalNode返回成功,就代表本次寫(xiě)入成-最多 N個(gè)JournalNode宕-基于Paxos算法實(shí)利用ZooKeeper實(shí)現(xiàn)Active節(jié)
上傳
HDFS原ZooKeeper
JournalNode
MonitorOf
SharedNNstatesinglewriter
MonitorOfBlockReportstoActive&StandbyDNfencing:Updatecmdsfromone 3 REST3.1語(yǔ)hadoopfs<args>(使用面最廣,可以操作任何文件系統(tǒng)< 類(lèi)似,可通過(guò)help查看幫HDFS格式示例:HDFS上的一個(gè)文件-URI簡(jiǎn)寫(xiě)
HDFS文件管 S
HDFS文件管hadoopfs-hadoopfs-Returnusagehadoopfs-usageReturnthehelpforanindividualhadoopfs-ls[-d][-h][-R]-d:Directoriesarelistedasplain-h:Formatfilesizesinahuman-readablefashion(eg64.0minstead -R:Recursivelylistsubdirectorieshadoopfs-get[-ignorecrc][-crc]Copyfilestothelocalfilesystem.FilesthatfailtheCRCcheckmaybecopiedthe-ignorecrcoption.FilesandCRCsmaybecopiedusingthe-crchadoopfs-get/user/hadoop/filehadoopfs-get /user/hadoop/filehadoopfs-put<localsrc>...Copysinglesrc,ormultiplesrcsfromlocalfilesystemtothedestinationfileAlsoreadsinputfromstdinandwritestodestinationfileS
HDFS文件管hadoopfs-cp[-f]hadoopfs-cp[-f][-p|-p[topax]]URI[URI...]<dest>Copyfilesfromsourcetodestination.Thiscommandallowsmultiplesourcesasinwhichcasethedestinationmustbeadirectory.-f:Overwritethedestinationifitalready-p:Preservefileattributes[topx](timestamps,ownership,permission,ACL,hadoopfs-mvURI[URI...]Movesfilesfromsourcetodestination.Thiscommandallowsmultiplesourcesaswellinwhichcasethedestinationneedstobeadirectory.Movingfilesacrossfilesystemsisnotpermitted.hadoopfs-rm[-f][-r|-R][-skipTrash]URI[URI...]Deletefilesspecifiedasargs.-f:theoptionwillnotdisplayadiagnosticmessageormodifytheexitstatustoreflectanerrorifthefiledoesnotexist.-R:theoptiondeletesthedirectoryandanycontentunderit-r:theoptionisequivalentto--skipTrash:theoptionwillbypasstrash,ifenabled,anddeletethespecifiedfile(s)immediay.Thiscanbeusefulwhenitisnecessarytodeletefilesfromanover-quotadirectory.REST
HDFS文件管HDFS的所有接口都支持RESTHDFSURI與HTTP寫(xiě)入文Step1:提交一個(gè)HTTPPUT請(qǐng)求,這個(gè)階段不會(huì)傳輸數(shù)|false>][&blocksize=<LONG>][&replication=<SHORT>]Step2:提交另一個(gè)HTTPPUT請(qǐng)求,并提供本地的文件路-curl-i-XPUT-T<LOCAL_FILE> REST
HDFS文件管獲取文提交HTTPGET請(qǐng)[&length=<LONG>]刪除文提交HTTPDELETE請(qǐng) 4
HDFS系統(tǒng)管配置文core-site.xml:Hadoop全局配hdfs-site.xml:HDFS局部配示例:NameNodeURI配置(core-環(huán)境變量文Hadoop-env.sh:設(shè)置了HDFS運(yùn)行所需的環(huán)境
HDFS系統(tǒng)管hdfs- DetermineswhereonthelocalfilesystemtheDFSnamenodeshouldstorethenametable(fsimage).Ifthisisacomma-delimitedlistofdirectoriesthenthenametableisreplicatedinallofthedirectories,forredundancy.DetermineswhereonthelocalfilesystemanDFSdatanodeshouldstoreitsblocks.Ifthisisacomma-
listofdirectories,thendatawillbestoredinallnameddirectories,typicallyondifferentdevices.Directoriesthatdonotexistareignored.Thedefaultblocksizefornewfiles,inbytes.Youcanusethefollowingsuffix(caseinsensitive):k(kilo),m(mega),g(giga),t(tera),p(peta),e(exa)tospecifythesize(suchas128k,512m,1g,etc.),Orprovidecompletesizeinbytes(suchas for128MB).spaceinbytespervolume.AlwaysleavethismuchspacefreefornonhdfsDefaultblockreplication.Theactualnumberofreplicationscanbespecifiedwhenthefileiscreated.defaultisusedifreplicationisnotspecifiedincreateNumberofminutesafterwhichthecheckpointgetsdeleted.Ifzero,thetrashfeatureisdisabled.Thisoptionmaybeconfiguredbothontheserverandtheclient.Iftrashisdisabledserversidethentheclientsideconfigurationischecked.Iftrashisenabledontheserversidethenthevalueconfiguredontheserverisusedandtheclientconfigurationvalueisignored. /etc/init.d/hadoop-hdfs-namenode/etc/init.d/hadoop-hdfs-namenode-/etc/init.d/hadoop-hdfs-datanode-/etc/init.d/hadoop-hdfs-journalnode-
HDFS系統(tǒng)管 SNameNode(格式化或恢復(fù)
HDFS系統(tǒng)管#hdfsnamenode[-format[-clustered#hdfsnamenode[-format[-clusteredcid][-force][-nonInteractive]]|[-recover[-force]Command-format[-clusteridcid][-[-FormatsthespecifiedNameNode.ItstartstheNameNode,formatsitandthenshutitdown.-forceoptionformatsifthenamedirectoryexists.-nonInteractiveoptionabortsifthenamedirectoryexists,unless-forceoptionisspecified.-recover[-RecoverlostmetadataonacorruptSReport(報(bào)告文件系統(tǒng)信息
HDFS系統(tǒng)管##hdfsdfsadmin[generic_options][-report[-live][-dead] Command-report[-live][-dead] Reportsbasicfilesysteminformationandstatistics.OptionalflagsmaybeusedtofilterthelistofdisplayedDataNodes. SFsck(檢查文件系統(tǒng)健康狀況
HDFS系統(tǒng)管#hdfsfsck<path>[-move#hdfsfsck<path>[-move|-delete]|[-files[-blocks[-locations|-racks]]CommandStartcheckingfromthis-Deletecorrupted-Printoutfilesbeing-files-Printouttheblock-files-blocks-Printoutlocationsforevery-files-blocks-Printoutnetworktopologyfordata-nodeMovecorruptedfilesto4.2Fsck(檢查文件系統(tǒng)健康狀況
HDFS系統(tǒng)管 4.2
HDFS系統(tǒng)管Safemode(安全模式 自動(dòng)進(jìn)入安全模式(也支持手動(dòng)進(jìn)入),該模式下只支持讀操檢測(cè)Block上報(bào)率超過(guò)閾值,才會(huì)離開(kāi)安全模在TDH慎用hdfsdfsadminleave,想了解變量設(shè)置,請(qǐng)聯(lián) ##hdfsdfsadmin[generic_options][-safemodeenter|leave|get|Note:Safemodemaintenancecommand.SafemodeisaNamenodestateinwhichdoesnotacceptchangestothenamespace(read-doesnotreplicateordeleteSafemodeisenteredautomaticallyatNamenodestartup,andleavessafemodeautomaticallywhentheconfiguredminimumpercentageofblockssatisfiestheminimumreplicationcondition.Safemodecanalsobeenteredmanually,butthenitcanonlybeturnedoffmanuallyaswell. 4.2NameNodeHA(主備切換
HDFS系統(tǒng)管#hdfshaadmin-failover[--forcefence]#hdfshaadmin-failover[--forcefence][--forceactive]<serviceId>#hdfshaadmin-getServiceStateCommandinitiateafailoverbetweentwo-determinewhetherthegivenNameNodeisActiveortransitionthestateofthegivenNameNodeto-transitionthestateofthegivenNameNodeto4.2mission mission(DataNode退役和服役
HDFS系統(tǒng)管##hdfsdfsadmin[generic_options]-Notes:Re-readthehostsandexcludefilestoupdatethesetofDatanodesthatareallowedtoconnecttoNamenodeandthosethatshould missioned CommandNamesafilethatcontainsalistofhoststhatarepermittedtoconnecttonamenode.Thefullpathnameofthefilemustbespecified.IfthevalueisallhostsareNamesafilethatcontainsalistofhoststhatarenotpermittedtoconnecttonamenode.Thefullpathnameofthefilemustbespecified.Ifthevalueisempty,nohostsareexcluded.將計(jì)劃退役的DataNode列表加入dfs.hosts.exclude文hadoopdfsadmin- 的狀態(tài) 變 將這組DataNode從dfs.hosts文件中刪hadoopdfsadmin-
4.2mission mission(DataNode退役和服役退役和服役
HDFS系統(tǒng)管刪除DataNode(先退役再刪除 4.2Balancer(數(shù)據(jù)重分布
HDFS系統(tǒng)管#hdfsbalancer[-threshold#hdfsbalancer[-threshold[-exclude[-f<hosts-file>|<comma-separatedlistofhosts>][-include[-f<hosts-file>|<comma-separatedlistofhosts>]Command-thresholdPercentageofdiskcapacity.Thisoverwritesthedefault-exclude-f<hosts-file><comma-separatedlistofExcludesthespecifieddatanodesfrombeingbalancedbythe-include-f<hosts-file><comma-separatedlistofIncludesonlythespecifieddatanodestobebalancedbythe4.2Balancer(數(shù)據(jù)重分布集群平衡的標(biāo)準(zhǔn):每個(gè)DataNode 使用率和集群 使用率的差值均小于閥默認(rèn)閾值為10,設(shè)置值為
HDFS系統(tǒng)管 4.2默認(rèn)帶寬為1M/s,主要為了Balance的同時(shí)不影響HDFS操建議Balance的時(shí)候,帶寬設(shè)為10M/s,并且停止操作
HDFS系統(tǒng)管##hdfsdfsadmin[generic_options][-setBalancerBandwidth<bandwidthinbytesperCommand-<bandwidthinbytesperChangesthenetworkbandwidthusedbyeachdatanodeduringHDFSblockbalancing.<bandwidth>istheumnumberofbytespersecondthatwillbeusedbyeachdatanode.Thisvalueoverridesthedfs.balance.bandwidthPerSecparameter.NOTE:ThenewvalueisnotpersistentontheDataNode. 4.2Distcp(分布式拷貝大規(guī)模集群內(nèi)部和集使用MapReduce實(shí)現(xiàn)文件分發(fā)、錯(cuò)誤處理恢復(fù),以及報(bào)告生
HDFS系統(tǒng)管#hadoopdistcpoptions[source_path...]#hadoopdistcpoptions[source_path...]Notes:distcp(distributedcopy)isatoolusedforlargeinter/intra-clustercopying.ItusesMapReducetoeffectitsdistribution,errorhandlingandrecovery,andreporting.Command-mumnumberofsimultaneousOverwrite-Specifybandwidthpermap,in4.2
HDFS系統(tǒng)管 限制HDFS允許管理員對(duì)用戶(hù) 設(shè)置Quota,主要從兩個(gè)維度:文件數(shù)量和文件大限制指 及 中的文件總限制指 中的所有文件的容量大小,需要考慮副本#hdfsdfsadmin-setSpaceQuota<N>Notes:SetthespacequotatobeNbytesforeach#hdfsdfsadmin-clrSpaceQuotaNotes:Removeanyspacequotaforeach#hadoopfs-count-q[-h][-v]Notes:Withthe-qoption,alsoreportthenamequotavaluesetforea
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 澆灌新質(zhì)生產(chǎn)力
- 《呼吸困難解析》課件
- 山東省地理高考試卷及答案
- 2025共同擔(dān)保借款合同
- 2025年中國(guó)滑觸線市場(chǎng)調(diào)查研究報(bào)告
- 林業(yè)火災(zāi)撲救設(shè)備制造考核試卷
- 畜產(chǎn)品加工工藝改進(jìn)與優(yōu)化考核試卷
- 2025年中國(guó)高頻振篩市場(chǎng)調(diào)查研究報(bào)告
- 2025年中國(guó)銑床專(zhuān)用電磁離合器市場(chǎng)調(diào)查研究報(bào)告
- 電子專(zhuān)用設(shè)備的生產(chǎn)效率優(yōu)化考核試卷
- 腫瘤介入治療的圍手術(shù)期管理
- 管制刀具課件教學(xué)課件
- 金融違反案例
- 工商銀行營(yíng)銷(xiāo)培訓(xùn)課件
- 動(dòng)火作業(yè)施工方案5篇
- 全心智造(廈門(mén))體育用品有限公司體育用品制造項(xiàng)目
- 【基于PLC的搬運(yùn)機(jī)器人系統(tǒng)設(shè)計(jì)(論文)7400字】
- 成都地鐵運(yùn)營(yíng)有限公司招聘筆試題庫(kù)2024
- 2024秋期國(guó)家開(kāi)放大學(xué)《國(guó)家開(kāi)放大學(xué)學(xué)習(xí)指南》一平臺(tái)在線形考(任務(wù)一至五)試題及答案
- 小小理財(cái)師教學(xué)課件
- 知識(shí)產(chǎn)權(quán)法(四川師范大學(xué))智慧樹(shù)知到答案2024年四川師范大學(xué)
評(píng)論
0/150
提交評(píng)論