真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

HMaster啟動(dòng)流程簡(jiǎn)析

很多細(xì)節(jié)不便在本篇寫(xiě)的過(guò)于詳細(xì),等后續(xù)細(xì)節(jié)分析

沈陽(yáng)網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),沈陽(yáng)網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為沈陽(yáng)近1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的沈陽(yáng)做網(wǎng)站的公司定做!

0.由HBaseCommandLine首先對(duì)HMaster進(jìn)行初始化

0.1檢查是否進(jìn)行了IP綁定(https://issues.apache.org/jira/browse/HBASE-8148),獲取地址

0.2通過(guò)HbaseRPC創(chuàng)建一個(gè)RPCServer

0.2.1首先獲取RPCEngine(WritableRPCEngine),并通過(guò)其對(duì)RPCServer進(jìn)初始化(Server:HBaseServer:RPCServer)

0.2.1.1初始化CallQueue(ipc.server.max.queue.size:向后兼容,ipc.server.max.callqueue.length,默認(rèn)值為handler* DEFAULT_MAX_CALLQUEUE_LENGTH_PER_HANDLER)和ReplicationQueue(ipc.server.max.callqueue.size,默認(rèn)值為1024×1024×1024),以及SizeBasedThrottler(threshold=ipc.server.max.callqueue.size),Listener和Responder等

0.2.1.1.1初始化Responder,創(chuàng)建一個(gè)selector,其中頻率為purgeTimeout(默認(rèn)值2×DEFAULT_HBASE_RPC_TIMEOUT)

0.2.1.1.2初始化Listener,獲取監(jiān)聽(tīng)地址并綁定到ServerSocket,其中backlog length= ipc.server.listen.queue.size,并初始化一個(gè)大小為ipc.server.read.threadpool.size的threadpool并對(duì)ipc.server.read.threadpool.size個(gè)Reader進(jìn)行初始化并啟動(dòng),最后注冊(cè)連接事件;

0.3對(duì)已經(jīng)初始化完畢的RPCServer啟動(dòng)

0.3.1啟動(dòng)Responder,從responseQueue取出response寫(xiě)回,這里Responder有一處類(lèi)似HADOOP RPC的優(yōu)化就是當(dāng)responseQueue只有一個(gè)值時(shí)立刻響應(yīng).

0.3.2啟動(dòng)Listener:每10秒并且連接數(shù)超過(guò)ipc.client.idlethreshold則對(duì)ConnectionList進(jìn)行一次檢查,若超時(shí)2×ipc.client.connection.maxidletime,則進(jìn)行清理,最多清理ipc.client.kill.max(默認(rèn)10個(gè))

0.3.3啟動(dòng)Handler,從CallQueue取出Call對(duì)rpcserver調(diào)用,并將返回值發(fā)送到responder進(jìn)行處理

HMaster啟動(dòng)流程簡(jiǎn)析

0.4將HMaster傳入ZookeeperWatcher初始化

0.4.1初始化ZookeeperWatcher:通過(guò)Zkutil或者一個(gè)Zookeeper Client對(duì)象,其中sessionTimeout=zookeeper.session.timeout(默認(rèn)180s),maxretry=zookeeper.recovery.retry以及retryIntervalMillis=zookeeper.recovery.retry.intervalmill

0.4.1.1進(jìn)入到Zookeeper環(huán)節(jié)(下回分解)

0.5初始化Health Check Thread,檢查頻率為hbase.node.health.script.frequency默認(rèn)10秒

1.HMaster執(zhí)行startup進(jìn)行啟動(dòng)流程

1.1調(diào)用becomeActiveMaster,進(jìn)入阻塞狀態(tài)直到Active

1.1.1初始化ActiveMasterManager:ZookeeperListener

1.1.2將zookeeperWatcher注冊(cè)到ActiveMasterManager來(lái)進(jìn)行監(jiān)聽(tīng)

1.1.3 stallIfBackupMastes略過(guò)不表

1.1.4初始化ClusterStatusTracker:ZookeeperNodeTracker,并啟動(dòng),注冊(cè)HMaster到ClusterStatusTracker上

1.1.5 blockUntilBecomingActiveMaster:Add a ZNode for ourselves in the backup master directory since we are notthe active master.If we become the active master later, ActiveMasterManagerwill delete this node explicitly. If wecrash before then, ZooKeeper will delete this node for us since it isephemeral.

1.2調(diào)用finishInitialization進(jìn)入初始化完成階段

1.2.1初始化filesystemManager:MasterFileSystem

1.2.1.1如果開(kāi)啟hbase.master.distributed.log.splitting,則初始化SplitLogManager:ZookeeperListener

1.2.1.1.1

1.2.1.2創(chuàng)建初始化目錄:檢查rootdir是否存在,檢查tempdir是否存在并清理,創(chuàng)建oldlogdir

1.2.2初始化FSTableDescriptors->tableDescriptor

1.2.3初始化ExecutorService

1.2.4初始化ServerManager:其中是通過(guò)HConnectionManager獲取一個(gè)HConnection,其中連接池的大小為hbase.zookeeper.properties.maxClientCnXns(默認(rèn)300)+1

1.2.5初始化所有基于ZK的tracker:

1.2.5.1初始化CatalogTracker

1.2.5.1.1獲取一個(gè)HConnection

1.2.5.1.2初始化RootRegionTracker:ZookeeperNodeTracker(rootServerZnode)

1.2.5.1.3初始化MetaRegionTracker:ZookeeperNodeTracker(assignmentnode/first_meta_region)

1.2.5.2啟動(dòng)CalalogTracker

1.2.5.2.1啟動(dòng)RootRegionTracker:開(kāi)始track RR

1.2.5.2.2啟動(dòng)MetaRegionTracker:開(kāi)始trackMR

1.2.5.3通過(guò)LoadBalancerFactory獲取balancer實(shí)例

1.2.5.4初始化AssginmentManager,管理region的分配:包括初始化timeoutMonitor(hbase.master.assignment.timeoutmonitor.period默認(rèn)10s,hbase.master.assignment.timeoutmonitor.timeout默認(rèn)30min),timerUpdater(hbase.master.assignment.timerupdater.period默認(rèn)10s)

1.2.5.5將zookeeperWatcher注冊(cè)到assginmentManager,并加到ListenerList的第一位

1.2.5.6初始化RegionServerTracker...

1.2.5.7啟動(dòng)RegionServerTracker...

1.2.5.8初始化DrainingServerTracker...

1.2.5.9啟動(dòng)DrainingServerTracker...

1.2.5.10初始化SnapshotManager...

1.2.7初始化MasterCoprocessorHost

1.2.8啟動(dòng)服務(wù)線程:包括MASTER_OPEN_REGION(hbase.master.executor.openregion.threads,5),MASTER_CLOSE_REGION(hbase.master.executor.closeregion.threads,5),MASTER_SERVER_OPERATIONS(hbase.master.executor.serverops.threads,3),MASTER_META_SERVER_OPERATIONS(hbase.master.executor.serverops.threads,5),MASTER_TABLE_OPERATIONS;以及初始化并運(yùn)行LogCleaner,HFileCleaner,最后啟動(dòng)HealCheckChore,并且RPCServer開(kāi)始接受請(qǐng)求

1.2.9等待RS狀態(tài)匯報(bào):等到以下三個(gè)條件滿足:

a.themaster is stopped

b.the'hbase.master.wait.on.regionservers.maxtostart' number of region servers is reached

c.the 'hbase.master.wait.on.regionservers.mintostart' is reached AND

there have been no new region serverin for 'hbase.master.wait.on.regionservers.interval默認(rèn)1.5s' time AND

the'hbase.master.wait.on.regionservers.timeout默認(rèn)4.5s'is reached

1.2.10檢查哪些RS沒(méi)有注冊(cè)到ZK:將啟動(dòng)的RS進(jìn)行注冊(cè)并記錄到serverManager

1.2.11啟動(dòng)AssignManager:啟動(dòng)TimeoutMonitor

1.2.12進(jìn)行一次splitlog操作:由MasterFileSystem進(jìn)行,掃描hlogdir查看其所屬regionserver是否online,如果不在線則加入到splitlogManager的deadWorkers列表并在Zk對(duì)所有的hlog在splitlog路徑下創(chuàng)建一個(gè)znode,等待其他RegionServer的SplitlogWorker獲取任務(wù)后進(jìn)行處理(細(xì)節(jié)見(jiàn)下篇RegionServer啟動(dòng)流程),若關(guān)閉hbase.master.distributed.log.splitting,則由HMaster處理,此處不表

1.2.13分配ROOT和MATA region:檢查—ROOT—和.META.是否已經(jīng)分配,若沒(méi)有則由AssignmentManager進(jìn)行分配:

1.2.13.1

1.2.14開(kāi)啟shutdownHandler:由ServerManager對(duì)deadNotExpiredServers進(jìn)行過(guò)期檢查,對(duì)expiredServer進(jìn)行處理并提交關(guān)閉流程到ExecutorService

1.2.15 AssginmentManager進(jìn)行JoinCluster:將InDisablingState和EnabingState的表進(jìn)行恢復(fù)

1.2.16 fix子region

1.2.17啟動(dòng)Balancer并交由Chore每300s運(yùn)行一次,并且是單線程運(yùn)行:當(dāng)Region正處于轉(zhuǎn)換或者RS正在下線則不進(jìn)行balance;

1.2.18 startCatalogJanitorChore啟動(dòng)

1.2.16執(zhí)行postCP post Master startup

1.3啟動(dòng)Stop Check Thread,每秒檢查一次

完畢


當(dāng)前題目:HMaster啟動(dòng)流程簡(jiǎn)析
當(dāng)前URL:http://weahome.cn/article/jsjipp.html

其他資訊

在線咨詢(xún)

微信咨詢(xún)

電話咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部