目录
有时间,安装下mogdb这款数据库,在安装过程中,难免会遇到一些报错,导致安装不成功的情况,我把我在安装中遇到的一些问题,和大家分享出来,一方面是做个笔记,另一方面可以让其他小伙伴在遇到类似的问题,可以方便解决。
本文是基于centos7.9安装的mogdb3.0.1数据库
1、下载mogdb二进制安装包
下载地址:https://mogdb.io/downloads/mogdb/
说明:从图中可以看到,mogdb 3.0.1版本只支持centos 7的版本
centos 6.x的版本是不支持的(mogdb 2.0.3版本也支持centos7的版本)
注意:如果你的实验环境或生产环境是centos6.x、centos 8.x 和redhat 6.x redhat 8.x的版本,要重新安装操作系统。
下载完成,如下
实验环境 | ip地址 | mogdb版本 | 安装方式 |
---|---|---|---|
centos 7.9 | 10.201.0.221 | 3.0.1 | 单机 |
3.1、先创建目录
mkdir -p /opt/mogdb/software
通过xftp开始上传安装包
3.2、创建组和用户
创建组
groupadd dbgrp -g 2000
创建用户并指定用户的组为dbgrp
useradd omm -g 2000 -u 2000
给用户omm设置密码
passwd omm
qwe123
qwe123
设置密码也可以使用如下方式
echo "qwe123" | passwd --stdin omm
3.3、创建安装目录并修改目录权限
mkdir -p /opt/mogdb/data
chown -r omm:dbgrp /opt/mogdb
3.4、开始解压二进制安装包
修改安装包的用户和组,方便后面进行解压
chown omm:dbgrp mogdb-3.0.1-centos-x86_64.tar.gz
使用用户omm进行解压,解压到当前目录中
su - omm
cd /opt/mogdb/software
tar -xvf mogdb-3.0.1-centos-x86_64.tar.gz
我们发现解压出来的还是压缩包
这些压缩包还需要进一步解压到本地
下面是二种批量解压的方法
for tar in *.tar.gz; do tar xvf $tar; done
或
ls *.tar.gz|xargs -n1 tar xzvf
解压完成后,最终的目录内容是这样的
3.5、使用yum方式安装依赖包
yum install -y libaio-devel
3.6、设置环境变量
vi /home/omm/.bashrc
#家目录
export gausshome=/opt/mogdb/software
export path=$gausshome/bin:$pat
export ld_library_path=$gausshome/lib:$ld_library_path
使变量生效
source /home/omm/.bashrc
报错一
注意:下面是官方提供的添加环境变量的方法,但是这种添加环境变量是有问题的
echo “export gausshome=/opt/mogdb/software” >> /home/omm/.bashrc &&
echo "export path=path " >> /home/omm/.bashrc &&
echo “export ld_library_path=ld_library_path” >> /home/omm/.bashrc
我们发现里面的内容不是我们要求的内容。
而且在后面进行初始化数据库的过程种会报如下错误
bin/gs_initdb: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: no such file or directory
使用如下命令开始初始化数据库
pwd
/opt/mogdb/software
bin/gs_initdb --pgdata=/opt/mogdb/data --nodename=primary --pwpasswd=qwe123 --encoding=utf-8 --locale=en_us.utf-8
开始执行
[omm@localhost software]$ bin/gs_initdb --pgdata=/opt/mogdb/data --nodename=primary --pwpasswd=qwe123 --encoding=utf-8 --locale=en_us.utf-8
the files belonging to this database system will be owned by user "omm".
this user must also own the server process.
the database cluster will be initialized with locale "en_us.utf-8".
the default text search configuration will be set to "english".
fixing permissions on existing directory /opt/mogdb/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32mb
creating configuration files ... ok
begin init undo subsystem meta.
[init undo] init undo subsystem meta successfully.
creating template1 database in /opt/mogdb/data/base/1 ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
2022-08-29 02:52:11.237 [unknown] [unknown] localhost 140043335244032 0[0:0#0] [backend] warning: macaddr is 10350/3565745836, sysidentifier is 678352008/4138495285, randomnum is 2177199413
ok
initializing pg_authid ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
passwd must contain at least eight characters \\这里报错
gs_initdb: removing contents of data directory "/opt/mogdb/data"
未安装成功
报错二
由于密码的问题报错
设置的密码为:pwpasswd=qwe123
passwd must contain at least eight characters
设置的密码为:pwpasswd=qwer1234
password must contain at least three kinds of characters.
以上都是不符合密码要求,无法安装成功的
修改好密码后,继续安装
omm@master software]$ bin/gs_initdb --pgdata=/opt/mogdb/data --nodename=primary --pwpasswd=qwer@1234 --encoding=utf-8 --locale=en_us.utf-8
the files belonging to this database system will be owned by user "omm".
this user must also own the server process.
the database cluster will be initialized with locale "en_us.utf-8".
the default text search configuration will be set to "english".
fixing permissions on existing directory /opt/mogdb/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32mb
creating configuration files ... ok
begin init undo subsystem meta.
[init undo] init undo subsystem meta successfully.
creating template1 database in /opt/mogdb/data/base/1 ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
2022-08-29 03:25:47.655 [unknown] [unknown] localhost 140218595481856 0[0:0#0] [backend] warning: macaddr is 10350/3565745836, sysidentifier is 678352008/4138468234, randomnum is 1256063882
ok
initializing pg_authid ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
setting password ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
initializing dependencies ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
loading pl/pgsql server-side language ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
creating system views ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
creating performance views ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
loading system objects' descriptions ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
creating collations ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
creating conversions ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
creating dictionaries ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
setting privileges on built-in objects ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
initialize global configure for bucketmap length ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
creating information schema ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
loading foreign-data wrapper for distfs access ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
loading foreign-data wrapper for hdfs access ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
loading foreign-data wrapper for log access ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
loading hstore extension ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
loading foreign-data wrapper for mot access ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
loading security plugin ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
update system tables ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
creating snapshots catalog ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
vacuuming database template1 ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
copying template1 to template0 ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
copying template1 to postgres ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
ok
freezing database template0 ... ok
freezing database template1 ... ok
freezing database postgres ... ok
warning: enabling "trust" authentication for local connections
you can change this by editing pg_hba.conf or using the option -a, or
--auth-local and --auth-host, the next time you run gs_initdb.
success. you can now start the database server of single node using:
bin/mogdb -d /opt/mogdb/data --single_node
or
bin/gs_ctl start -d /opt/mogdb/data -z single_node -l logfile
至此、安装成功
vi /opt/mogdb/data/postgresql.conf
#端口使用26000
port=26000
#监听地址:不限制ip
listen_addresses = '0.0.0.0'
password_encryption_type = 0
log_directory = 'pg_log'
remote_read_mode=non_authentication
vi /opt/mogdb/data/pg_hba.conf
echo "host all all 0.0.0.0/0 md5
或者使用如下方式添加
echo "port=26000" >> /opt/mogdb/data/postgresql.conf
echo "listen_addresses = '0.0.0.0'" >> /opt/mogdb/data/postgresql.conf
echo "password_encryption_type = 0" >> /opt/mogdb/data/postgresql.conf
echo "log_directory = 'pg_log'" >> /opt/mogdb/data/postgresql.conf
echo "remote_read_mode=non_authentication" >> /opt/mogdb/data/postgresql.conf
echo "host all all 0.0.0.0/0 md5" >> /opt/mogdb/data/pg_hba.conf
gs_ctl start -d /opt/mogdb/data
[omm@master software]$ gs_ctl start -d /opt/mogdb/data
[2022-08-29 03:30:53.313][58788][][gs_ctl]: gs_ctl started,datadir is /opt/mogdb/data
[2022-08-29 03:30:53.467][58788][][gs_ctl]: waiting for server to start...
.0 log: [alarm module]can not read gauss_warning_type env.
0 log: [alarm module]host name: master
0 log: [alarm module]host ip: 10.201.0.221
0 log: [alarm module]get env gs_cluster_name failed!
0 warning: failed to open feature control file, please check whether it exists: filename=gaussdb.version, errno=2, errmessage=no such file or directory.
0 warning: failed to parse feature control file: gaussdb.version.
0 warning: failed to load the product control file, so gaussdb cannot distinguish product version.
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
2022-08-29 03:30:53.870 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: when starting as multi_standby mode, we couldn't support data replicaton.
gaussdb.state does not exist, and skipt setting since it is optional.2022-08-29 03:30:53.962 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: [alarm module]can not read gauss_warning_type env.
2022-08-29 03:30:53.962 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: [alarm module]host name: master
2022-08-29 03:30:53.962 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: [alarm module]host ip: 10.201.0.221
2022-08-29 03:30:53.962 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: [alarm module]get env gs_cluster_name failed!
2022-08-29 03:30:54.307 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: loaded library "security_plugin"
2022-08-29 03:30:54.311 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] warning: could not create any ha tcp/ip sockets
2022-08-29 03:30:54.311 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] warning: could not create any ha tcp/ip sockets
2022-08-29 03:30:54.476 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] warning: no explicit ip is configured for listen_addresses guc.
2022-08-29 03:30:54.477 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: initnuma numanodenum: 1 numa_distribute_mode: none inheritthreadpool: 0.
2022-08-29 03:30:54.478 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: reserved memory for backend threads is: 220 mb
2022-08-29 03:30:54.478 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: reserved memory for wal buffers is: 128 mb
2022-08-29 03:30:54.478 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: set max backend reserve memory is: 348 mb, max dynamic memory is: 11064 mb
2022-08-29 03:30:54.478 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: shared memory 363 mbytes, memory context 11412 mbytes, max process memory 12288 mbytes
2022-08-29 03:30:54.554 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [cache] log: set data cache size(402653184)
2022-08-29 03:30:54.576 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [cache] log: set metadata cache size(134217728)
2022-08-29 03:30:54.661 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [segment_page] log: segment-page constants: df_map_size: 8156, df_map_bit_cnt: 65248, df_map_group_extents: 4175872, ipblock_size: 8168, extents_per_ipblock: 1021, ipblock_group_size: 4090, bmt_header_level0_total_pages: 8323072, bktmapentrynumberperblock: 2038, bktmapblocknumber: 25, bktbitmaxmapcnt: 512
2022-08-29 03:30:54.714 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: mogdb: fsync file "/opt/mogdb/data/gaussdb.state.temp" success
2022-08-29 03:30:54.714 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: create gaussdb state file success: db state(starting_state), server mode(normal), connection index(1)
2022-08-29 03:30:54.738 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: max_safe_fds = 976, usable_fds = 1000, already_open = 14
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:|/usr/libexec/
2022-08-29 03:30:54.742 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: user configure file is not found, it will be created.
2022-08-29 03:30:54.754 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: the configure file /opt/mogdb/software/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. please create it by root user!
2022-08-29 03:30:54.754 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [backend] log: failed to parse cgroup config file.
2022-08-29 03:30:54.777 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [executor] warning: failed to obtain environment value $gausslog!
2022-08-29 03:30:54.777 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [executor] detail: n/a
2022-08-29 03:30:54.777 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [executor] cause: incorrect environment value.
2022-08-29 03:30:54.777 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [executor] action: please refer to backend log for more details.
2022-08-29 03:30:54.778 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [executor] warning: failed to obtain environment value $gausslog!
2022-08-29 03:30:54.778 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [executor] detail: n/a
2022-08-29 03:30:54.778 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [executor] cause: incorrect environment value.
2022-08-29 03:30:54.778 [unknown] [unknown] localhost 139670608431360 0[0:0#0] 0 [executor] action: please refer to backend log for more details.
.
[2022-08-29 03:30:55.801][58788][][gs_ctl]: done
[2022-08-29 03:30:55.802][58788][][gs_ctl]: server started (/opt/mogdb/data)
[omm@master software]$
启动成功
直接执行gsql,发现如下错误
[omm@master bin]$ gsql
gsql: fatal: database "omm" does not exist
使用postgres库登录
[omm@master bin]$ gsql -d postgres
gsql ((mogdb 3.0.1 build 1a363ea9) compiled at 2022-08-05 17:31:04 commit 0 last mr )
non-ssl connection (ssl connection is recommended when requiring high-security)
type "help" for help.
mogdb=#
登录成功。
- 错误一、环境变量未配置好
error while loading shared libraries: libssl.so.1.1: cannot open shared object file: no such file or directory
报错一
注意:下面是官方提供的添加环境变量的方法,但是这种添加环境变量是有问题的
echo “export gausshome=/opt/mogdb/software” >> /home/omm/.bashrc &&
echo "export path=path " >> /home/omm/.bashrc &&
echo “export ld_library_path=ld_library_path” >> /home/omm/.bashrc
我们发现里面的内容不是我们要求的内容。
而且在后面进行初始化数据库的过程种会报如下错误
bin/gs_initdb: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: no such file or directory
- 错误二、密码不符合要求
passwd must contain at least eight characters
password must contain at least three kinds of characters.
报错二
由于密码的问题报错
设置的密码为:pwpasswd=qwe123
passwd must contain at least eight characters
设置的密码为:pwpasswd=qwer1234
password must contain at least three kinds of characters.
以上都是不符合密码要求,无法安装成功的
- 错误三、登录时未指定库
[omm@master bin]$ gsql
gsql: fatal: database “omm” does not exist
使用postgres库登录
[omm@master bin]$ gsql -d postgres