前提條件
確保你安裝了Java(JDK 8或更高版本)以及Maven3.3.9及以上,在源碼編譯之前需要了解到本項目是開源項目,即github提供了官方源碼。
Alluxio官方文檔【快速入門】:https://docs.alluxio.io/os/user/stable/en/Getting-Started.html
克隆github源碼
…
設置Alluxio配置文件
在${ALLUXIO_HOME}目錄下,配置alluxio-site.properties文件:
#通過拷貝conf/alluxio-site.properties.template文件,創建conf/alluxio-site.properties:
$ cp ./conf/alluxio-site.properties.template ./conf/alluxio-site.properties
#將conf/alluxio-site.properties中的alluxio.master.hostname設置爲localhost:
$ echo "alluxio.master.hostname=localhost" >> ./conf/alluxio-site.properties
#將conf/alluxio-site.properties中的alluxio.master.mount.table.root.ufs設置爲一個本地文件系統上的臨時文件夾:(下面是示例)
$ echo "alluxio.master.mount.table.root.ufs=/tmp" >> ./conf/alluxio-site.properties
編譯源代碼
由於在實現RPC metrics時引入了依賴https://gitlab.vmic.xyz/bigdata-open/metrics2(從hadoop代碼剝離出的metrics2庫),該包尚未上傳公司nexus庫,所以編譯之前先 mvn clean install 此依賴。
執行編譯命令:mvn -T 2C clean install -DskipTests -Dmaven.javadoc.skip -Dfindbugs.skip -Dcheckstyle.skip -Dlicense.skip -Phadoop-2 -Dhadoop.version=2.6.0-cdh5.14.4對源碼進行編譯。
編譯成功後,先通過Alluxio Shell啓動測試,步驟如下:
驗證Alluxio運行環境:(該命令彙報在本地環境運行Alluxio可能會遇到的問題)
$ ./bin/alluxio validateEnv local
啓動Alluxio:(在第一次啓動Alluxio之前,需要格式化Alluxio的日誌和worker存儲目錄)
$ ./bin/alluxio format
默認配置下,如下命令會在本地啓動一個master和worker:
$ ./bin/alluxio-start.sh local SudoMount
啓動完成之後,如下命令可以看到當前後臺正在運行的進程 (-lmv 參數可以查看更加詳細的進程參數):
$ jps
啓動完成後,訪問 http://localhost:19999 查看Alluxio master的運行狀態;訪問 http://localhost:30000 查看Alluxio worker的運行狀態
導入IDEA
…