其他分享
首页 > 其他分享> > CDH6.3.2升级impala3.2至impala3.4详细步骤

CDH6.3.2升级impala3.2至impala3.4详细步骤

作者:互联网

CDH6.3.2 impala3.2 升级至impala3.4编译全过程

本地环境

硬件要求

仅支持Linux的操作系统

编译环境

impala与其他组件版本支持

impala3.4Impala4
hudiYX
icebergXY
Hive2YX

编译impala

CDH6.3.2对应的Impala基础版本是Apache Impala 3.2,当然还打了不少补丁。从Impala网页上能看到版本号是3.2.0-cdh6.3.2

Apache Impala是以源码的形式release的,因此需要自行在对应的平台上编译。找一个跟集群环境一致的机器。

根据文档中的“Building Impala without Test Data (for testing Impala)”章节来编译Impala:
https://cwiki.apache.org/confluence/display/IMPALA/Building+Impala
所不同的是我们要编译的是3.4版本,不是最新的master分支,所以clone时要选好版本:

git clone --single-branch --branch 3.4.0 https://github.com/apache/impala.git impala-3.4
cd impala-3.4

由于Cloudera maven repo URL变更,需要修改pom.xml才能编译成功(IMPALA-9815),我们打上 IMPALA-9815 的commit: https://github.com/apache/impala/commit/481ea4ab0d476a4aa491f99c2a4e376faddc0b03

git fetch origin 481ea4ab0d476a4aa491f99c2a4e376faddc0b03
git cherry-pick 481ea4ab0d476a4aa491f99c2a4e376faddc0b03

bin/bootstrap_system.sh 脚本安装编译依赖:

export IMPALA_HOME=`pwd`
$IMPALA_HOME/bin/bootstrap_system.sh

bootstrap_system.sh 脚本问题总结

