KingbaseES V8R6 运维案例 --ksql访问动态库问题

                                        KingbaseES V8R6数据库运维案例之---ksql访问动态库问题

案例说明:
CentOS环境下,在安装和初始化数据库实例后,启动数据库服务,通过ksql连接访问时出现以下故障:

经检查,是缺失动态库'libpq.so.5 '导致。

系统环境:

[kingbase@node102 bin]$ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

适用版本:
KingbaseES V8R6

一、问题现象

[kingbase@node102 bin]$ ./ksql -U system test -p 54321
./ksql: /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/../lib/libssl.so.10: no version information available (required by /lib64/libpq.so.5)
./ksql: /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/../lib/libcrypto.so.10: no version information available (required by /lib64/libpq.so.5)
./ksql: /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/../lib/libcrypto.so.10: no version information available (required by /lib64/libldap_r-2.4.so.2)
./ksql: /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/../lib/libcrypto.so.10: no version information available (required by /lib64/libldap_r-2.4.so.2)
./ksql: /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/../lib/libssl.so.10: no version information available (required by /lib64/libldap_r-2.4.so.2)
ksql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.54321"?

---如上所示,ksql无法连接数据库访问,并出现动态库故障。

二、问题分析
1、检查数据库服务状态

[kingbase@node102 bin]$ netstat -an |grep 543
tcp        0      0 0.0.0.0:54321           0.0.0.0:*               LISTEN
tcp6       0      0 :::54321                :::*                    LISTEN
unix  2      [ ACC ]     STREAM     LISTENING     66234    /tmp/.s.KINGBASE.54321
unix  3      [ ]         STREAM     CONNECTED     28543

---如上所示,数据库服务运行状态正常,数据库服务端口(54321)处于监听状态。

2、查看ksql动态库链接信息

[kingbase@node102 bin]$ ldd -r ksql
        linux-vdso.so.1 =>  (0x00007ffd8e583000)
        libssl.so.10 => /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/./../lib/libssl.so.10 (0x00007fab06477000)
        libcrypto.so.10 => /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/./../lib/libcrypto.so.10 (0x00007fab0604e000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fab05e46000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fab05c0f000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fab05a0b000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fab05709000)
        libicui18n.so.52 => /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/./../lib/libicui18n.so.52 (0x00007fab05294000)
        libicuuc.so.52 => /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/./../lib/libicuuc.so.52 (0x00007fab04efb000)
        libicudata.so.52 => /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/./../lib/libicudata.so.52 (0x00007fab0368f000)
        libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fab0348a000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fab030bc000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fab02ea0000)
        libz.so.1 => /lib64/libz.so.1 (0x00007fab02c8a000)
        libfreebl3.so => /lib64/libfreebl3.so (0x00007fab02a87000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fab066e7000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fab0277f000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fab02569000)

---如上所示,ksql动态库没有出现明显的error信息。

2、查看其他版本ksql的动态库信息

[kingbase@node102 bin]$ ldd -r ksql
        linux-vdso.so.1 =>  (0x00007ffc98b45000)
        libpq.so.5 => /home/kingbase/cluster/R6HA/kha/kingbase/bin/./../lib/libpq.so.5 (0x00007f9eacfb5000)
        libssl.so.10 => /home/kingbase/cluster/R6HA/kha/kingbase/bin/./../lib/libssl.so.10 (0x00007f9eacd45000)
        libcrypto.so.10 => /home/kingbase/cluster/R6HA/kha/kingbase/bin/./../lib/libcrypto.so.10 (0x00007f9eac91c000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f9eac706000)
        libreadline.so.5 => /home/kingbase/cluster/R6HA/kha/kingbase/bin/./../lib/libreadline.so.5 (0x00007f9eac4ca000)
        libtermcap.so.2 => /home/kingbase/cluster/R6HA/kha/kingbase/bin/./../lib/libtermcap.so.2 (0x00007f9eac2c5000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f9eac0bd000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f9eabe86000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f9eabc82000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f9eab980000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f9eab5b2000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9eab396000)
        libfreebl3.so => /lib64/libfreebl3.so (0x00007f9eab193000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f9ead1ff000)

