Hbase源碼之HMaster

HMaster是Hbase中管理數據庫元數據的服務器。

1、HMaster由下述的幾組線程爲其服務:

1)RootScanner:根節點HRegion的掃描線程;

2)MetaScanner:Meta節點HRegion的掃描線程;

3)LeaseMonitor:HMaster與外部客戶交互時,會用到一些資源,當外部客戶沒有發送心跳信息時,會需要釋放這些資源,Leases線程用來處理這個任務;

4)提供Master信息的一組web服務線程;

5)提供兩組RPC服務(HMasterInterface、HMasterRegionInterface)的一組線程,包括1個Responder、1個Listener、默認10個Handler;

6)HMaster自身主線程:循環從delayedToDoQueue、toDoQueue兩個隊列中獲取操作,並處理;

 

2、實現了兩組rpc服務(協議),其中HMasterInterface如下:

1)判斷Master是否可用;

public boolean isMasterRunning();

2)創建一個表;

public void createTable(HTableDescriptor desc) throws IOException;

3)刪除一個表;

public void deleteTable(Text tableName) throws IOException;

4)將一個列加到一個表中;

public void addColumn(Text tableName, HColumnDescriptor column) throws IOException;

5)修改表中的某個列;

  public void modifyColumn(Text tableName, Text columnName, 
    HColumnDescriptor descriptor) 
  throws IOException;

6)刪除列;

public void deleteColumn(Text tableName, Text columnName) throws IOException;

7)激活一個表;

public void enableTable(Text tableName) throws IOException;

8)disable一個表;

public void disableTable(Text tableName) throws IOException;

9)關閉HBase集羣;

public void shutdown() throws IOException;

10)得到Root節點Region路徑;

public HServerAddress findRootRegion();

 

HMasterRegionInterface如下:

1)HRegionServer初次啓動時,進行註冊;

public HbaseMapWritable regionServerStartup(HServerInfo info) throws IOException;

2)更新租約,向Master報告RegionServer的行爲,並領取新的指令;

  public HMsg[] regionServerReport(HServerInfo info, HMsg msgs[])
  throws IOException;












 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章