大家好,我是考100分的小小码 ,祝大家学习进步,加薪顺利呀。今天说一说hbase源码分析_java怎么编译,希望您对编程的造诣更进一步.
源码环境一览
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
代码100分
下载安装
1. Maven|Git|Java下载安装
Maven、Git 、Java 请先自行下载安装并配置环境变量。
Maven安装完毕后在Maven配置文件settings.xml中配置阿里云镜像。
代码100分 <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. 源码编译
编译命令如下:
代码100分# 基于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工作笔记】
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/8948.html