---如上图所示,其他版本的ksql中有‘libpq.so.5'的动态库链接信息,而出现故障的ksql中无此动态库链接信息。

3、查看其他版本lib下动态库文件信息

[kingbase@node102 lib]$ ls -lh libpq*
-rwxr-xr-x. 1 kingbase kingbase 330K Feb 16  2022 libpq.so
-rwxr-xr-x. 1 kingbase kingbase 330K Feb 16  2022 libpq.so.5
-rwxr-xr-x. 1 kingbase kingbase 330K Feb 16  2022 libpq.so.5.12
-rwxr-xr-x. 1 kingbase kingbase  26K Feb 16  2022 libpqwalreceiver.so

---当前故障版本的lib目录下,缺失libpq.so.5的动态库文件。

三、问题解决

1、将其他版本的libpq的动态库拷贝到当前版本

2、查看当前版本动态库文件信息

[kingbase@node102 bin]$ cd /opt/Kingbase/ES/V8R6_C7/Server/lib
[kingbase@node102 lib]$ ls -lh libpq*
-rw-r-xr-x 1 kingbase kingbase 330K Feb  1 10:50 libpq.so
-rw-r-xr-x 1 kingbase kingbase 330K Feb  1 10:50 libpq.so.5
-rw-rw-r-- 1 kingbase kingbase 335K Oct 28 19:39 libpq.so.5.12
-rw-rw-r-- 1 kingbase kingbase  26K Oct 28 19:39 libpqwalreceiver.so

#授权文件可执行权限
[kingbase@node102 lib]$ chmod u+x *

[kingbase@node102 lib]$ ls -lh libpq*
-rwxr-xr-x 1 kingbase kingbase 330K Feb  1 10:50 libpq.so
-rwxr-xr-x 1 kingbase kingbase 330K Feb  1 10:50 libpq.so.5
-rwxrw-r-- 1 kingbase kingbase 335K Oct 28 19:39 libpq.so.5.12
-rwxrw-r-- 1 kingbase kingbase  26K Oct 28 19:39 libpqwalreceiver.so

3、查看当前版本ksql动态库链接信息

[kingbase@node102 lib]$ cd ../bin
[kingbase@node102 bin]$ ldd -r ksql
        linux-vdso.so.1 =>  (0x00007ffc680b9000)
        libpq.so.5 => /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/./../lib/libpq.so.5 (0x00007f853a11a000)
        libssl.so.10 => /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/./../lib/libssl.so.10 (0x00007f8539eaa000)
        libcrypto.so.10 => /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/./../lib/libcrypto.so.10 (0x00007f8539a81000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f853986b000)
        libreadline.so.5 => /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/./../lib/libreadline.so.5 (0x00007f853962f000)
        libtermcap.so.2 => /opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/./../lib/libtermcap.so.2 (0x00007f853942a000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f8539222000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f8538feb000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f8538de7000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f8538ae5000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f8538717000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f85384fb000)
        libfreebl3.so => /lib64/libfreebl3.so (0x00007f85382f8000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f853a364000)

---如上图所示,ksql已经建立和'libpq'的动态库链接。

4、ksql连接访问

[kingbase@node102 bin]$ ./ksql -U system test
ksql (V8.0)
Type "help" for help.
test=# 

---如上所示,ksql可以正常连接访问。

四、总结
1、对于以上故障问题,生产环境下,可以尝试重新安装数据库软件来解决。
2、如果存在其他V8R6的版本,可以尝试按照以上方案处理解决。

posted @ 2023-02-28 17:39  KINGBASE研究院  阅读(304)  评论(0编辑  收藏  举报