重新执行bootstrap_system.sh脚本
rm -rf /var/lib/pgsql/*
rm -rf /usr/local/bin/ant
apache-ant*问题
# 修改bootstrap_system.sh ant下载地址
vim $IMPALA_HOME/bin/bootstrap_system.sh

244   https://downloads.apache.org/ant/binaries/apache-ant-1.10.12-bin.tar.gz
245 redhat sha512sum -c - <<< '2287dc5cfc21043c14e5413f9afb1c87c9f266ec2a9ba2d3bf2285446f6e4ccb59b558bf2e5c57911a05dfa293c7d5c7ad60ac9f744ba11406f4e6f9a27b2403  apache-ant-1.10.12-bin.tar.gz'
246 redhat sudo tar -C /usr/local -xzf apache-ant-1.10.12-bin.tar.gz
247 redhat sudo ln -s /usr/local/apache-ant-1.10.12/bin/ant /usr/local/bin
ivy依赖下载问题
# 修改一下对应配置文件
vim /root/hadoop-lzo/build.xml
96   <property name="ivy_repo_url" value="https://repo.maven.apache.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"/>
 
vim /root/hadoop-lzo/ivy/ivysettings.xml
15     value="https://repo.maven.apache.org/maven2/"

如果之前在这台机器上编译过Impala,也可以跳过上面这一步。

设置环境变量

source $IMPALA_HOME/bin/impala-config.sh

开始编译

$IMPALA_HOME/buildall.sh -noclean -notests -release

buildall.sh编译问题总结

logredactor下载问题
wget  https://repository.cloudera.com/artifactory/cloudera-repos/org/cloudera/logredactor/logredactor/2.0.7/logredactor-2.0.7.jar
wget  https://repository.cloudera.com/artifactory/cloudera-repos/org/cloudera/logredactor/logredactor/2.0.7/logredactor-2.0.7.pom

编译成功查看

编译过程还要下载很多依赖,配好VPN速度会快很多。我这边编译大概花了一个小时,编译完后可以找到impalad可执行文件和impala-frontend的jar包:

$ ll -h be/build/latest/service/impalad fe/target/impala-frontend-0.1-SNAPSHOT.jar
-rwxrwxr-x 1 root root 460M 6月  20 11:30 be/build/latest/service/impalad*
-rw-rw-r-- 1 root root 7.5M 6月  20 11:33 fe/target/impala-frontend-0.1-SNAPSHOT.jar
$ strings be/build/latest/service/impalad | grep 3.4.0
3.4.0-RELEASE

上面最后一条指令,应该可以在impalad可执行文件中找到 3.4.0-RELEASE 这样的字符串。编译出来的 impalad 可执行文件有 400 多M,因为包含了很多符号信息。可以用 strip --strip-debug impalad 降低它的大小

impala默认使用静态编译,但还是有一些动态依赖,用 ldd 指令查看:

# ldd beild/latestrvice/impalad 
beild/latestrvice/impalad: b64bstdc++.so.6: version `CXXABI_1.3.8' not found (required by beild/latestrvice/impalad)
beild/latestrvice/impalad: b64bstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by beild/latestrvice/impalad)
beild/latestrvice/impalad: b64bstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /root/impala-3.4/toolchain/kudu-4ed0dbbd1/debugb64bkudu_client.so.0)
beild/latestrvice/impalad: b64bstdc++.so.6: version `CXXABI_1.3.8' not found (required by /root/impala-3.4/toolchain/kudu-4ed0dbbd1/debugb64bkudu_client.so.0)
	linux-vdso.so.1 =>  (0x00007ffcd11d0000)
	libjsig.so => /usrb/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/jrebd64bjsig.so (0x00007f987c937000)
	libpthread.so.0 => b64bpthread.so.0 (0x00007f987c71b000)
	libsasl2.so.3 => b64bsasl2.so.3 (0x00007f987c4fe000)
	libjvm.so => not found
	libkudu_client.so.0 => /root/impala-3.4/toolchain/kudu-4ed0dbbd1/debugb64bkudu_client.so.0 (0x00007f987bd7f000)
	librt.so.1 => b64brt.so.1 (0x00007f987bb77000)
	libdl.so.2 => b64bdl.so.2 (0x00007f987b973000)
	libssl.so.10 => b64bssl.so.10 (0x00007f987b701000)
	libcrypto.so.10 => b64bcrypto.so.10 (0x00007f987b29e000)
	libkrb5.so.3 => b64bkrb5.so.3 (0x00007f987afb5000)
	libgssapi_krb5.so.2 => b64bgssapi_krb5.so.2 (0x00007f987ad68000)
	libstdc++.so.6 => b64bstdc++.so.6 (0x00007f987aa60000)
	libm.so.6 => b64bm.so.6 (0x00007f987a75e000)
	libgcc_s.so.1 => b64bgcc_s.so.1 (0x00007f987a548000)
	libc.so.6 => b64bc.so.6 (0x00007f987a17a000)
	b64/ld-linux-x86-64.so.2 (0x00007f987cb3b000)
	libresolv.so.2 => b64bresolv.so.2 (0x00007f9879f60000)
	libcrypt.so.1 => b64bcrypt.so.1 (0x00007f9879d29000)
	libk5crypto.so.3 => b64bk5crypto.so.3 (0x00007f9879af6000)
	libcom_err.so.2 => b64bcom_err.so.2 (0x00007f98798f2000)
	libkrb5support.so.0 => b64bkrb5support.so.0 (0x00007f98796e2000)
	libz.so.1 => b64bz.so.1 (0x00007f98794cc000)
	libkeyutils.so.1 => b64bkeyutils.so.1 (0x00007f98792c8000)
	libfreebl3.so => b64bfreebl3.so (0x00007f98790c5000)
	libselinux.so.1 => b64bselinux.so.1 (0x00007f9878e9e000)
	libpcre.so.1 => b64bpcre.so.1 (0x00007f9878c3c000)

这些 so 文件大部分是系统自带的或者已安装的,我们只要复制跟Impala版本相关的就好,比如说 libkudu_client.so.0,其它的不需要一并复制。

部署研究

查看CDH集群可执行文件

登到集群机器上,查看impalad、statestored、catalogd这些进程用的是哪些可执行文件,用类似 “ps aux | grep catalogd” 的指令可以找到它们的启动命令分别是

/opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala/sbin-retail/catalogd --flagfile=/var/run/cloudera-scm-agent/process/39-impala-CATALOGSERVER/impala-conf/catalogserver_flags
/opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala/sbin-retail/statestored --flagfile=/var/run/cloudera-scm-agent/process/38-impala-STATESTORE/impala-conf/state_store_flags
/opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala/sbin-retail/impalad --flagfile=/var/run/cloudera-scm-agent/process/37-impala-IMPALAD/impala-conf/impalad_flags

旧Impala目录

这里用的 flagfile 是CM生成的,我们不需要管,只需要让CM使用新的可执行文件就行了。我们来生成一个和 /opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala 目录结构一样的目录,然后通过在 CM 里设置 IMPALA_HOME 环境变量来使用它。

# ll /opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala
drwxr-xr-x 2 root root   113 11月  9 2019 bin
drwxr-xr-x 2 root root    36 11月  9 2019 cloudera
drwxr-xr-x 2 root root 16384 11月  9 2019 lib
lrwxrwxrwx 1 root root    11 11月  9 2019 sbin -> sbin-retail
drwxr-xr-x 2 root root    56 11月  9 2019 sbin-debug
drwxr-xr-x 2 root root    56 11月  9 2019 sbin-retail
drwxr-xr-x 7 root root   158 11月  9 2019 toolchain
drwxr-xr-x 7 root root  4096 11月  9 2019 www

bin目录

bin目录主要是一些诊断用的脚本,不用管

# ll /opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala/bin/
-rwxr-xr-x 1 root root 25189 11月  9 2019 collect_diagnostics.py
-rwxr-xr-x 1 root root  9183 11月  9 2019 collect_minidumps.py
-rwxr-xr-x 1 root root  2013 11月  9 2019 collect_shared_libs.sh
-rw-r--r-- 1 root root     0 11月  9 2019 __init__.py

cloudera目录

是版本信息,不用管。lib里是一些jar包的软链,以及依赖的so文件,这个要复制好。
sbin目录指向sbin-retail,里面主要是impalad可执行文件,catalogd和statestored都是软链,不用复制:

# ll /opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala/cloudera/
-rw-r--r-- 1 root root 515 11月  9 2019 cdh_version.properties

toolchain目录

目录里都是已经被静态链接进impalad可执行文件的,不知道怎么还带着,不用管:

# ll /opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala/toolchain/
drwxr-xr-x 3 root root 19 11月  9 2019 breakpad-97a98836768f8f0154f8f86e5e14c2bb7e74132e-p2
drwxr-xr-x 3 root root 17 11月  9 2019 cmake-3.8.2-p1
drwxr-xr-x 3 root root 21 11月  9 2019 llvm-5.0.1-asserts-p1
drwxr-xr-x 3 root root 21 11月  9 2019 llvm-5.0.1-p1
drwxr-xr-x 3 root root 19 11月  9 2019 orc-1.5.5-p1

www目录

目录是网页要用的,也需要更新。

依赖的动态链接库

最后再用ldd指令确认一下依赖的动态链接库

# ldd be/build/latest/service/impalad
/opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala/sbin-retail/impalad: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala/sbin-retail/impalad)
/opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala/sbin-retail/impalad: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/impala/sbin-retail/impalad)
        linux-vdso.so.1 =>  (0x00007ffd191ae000)
        libjsig.so => not found
        libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007f7405613000)
        libjvm.so => not found
        libkudu_client.so.0 => not found
        librt.so.1 => /lib64/librt.so.1 (0x00007f740540a000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f7405206000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f7404fb9000)
        libssl.so.10 => /lib64/libssl.so.10 (0x00007f7404d46000)
        libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f74048e5000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f74045fd000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f74042f4000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f7403ff2000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f7403ddc000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f7403bbf000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f74037fc000)
        /lib64/ld-linux-x86-64.so.2 (0x0000560d3b6df000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f74035e2000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f74033aa000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f7403177000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f7402f73000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f7402d64000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f7402b60000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f740294a000)
        libfreebl3.so => /lib64/libfreebl3.so (0x00007f7402746000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f740251f000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f74022bc000)

这里面有三个找不到,因为有些环境变量没有配,比如说 libjsig.so 和 libjvm.so 是java提供的,CM配置了java相关环境变量就能找到。我们能看到大部分so文件在系统里都有了,只需要复制新版本依赖的libkudu_client.so.0就行了

生成新Impala目录

先复制一份原目录,然后在它的基础上改。

# cd /opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib
# cp -r impala apache-impala-3.4
# cd apache-impala-3.4

lib目录

把lib目录里的jar包都删了,剩下so文件

# rm lib/*.jar
# ll lib
-rw-r--r-- 1 root root   89864 Jun 19 22:37 libgcc_s.so.1
lrwxrwxrwx 1 root root      36 Jun 19 22:37 libhadoop.so -> ../../hadoop/lib/native/libhadoop.so
lrwxrwxrwx 1 root root      42 Jun 19 22:37 libhadoop.so.1.0.0 -> ../../hadoop/lib/native/libhadoop.so.1.0.0
-rw-r--r-- 1 root root 6638528 Jun 19 22:37 libkudu_client.so.0
-rw-r--r-- 1 root root 6638528 Jun 19 22:37 libkudu_client.so.0.1.0
-rw-r--r-- 1 root root 1003416 Jun 19 22:37 libstdc++.so.6
-rw-r--r-- 1 root root 1003424 Jun 19 22:37 libstdc++.so.6.0.20
libkudu_client.so.0

libkudu_client.so.0 替换为我们编译Impala 3.4时用的,从前面ldd的输出可以看到在 $IMPALA_HOME/toolchain/kudu-4ed0dbbd1/debug/lib/libkudu_client.so.0,其它so文件不用管

impala-3.4依赖的ar

impala-3.4依赖的jar包也都复制进这个lib目录,它们在编译目录里能找到,具体路径是 $IMPALA_HOME/fe/target/dependency/

impala-frontend

impala-3.4编译出来的 impala-frontend-0.1-SNAPSHOT.jar 放进lib目录,在编译目录里的路径是 fe/target/impala-frontend-0.1-SNAPSHOT.jar

impala-data-source-api

把 impala-3.4编译出来的 impala-data-source-api-1.0-SNAPSHOT.jar 放进lib目录,在编译目录里的路径是 ext-data-source/api/target/impala-data-source-api-1.0-SNAPSHOT.jar。这个其实也可以复制CDH6.3.2原有的,因为external-data-source这块已经几年没更新了……

sbin-retail目录

把里面的impalad换成apache impala 3.4编译后的impalad,在编译目录里的路径是 be/build/latest/service/impalad
检查catalogd和statestored两个软链是否指向了impalad:

# ll sbin-retail
lrwxrwxrwx 1 root root         7 Jun 19 22:37 catalogd -> impalad*
-rwxr-xr-x 1 root root 481420800 Jun 20 00:06 impalad*
lrwxrwxrwx 1 root root         7 Jun 19 22:37 statestored -> impalad*

www目录

这个目录是WebUI用的,把旧版的删了,复制新版的过来。

新版impala依赖总结

$IMPALA_HOME/fe/target/dependency/
$IMPALA_HOME/www/
$IMPALA_HOME/be/build/latest/service/impalad
$IMPALA_HOME/fe/target/impala-frontend-0.1-SNAPSHOT.jar
$IMPALA_HOME/ext-data-source/api/target/impala-data-source-api-1.0-SNAPSHOT.jar
$IMPALA_HOME/toolchain/kudu-4ed0dbbd1/debugb64bkudu_client.so.0

更改CM配置并重启

把新的Impala目录放到所有机器上,确保它们一致。然后在CM中去到Impala -> 配置 -> env,加一个环境变量 IMPALA_HOME=/opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/apache-impala-3.4

image-20211108134821109

然后重启整个Impala集群。重启成功后,可以看到catalogd、statestored、impalad启用了新页面,并且版本号是3.4

image-20211108134954035

验证和回滚

最后要验证一下集群是否工作正常,包括Impala 3.4的一些新功能。如果有任何不兼容的地方,回滚CM的配置再重启Impala集群就回来了,因为我们并没有动老版本的任何东西。

总结

在CDH中单独升级Impala,可以通过以下步骤:

参考文档

https://www.icode9.com/content-4-883156.html

https://blog.csdn.net/huang_quanlong/article/details/106868826

标签:cloudera,lib,CDH6.3,impala,impalad,impala3.2,so.1,impala3.4,root
来源: https://blog.csdn.net/weixin_45104537/article/details/121487197