1、code -> github
2、環境準備
1)建立乙個工程
2)解壓zookeeper-3.4.10.tar.gz檔案
3)拷貝zookeeper-3.4.10.jar、jline-0.9.94.jar、log4j-1.2.16.jar、netty-3.10.5.final.jar、slf4j-api-1.6.1.jar、slf4j-log4j12-1.6.1.jar到工程的lib目錄。並build一下,匯入工程。
4)拷貝log4j.properties檔案到專案src根目錄
3、建立zookeeper客戶端
4、建立子節點private string connectstring = "node1:2181,node2:2181,node3:2181";
private int sessiontimeout = 2000;
zookeeper zkclient;
// 初始化方法
@before
public void initzk() throws ioexception catch (keeperexception e) catch (interruptedexception e)
}});
}
5、獲取子節點並監聽// 建立子節點
@test
public void createnode() throws keeperexception, interruptedexception
6、判斷znode是否存在// 獲取子節點
@test
public void getnode() throws keeperexception, interruptedexception
// 延時阻塞
thread.sleep(long.max_value);
}
// 判斷節點是否存在
@test
public void i***ist() throws keeperexception, interruptedexception
黑猴子的家 Hadoop Checkpoint機制
fsimage和edit log合併的過程如下圖所示 其實這個合併過程是乙個很耗i o與cpu的操作,並且在進行合併的過程中肯定也會有其他應用繼續訪問和修改hdfs檔案。所以,這個過程一般不是在單一的namenode節點上進行從。如果hdfs沒有做ha的話,checkpoint由secondname...
黑猴子的家 FileInputFormat切片機制
1 job提交流程原始碼詳解 waitforcompletion submit 1 建立連線 connect 1 建立提交job的 new cluster getconfiguration 2 判斷是本地yarn還是遠端 initialize jobtrackaddr,conf 2 提交job su...
黑猴子的家 Git 安裝
2 開始安裝 git 選擇git命令的執行環境,這裡推薦選擇第乙個,就是單獨使用者git自己的命令列視窗。不推薦和windows的命令列視窗混用。在 configuring the line ending conversions 選項中 第乙個選項 如果是跨平台專案,在windows系統安裝,選擇 ...