当前位置: 移动技术网 > IT编程>数据库>其他数据库 > HBase-2.2.3源码编译-Windows版

HBase-2.2.3源码编译-Windows版

2020年04月18日  | 移动技术网IT编程  | 我要评论

源码环境一览

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工作笔记】

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网