- 适用范围
- 问题概述
- 问题原因
- 解决方案
- [root@mogdb Python-3.7.15]# su - omm上一次登录:二 6月 11 17:15:30 CST 2024pts/0 上[omm@mogdb ~]$ gs_om -t startStarting cluster.
- [SUCCESS] mogdb2024-06-11 17:26:15.282 [unknown] [unknown] localhost 23332150211584 0[0:0#0] 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets2024-06-11 17:26:15.282 [unknown] [unknown] localhost 23332150211584 0[0:0#0] 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
- 参考文档
适用范围
MogDB 5.02
Rocky Linux 8.9
问题概述
Ptk 虽然可以在Rockly Linux 8.9 顺利安装MogDB 但是运行gs_om 报错:
[omm@mogdb ~]$ gs_om -t stop
Traceback (most recent call last):
File “/opt/mogdb/tool/script/gspylib/common/Common.py”, line 64, in
import psutil
File “/opt/mogdb/tool/script/gspylib/common/…/…/…/lib/psutil/init.py”, line 102, in
from . import _pslinux as _psplatform
File “/opt/mogdb/tool/script/gspylib/common/…/…/…/lib/psutil/_pslinux.py”, line 26, in
from . import _psutil_linux as cext
ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/opt/mogdb/tool/script/gs_om”, line 29, in
from gspylib.common.ParameterParsecheck import Parameter
File “/opt/mogdb/tool/script/gspylib/common/ParameterParsecheck.py”, line 27, in
from gspylib.common.Common import DefaultValue
File “/opt/mogdb/tool/script/gspylib/common/Common.py”, line 98, in
import psutil
File “/opt/mogdb/tool/script/gspylib/common/…/…/…/lib/psutil/init.py”, line 102, in
from . import _pslinux as _psplatform
File “/opt/mogdb/tool/script/gspylib/common/…/…/…/lib/psutil/_pslinux.py”, line 26, in
from . import _psutil_linux as cext
ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
[omm@mogdb ~]$
原因是因为在Rockly linux 8 上,没有Python 3.7 的相关包。
问题原因
在此建议研发将libpython3.7m.so.1.0 编译好放在/opt/mogdb/app/lib 下,可以避免一些Linux 发行版本不支持python 3.7 相关库文件造成gs_om 无法执行的情况发生。
由于Rocky linux 8 /Centos 8/ RHEL 8 不支持python 3.7 rpm 安装,,只支持3.11/3.9/3.6/2.7 安装。
解决方案
所以我们只能使源码进行安装。
下载源码
[root@mogdb ~]# wget https://www.python.org/ftp/python/3.7.15/Python-3.7.15.tgz
–2024-06-06 17:27:10-- https://www.python.org/ftp/python/3.7.15/Python-3.7.15.tgz
正在解析主机 www.python.org (www.python.org)… 151.101.76.223, 2a04:4e42:12::223
正在连接 www.python.org (www.python.org)|151.101.76.223|:443… 已连接。
已发出 HTTP 请求,正在等待回应… 200 OK
长度:24033532 (23M) [application/octet-stream]
正在保存至: “Python-3.7.15.tgz”
Python-3.7.15.tgz 100%[==============================================================================================>] 22.92M 15.7MB/s 用时 1.5s
2024-06-06 17:27:12 (15.7 MB/s) - 已保存 “Python-3.7.15.tgz” [24033532/24033532])
解压
[root@mogdb ~]# tar xzf Python-3.7.15.tgz
[root@mogdb ~]# cd Python-3.7.15
编译
./configure --enable-optimizations --enable-shared
make altinstall
软链接
[root@mogdb Python-3.7.15]# ln -s /usr/local/lib/libpython3.7m.so.1.0 /lib64/
测试
[root@mogdb Python-3.7.15]# python3.7 -V
Python 3.7.15
[root@mogdb Python-3.7.15]# find / -name libpython3.7m.so.1.0
/root/Python-3.7.15/libpython3.7m.so.1.0
/usr/lib64/libpython3.7m.so.1.0
/usr/local/lib/libpython3.7m.so.1.0
[root@mogdb Python-3.7.15]# su - omm
上一次登录:四 6月 6 16:06:34 CST 2024pts/0 上
[omm@mogdb ~]$ gs_om -t stop
Traceback (most recent call last):
File “/opt/mogdb/tool/script/gs_om”, line 29, in
from gspylib.common.ParameterParsecheck import Parameter
File “/opt/mogdb/tool/script/gspylib/common/ParameterParsecheck.py”, line 27, in
from gspylib.common.Common import DefaultValue
File “/opt/mogdb/tool/script/gspylib/common/Common.py”, line 102, in
from os_platform.UserPlatform import g_Platform
File “/opt/mogdb/tool/script/os_platform/UserPlatform.py”, line 67, in
g_Platform = UserPlatform().userPlatform
File “/opt/mogdb/tool/script/os_platform/UserPlatform.py”, line 50, in init
SUPPORT_WHOLE_PLATFORM_LIST))
Exception: [GAUSS-51900] : The current OS is not supported.Supported platforms are: [‘suse’, ‘redhat’, ‘centos’, ‘euleros’, ‘openeuler’, ‘kylin’, ‘fusionos’, ‘asianux’, ‘debian’, ‘ubuntu’, ‘uniontech’]
报一个gauss-s1900 的错误
直接改异常处理的代码,最简单的方法注释掉
[omm@mogdb ~]$ vim /opt/mogdb/tool/script/os_platform/UserPlatform.py
47到50行
47 #if dist_name.lower() not in SUPPORT_WHOLE_PLATFORM_LIST:
48 # raise Exception(ErrorCode.GAUSS_519[“GAUSS_51900”] +
49 # “Supported platforms are: %s.” % str(
50 # SUPPORT_WHOLE_PLATFORM_LIST))
184-201 行
vim /opt/mogdb/tool/script/os_platform/rhel_platform.py
182 version[0:2] in UOS_VERSION_LIST:
183 return dist_name.lower(), version[0:2]
184 #else:
185 # if dist_name.lower() == CENTOS and os.path.isfile(
186 # os.path.join(“/etc”, “euleros-release”)) and
187 # (version[0:3] in SUPPORT_EULEROS_VERSION_LIST):
188 # return EULEROS, version[0:3]
189 # if dist_name.lower() == EULEROS:
190 # raise Exception(ErrorCode.GAUSS_519[“GAUSS_51900”] +
191 # " The current system is: %s%s%s" % (
192 # dist_name.lower(),
193 # version[0:3], current_id))
194 # if dist_name.lower() == DEBIAN:
195 # raise Exception(ErrorCode.GAUSS_519[“GAUSS_51900”] +
196 # " The current system is: %s/%s" % (
197 # dist_name.lower(), version))
198 # else:
199 # raise Exception(ErrorCode.GAUSS_519[“GAUSS_51900”] +
200 # " The current system is: %s%s" % (
201 # dist_name.lower(), version[0:3]))
202 except Exception as e:
203 raise Exception(str(e))
又是新一个错误
[omm@mogdb ~]$ gs_om -t stop
Traceback (most recent call last):
File “/opt/mogdb/tool/script/gspylib/threads/SshTool.py”, line 44, in
import paramiko
File “/opt/mogdb/tool/script/domain_utils/sql_handler/…/…/…/lib/paramiko/init.py”, line 22, in
from paramiko.transport import SecurityOptions, Transport
File “/opt/mogdb/tool/script/domain_utils/sql_handler/…/…/…/lib/paramiko/transport.py”, line 89, in
from paramiko.dsskey import DSSKey
File “/opt/mogdb/tool/script/domain_utils/sql_handler/…/…/…/lib/paramiko/dsskey.py”, line 37, in
from paramiko.pkey import PKey
File “/opt/mogdb/tool/script/domain_utils/sql_handler/…/…/…/lib/paramiko/pkey.py”, line 31, in
import bcrypt
File “/opt/mogdb/tool/script/domain_utils/sql_handler/…/…/…/lib/bcrypt/init.py”, line 25, in
from . import _bcrypt # type: ignore
ImportError: this module was compiled for Python 3.7
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/opt/mogdb/tool/script/gs_om”, line 31, in
from gspylib.common.ParallelBaseOM import ParallelBaseOM
File “/opt/mogdb/tool/script/gspylib/common/ParallelBaseOM.py”, line 28, in
from gspylib.threads.SshTool import SshTool
File “/opt/mogdb/tool/script/gspylib/threads/SshTool.py”, line 46, in
raise Exception(ErrorCode.GAUSS_522[“GAUSS_52200”] % "paramiko, "+str(ex))
Exception: [GAUSS-52200] : Unable to import module: paramiko, .this module was compiled for Python 3
[root@mogdb script]# rm /usr/bin/python3
rm:是否删除符号链接 ‘/usr/bin/python3’?y
[root@mogdb script]# ln -s /usr/local/bin/python3.7 /usr/bin/python3
[root@mogdb script]#
代码用的是python 3 而python 3 是python 3.6 ,切换,尝试一下:
[omm@mogdb ~]$ gs_om -t stop
Traceback (most recent call last):
File “/opt/mogdb/tool/script/gs_om”, line 29, in
from gspylib.common.ParameterParsecheck import Parameter
File “/opt/mogdb/tool/script/gspylib/common/ParameterParsecheck.py”, line 27, in
from gspylib.common.Common import DefaultValue
File “/opt/mogdb/tool/script/gspylib/common/Common.py”, line 20, in
import ctypes
File “/usr/local/lib/python3.7/ctypes/init.py”, line 7, in
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named ‘_ctypes’
尝试解决
[root@mogdb Python-3.7.15]# yum -y install libffi-devel
上次元数据过期检查:2:57:31 前,执行于 2024年06月11日 星期二 14时20分13秒。
软件包 libffi-devel-3.1-24.el8.x86_64 已安装。
依赖关系解决。
无需任何处理。
完毕!
按之前步骤,重新编译一下python 3.7 , 再次尝试
[root@mogdb Python-3.7.15]# su - omm 上一次登录:二 6月 11 17:15:30 CST 2024pts/0 上 [omm@mogdb ~]$ gs_om -t start Starting cluster.
[SUCCESS] mogdb 2024-06-11 17:26:15.282 [unknown] [unknown] localhost 23332150211584 0[0:0#0] 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets 2024-06-11 17:26:15.282 [unknown] [unknown] localhost 23332150211584 0[0:0#0] 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
Successfully started.
问题解决。
参考文档
rocky linux 8.9




