源碼環境一覽 下載安裝 1. Maven|Git|Java下載安裝 Maven、Git 、Java 請先自行下載安裝並配置環境變數。 Maven安裝完畢後在Maven配置文件settings.xml中配置阿裡雲鏡像。 2. HBase 源碼下載 然後下載HBase 2.2.3源碼到本地,建議使用方式 ...
源碼環境一覽
windows: 7 64Bit
Java: 1.8.0_131
Maven:3.3.9
Git:2.24.0.windows.1
HBase:2.2.3
Hadoop:2.8.5
下載安裝
1. Maven|Git|Java下載安裝
Maven、Git 、Java 請先自行下載安裝並配置環境變數。
Maven安裝完畢後在Maven配置文件settings.xml中配置阿裡雲鏡像。
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
2. HBase 源碼下載
然後下載HBase-2.2.3源碼到本地,建議使用方式二進行下載並解壓至當前文件夾,任選一個磁碟,將解壓後的文件夾移動至該磁碟根目錄下。此時我的文件目錄為:F:\hbase-2.2.3。
# 方式一 速度有點慢
git clone -b rel/2.2.3 --depth 1 https://github.com/apache/hbase.git
# 方式二 迅雷下載並解壓 速度很快
https://archive.apache.org/dist/hbase/2.2.3/hbase-2.2.3-src.tar.gz
https://mirror.bit.edu.cn/apache/hbase/2.2.3/hbase-2.2.3-src.tar.gz
https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/2.2.3/hbase-2.2.3-src.tar.gz
3. 源碼編譯
編譯命令如下:
# 基於Hadoop 2.8.5 版本編譯(預設)
mvn clean package -DskipTests assembly:single
# 基於Hadoop 3.1.2 版本編譯
mvn clean package -DskipTests assembly:single -Dhadoop.profile=3.0
我是在Git客戶端執行以上命令的。編譯如下:
[INFO] Apache HBase ....................................... SUCCESS [ 12.354 s]
[INFO] Apache HBase - Checkstyle .......................... SUCCESS [ 1.933 s]
[INFO] Apache HBase - Annotations ......................... SUCCESS [ 2.540 s]
[INFO] Apache HBase - Build Configuration ................. SUCCESS [ 0.251 s]
[INFO] Apache HBase - Shaded Protocol ..................... SUCCESS [ 54.008 s]
[INFO] Apache HBase - Common .............................. SUCCESS [ 32.010 s]
[INFO] Apache HBase - Metrics API ......................... SUCCESS [ 4.047 s]
[INFO] Apache HBase - Hadoop Compatibility ................ SUCCESS [ 5.685 s]
[INFO] Apache HBase - Metrics Implementation .............. SUCCESS [ 4.066 s]
[INFO] Apache HBase - Hadoop Two Compatibility ............ SUCCESS [ 6.910 s]
[INFO] Apache HBase - Protocol ............................ SUCCESS [ 22.555 s]
[INFO] Apache HBase - Client .............................. SUCCESS [ 22.927 s]
[INFO] Apache HBase - Zookeeper ........................... SUCCESS [ 4.474 s]
[INFO] Apache HBase - Replication ......................... SUCCESS [ 4.100 s]
[INFO] Apache HBase - Resource Bundle ..................... SUCCESS [ 0.393 s]
[INFO] Apache HBase - HTTP ................................ SUCCESS [ 11.402 s]
[INFO] Apache HBase - Procedure ........................... SUCCESS [ 5.220 s]
[INFO] Apache HBase - Server .............................. SUCCESS [01:08 min]
[INFO] Apache HBase - MapReduce ........................... SUCCESS [ 13.150 s]
[INFO] Apache HBase - Testing Util ........................ SUCCESS [ 10.446 s]
[INFO] Apache HBase - Thrift .............................. SUCCESS [ 18.271 s]
[INFO] Apache HBase - RSGroup ............................. SUCCESS [ 8.508 s]
[INFO] Apache HBase - Shell ............................... SUCCESS [ 48.708 s]
[INFO] Apache HBase - Coprocessor Endpoint ................ SUCCESS [ 9.552 s]
[INFO] Apache HBase - Integration Tests ................... SUCCESS [ 9.620 s]
[INFO] Apache HBase - Rest ................................ SUCCESS [ 38.149 s]
[INFO] Apache HBase - Examples ............................ SUCCESS [ 8.367 s]
[INFO] Apache HBase - Shaded .............................. SUCCESS [ 0.500 s]
[INFO] Apache HBase - Shaded - Client (with Hadoop bundled) SUCCESS [ 25.082 s]
[INFO] Apache HBase - Shaded - Client ..................... SUCCESS [ 14.156 s]
[INFO] Apache HBase - Shaded - MapReduce .................. SUCCESS [ 20.085 s]
[INFO] Apache HBase - External Block Cache ................ SUCCESS [ 4.913 s]
[INFO] Apache HBase - HBTop ............................... SUCCESS [ 2.417 s]
[INFO] Apache HBase - Assembly ............................ SUCCESS [10:26 min]
[INFO] Apache HBase - Shaded - Testing Util ............... SUCCESS [ 52.444 s]
[INFO] Apache HBase - Shaded - Testing Util Tester ........ SUCCESS [ 1.137 s]
[INFO] Apache HBase Shaded Packaging Invariants ........... SUCCESS [ 1.157 s]
[INFO] Apache HBase Shaded Packaging Invariants (with Hadoop bundled) SUCCESS [ 0.313 s]
[INFO] Apache HBase - Archetypes .......................... SUCCESS [ 0.060 s]
[INFO] Apache HBase - Exemplar for hbase-client archetype . SUCCESS [ 7.695 s]
[INFO] Apache HBase - Exemplar for hbase-shaded-client archetype SUCCESS [ 1.290 s]
[INFO] Apache HBase - Archetype builder ................... SUCCESS [ 2.134 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19:59 min
[INFO] Finished at: 2020-03-12T15:38:10+08:00
[INFO] Final Memory: 282M/1155M
[INFO] ------------------------------------------------------------------------
Oh!My God!居然編譯成功了!Amazing!
我們打開hbase-assembly/target目錄,可以看到安裝包hbase-2.2.3-bin.tar.gz已經打好了~
zpb@zpb-PC MINGW64 /f/hbase-2.2.3/hbase-assembly/target
$ ll
total 421636
drwxr-xr-x 1 zpb 197121 0 三月 12 15:26 archive-tmp/
drwxr-xr-x 1 zpb 197121 0 三月 12 15:26 dependency/
drwxr-xr-x 1 zpb 197121 0 三月 12 15:26 dependency-maven-plugin-markers/
-rw-r--r-- 1 zpb 197121 223220303 三月 12 15:36 hbase-2.2.3-bin.tar.gz
-rw-r--r-- 1 zpb 197121 208313237 三月 12 15:37 hbase-2.2.3-client-bin.tar.gz
drwxr-xr-x 1 zpb 197121 0 三月 12 15:26 maven-shared-archive-resources/
-rw-r--r-- 1 zpb 197121 34547 三月 12 15:26 NOTICE.aggregate
-rw-r--r-- 1 zpb 197121 94847 三月 12 15:26 supplemental-models.xml
解壓安裝包,發現跟官網下載的安裝包幾乎一模一樣~
zpb@zpb-PC MINGW64 /f/hbase-2.2.3/hbase-assembly/target/hbase-2.2.3
$ tar -zxvf hbase-2.2.3-bin.tar.gz
zpb@zpb-PC MINGW64 /f/hbase-2.2.3/hbase-assembly/target/hbase-2.2.3
$ ll
total 501
drwxr-xr-x 1 zpb 197121 0 三月 11 23:21 bin/
-rw-r--r-- 1 zpb 197121 157258 一月 10 18:15 CHANGES.md
drwxr-xr-x 1 zpb 197121 0 三月 11 23:21 conf/
drwxr-xr-x 1 zpb 197121 0 三月 12 15:21 hbase-webapps/
-rw-r--r-- 1 zpb 197121 262 一月 10 18:15 LEGAL
drwxr-xr-x 1 zpb 197121 0 三月 12 23:41 lib/
-rw-r--r-- 1 zpb 197121 129312 三月 12 15:26 LICENSE.txt
-rw-r--r-- 1 zpb 197121 34547 三月 12 15:26 NOTICE.txt
-rw-r--r-- 1 zpb 197121 1477 一月 10 18:15 README.txt
-rw-r--r-- 1 zpb 197121 98256 一月 10 18:15 RELEASENOTES.md
小伙伴們肯定特別吃驚我為什麼這麼驚訝?因為之前本人確實也在Windows下編譯過HBase-1.2.6版本的源碼,真的是好痛苦啊!我給大家展示一下當時編譯HBase-1.2.6版本的環境:
windows: 10 64Bit
Java: 1.8.0_131
HBase:1.2.6
Hadoop:2.5.1
protobuf:2.5.0
Maven: 3.5.4
Windows SDK:10.1
cygwin:3.1.2
cmake:3.16.2-win64-x64.zip
7z: 19.00
是的,我還編譯了Hadoop源碼,因為需要winutils.exe和hadoop.dll文件。除此之外,還報了好大一堆的錯~
HBase 真是越升級體驗越好了!小伙伴們趕緊試一試吧,如果只是我的狗屎運爆棚一定要告訴我哦~
轉載請註明出處!歡迎關註本人微信公眾號【HBase工作筆記】