暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

MogDB安装FATAL: could not create shared memory segment

Xiaofei Huangfu 2024-09-13
133

适用范围
MogDB 5.0.8+Kylin Linux Advanced Server release V10 (SP3)

问题概述
通过ptk安装MogDB主从环境,集群无法正常启动。

问题原因
操作系统vm.min_free_bytes参数过大

解决方案
操作系统vm.min_free_bytes参数按物理内存5%设置。环境物理内存32G,vm.min_free_bytes设置为167772就可以正常启动。

以下是分析处理过程
1、pkt checkos检查操作系统环境

[root@mydb01 software]# ./ptk checkos -i A --detail -f config.2024-08-29T17_07_01.yaml
INFO[2024-08-29T17:14:26.464] prechecking dependent tools…
INFO[2024-08-29T17:14:27.502] [192.168.0.11][omm] check port 26000
INFO[2024-08-29T17:14:27.502] [192.168.0.12][omm] check port 26000
INFO[2024-08-29T17:14:27.514] [192.168.0.11][omm] port 26000 is free
INFO[2024-08-29T17:14:27.812] [192.168.0.12][omm] port 26000 is free
INFO[2024-08-29T17:14:27.816] [192.168.0.11][omm] kernel version: 4.19.90-52.15.v2207.ky10.x86_64
INFO[2024-08-29T17:14:27.894] [192.168.0.12][omm] kernel version: 4.19.90-52.15.v2207.ky10.x86_64
INFO[2024-08-29T17:14:27.899] [192.168.0.11][omm] swap memory 0kB, total memory 31616980kB
INFO[2024-08-29T17:14:27.980] [192.168.0.12][omm] swap memory 0kB, total memory 31616980kB
WARN[2024-08-29T17:14:34.845] [192.168.0.11][omm] kernel.shmmax=137438953472, expect 4398046511104
WARN[2024-08-29T17:14:34.908] [192.168.0.11][omm] kernel.shmall=67108864, expect 1073741824
INFO[2024-08-29T17:14:34.908] [192.168.0.11][omm] check kernel.core_pattern
INFO[2024-08-29T17:14:34.915] [192.168.0.11][omm] check RemoveIPC value
INFO[2024-08-29T17:14:34.924] [192.168.0.11][omm] check KillUserProcesses value
WARN[2024-08-29T17:14:35.324] [192.168.0.12][omm] kernel.shmmax=137438953472, expect 4398046511104
WARN[2024-08-29T17:14:36.889] [192.168.0.12][omm] kernel.shmall=67108864, expect 1073741824
INFO[2024-08-29T17:14:37.300] [192.168.0.12][omm] check kernel.core_pattern
INFO[2024-08-29T17:14:37.463] [192.168.0.12][omm] check RemoveIPC value
INFO[2024-08-29T17:14:37.632] [192.168.0.12][omm] check KillUserProcesses value
WARN[2024-08-29T17:14:38.912] [192.168.0.11][omm] device(/dev/vda) readahead value=8192, expect 16384.
WARN[2024-08-29T17:14:38.912] [192.168.0.11][omm] device(/dev/vdb) readahead value=8192, expect 16384.
WARN[2024-08-29T17:14:38.912] [192.168.0.11][omm] device(/dev/vdc) readahead value=8192, expect 16384.
WARN[2024-08-29T17:14:39.149] [192.168.0.12][omm] device(/dev/vda) readahead value=8192, expect 16384.
WARN[2024-08-29T17:14:39.149] [192.168.0.12][omm] device(/dev/vdb) readahead value=8192, expect 16384.
WARN[2024-08-29T17:14:39.149] [192.168.0.12][omm] device(/dev/vdc) readahead value=8192, expect 16384.
INFO[2024-08-29T17:14:39.410] [192.168.0.12][omm] platform: kylin_V10_64bit
INFO[2024-08-29T17:14:39.410] [192.168.0.11][omm] platform: kylin_V10_64bit
INFO[2024-08-29T17:14:39.746] [192.168.0.11][omm] locale: LANG=en_US.UTF-8
INFO[2024-08-29T17:14:39.826] [192.168.0.12][omm] locale: LANG=en_US.UTF-8
INFO[2024-08-29T17:14:39.831] [192.168.0.11][omm] timezone: +0800
INFO[2024-08-29T17:14:39.913] [192.168.0.12][omm] timezone: +0800
INFO[2024-08-29T17:14:39.996] all checkers finished
INFO[2024-08-29T17:14:39.996] time elapsed: 14s

Check Results

            Item                |  Level  |                            Message                             

------------------------------------±--------±---------------------------------------------------------------
A1.Check_OS_Version | OK |
A2.Check_Kernel_Version | OK |
A3.Check_Unicode | OK |
A4.Check_TimeZone | OK |
A5.Check_Swap_Memory_Configure | OK |
A6.Check_SysCtl_Parameter | Warning | [192.168.0.11]:
| | Warning: kernel.shmmax=137438953472, expect 4398046511104
| | Warning: kernel.shmall=67108864, expect 1073741824
| | [192.168.0.12]:
| | Warning: kernel.shmmax=137438953472, expect 4398046511104
| | Warning: kernel.shmall=67108864, expect 1073741824
A7.Check_FileSystem_Configure | OK |
A8.Check_Disk_Configure | OK |
A9.Check_BlockDev_Configure | Warning | [192.168.0.12]:
| | Warning: device(/dev/vda) readahead value=8192, expect 16384.
| | Warning: device(/dev/vdb) readahead value=8192, expect 16384.
| | Warning: device(/dev/vdc) readahead value=8192, expect 16384.
| | [192.168.0.11]:
| | Warning: device(/dev/vda) readahead value=8192, expect 16384.
| | Warning: device(/dev/vdb) readahead value=8192, expect 16384.
| | Warning: device(/dev/vdc) readahead value=8192, expect 16384.
A9.Check_Logical_Block | OK |
A10.Check_Asynchronous_IO_Request | OK |
A10.Check_IO_Configure | OK |
A10.Check_NR_Request | OK |
A11.Check_Network_Configure | OK |
A12.Check_Time_Consistency | OK |
A13.Check_Firewall_Status | OK |
A14.Check_THP_Status | OK |
A15.Check_Dependent_Package | OK |
A16.Check_CPU_Instruction_Set | OK |
A17.Check_Port | OK |
A18.Check_Selinux | OK |
A19.Check_User_Ulimit | OK |
A20.Check_Directory | OK |
Total count 23, abnormal count 0, warning count 2
[root@mydb01 software]#
ptk checkos检查通过,符合安装条件。
2、通过ptk安装MogDB
[root@mydb01 software]# ./ptk install -y -f config.2024-08-29T17_07_01.yaml --pkg /opt/software/MogDB-5.0.8-Kylin-x86_64-all.tar.gz
INFO[2024-08-29T17:24:35.797] PTK Version: 1.6.3 release
INFO[2024-08-29T17:24:35.797] load config from config.2024-08-29T17_07_01.yaml
INFO[2024-08-29T17:24:35.798] start check hostname …
INFO[2024-08-29T17:24:35.992] check hostname success
INFO[2024-08-29T17:24:35.992] start check os …
INFO[2024-08-29T17:24:35.993] prechecking dependent tools…
WARN[2024-08-29T17:24:36.874] [192.168.0.11][omm] device(/dev/vda) readahead value=8192, expect 16384.
WARN[2024-08-29T17:24:36.874] [192.168.0.11][omm] device(/dev/vdb) readahead value=8192, expect 16384.
WARN[2024-08-29T17:24:36.874] [192.168.0.11][omm] device(/dev/vdc) readahead value=8192, expect 16384.
WARN[2024-08-29T17:24:37.214] [192.168.0.12][omm] device(/dev/vda) readahead value=8192, expect 16384.
WARN[2024-08-29T17:24:37.214] [192.168.0.12][omm] device(/dev/vdb) readahead value=8192, expect 16384.
WARN[2024-08-29T17:24:37.214] [192.168.0.12][omm] device(/dev/vdc) readahead value=8192, expect 16384.
INFO[2024-08-29T17:24:37.483] [192.168.0.11][omm] kernel version: 4.19.90-52.15.v2207.ky10.x86_64
INFO[2024-08-29T17:24:37.566] [192.168.0.12][omm] kernel version: 4.19.90-52.15.v2207.ky10.x86_64
INFO[2024-08-29T17:24:37.655] [192.168.0.12][omm] platform: kylin_V10_64bit
INFO[2024-08-29T17:24:37.655] [192.168.0.11][omm] platform: kylin_V10_64bit
INFO[2024-08-29T17:24:38.020] [192.168.0.11][omm] check kernel.core_pattern
INFO[2024-08-29T17:24:38.026] [192.168.0.11][omm] check RemoveIPC value
INFO[2024-08-29T17:24:38.036] [192.168.0.11][omm] check KillUserProcesses value
INFO[2024-08-29T17:24:40.547] [192.168.0.12][omm] check kernel.core_pattern
INFO[2024-08-29T17:24:40.703] [192.168.0.12][omm] check RemoveIPC value
INFO[2024-08-29T17:24:40.864] [192.168.0.12][omm] check KillUserProcesses value
INFO[2024-08-29T17:24:48.083] [192.168.0.11][omm] locale: LANG=en_US.UTF-8
INFO[2024-08-29T17:24:48.161] [192.168.0.12][omm] locale: LANG=en_US.UTF-8
INFO[2024-08-29T17:24:48.166] [192.168.0.11][omm] timezone: +0800
INFO[2024-08-29T17:24:48.250] [192.168.0.12][omm] timezone: +0800
INFO[2024-08-29T17:24:48.254] [192.168.0.11][omm] swap memory 0kB, total memory 31616980kB
INFO[2024-08-29T17:24:48.336] [192.168.0.12][omm] swap memory 0kB, total memory 31616980kB
INFO[2024-08-29T17:24:48.336] [192.168.0.12][omm] check port 26000
INFO[2024-08-29T17:24:48.336] [192.168.0.11][omm] check port 26000
INFO[2024-08-29T17:24:48.347] [192.168.0.11][omm] port 26000 is free
INFO[2024-08-29T17:24:48.652] [192.168.0.12][omm] port 26000 is free
INFO[2024-08-29T17:24:49.438] all checkers finished
INFO[2024-08-29T17:24:49.439] time elapsed: 13s
INFO[2024-08-29T17:24:49.439] check os success
INFO[2024-08-29T17:24:49.439] start check distro …
INFO[2024-08-29T17:24:49.439] check distro success
INFO[2024-08-29T17:24:49.439] start check user …
INFO[2024-08-29T17:24:49.524] check user success
INFO[2024-08-29T17:24:49.524] start check port …
INFO[2024-08-29T17:24:49.524] checking port 26000 on host 192.168.0.11 (db listen port) …
INFO[2024-08-29T17:24:49.524] checking port 26000 on host 192.168.0.12 (db listen port) …
INFO[2024-08-29T17:24:49.535] checking port 26001 on host 192.168.0.11 (db HA port) …
INFO[2024-08-29T17:24:49.851] checking port 26001 on host 192.168.0.12 (db HA port) …
INFO[2024-08-29T17:24:50.164] check port success
INFO[2024-08-29T17:24:51.305] [192.168.0.11][omm] create os user omm, group omm
INFO[2024-08-29T17:24:51.388] [192.168.0.12][omm] create os user omm, group omm
INFO[2024-08-29T17:24:51.888] [192.168.0.11][omm] set ulimit configs
INFO[2024-08-29T17:24:52.033] [192.168.0.12][omm] set ulimit configs
INFO[2024-08-29T17:24:52.122] start prepare installation package …
INFO[2024-08-29T17:24:52.122] installation package is ready
INFO[2024-08-29T17:24:52.123] parse installation package …
INFO[2024-08-29T17:24:58.199] start validate installation package md5…
INFO[2024-08-29T17:24:58.474] validate installation package md5 success
INFO[2024-08-29T17:24:58.474] db product: MogDB, version: 5.0.8, number: 92.930, commit_id: 41aa0432
INFO[2024-08-29T17:24:58.905] extract MogDB-5.0.8-Kylin-64bit.tar.gz to dir /tmp/ptk_tmp_921928293
INFO[2024-08-29T17:25:01.538] execute command: mogdb --version
INFO[2024-08-29T17:25:01.613] parse installation package success
INFO[2024-08-29T17:25:01.613] start complete the configuration …
INFO[2024-08-29T17:25:01.613] complete the configuration success
INFO[2024-08-29T17:25:01.613] save the topology to metadata
INFO[2024-08-29T17:25:01.614] start distribute installation package …
INFO[2024-08-29T17:25:03.576] distrubite packages success
INFO[2024-08-29T17:25:03.576] start install logic nodes …
INFO[2024-08-29T17:25:03.576] deploy db to omm@192.168.0.11
INFO[2024-08-29T17:25:03.576] deploy db to omm@192.168.0.12
INFO[2024-08-29T17:25:03.577] [192.168.0.12][omm] make user omm’s dir(s): /data/mogdb
INFO[2024-08-29T17:25:03.577] [192.168.0.11][omm] make user omm’s dir(s): /data/mogdb
INFO[2024-08-29T17:25:03.666] [192.168.0.11][omm] clean user omm’s ipc resource
INFO[2024-08-29T17:25:03.915] [192.168.0.11][omm] make user omm’s dir(s): /data/mogdb/tool,/data/mogdb/tool/ptk_tool/bin
INFO[2024-08-29T17:25:03.985] [192.168.0.12][omm] clean user omm’s ipc resource
INFO[2024-08-29T17:25:04.221] [192.168.0.12][omm] make user omm’s dir(s): /data/mogdb/tool,/data/mogdb/tool/ptk_tool/bin
INFO[2024-08-29T17:25:04.751] [192.168.0.11][omm] extract MogDB-5.0.8-Kylin-x86_64-all.tar.gz to dir /data/mogdb/tool
INFO[2024-08-29T17:25:05.032] [192.168.0.12][omm] extract MogDB-5.0.8-Kylin-x86_64-all.tar.gz to dir /data/mogdb/tool
INFO[2024-08-29T17:25:05.988] [192.168.0.11][omm] extract MogDB-5.0.8-Kylin-64bit-om.tar.gz to dir /data/mogdb/tool
INFO[2024-08-29T17:25:06.244] [192.168.0.12][omm] extract MogDB-5.0.8-Kylin-64bit-om.tar.gz to dir /data/mogdb/tool
INFO[2024-08-29T17:25:06.461] [192.168.0.11][omm] try to fix psutil python lib
INFO[2024-08-29T17:25:06.710] [192.168.0.12][omm] try to fix psutil python lib
INFO[2024-08-29T17:25:06.736] [192.168.0.11][omm] write file /data/mogdb/tool/script/py_pstree.py
INFO[2024-08-29T17:25:06.876] [192.168.0.11][omm] write file /data/mogdb/tool/ptk_tool/bin/README.md
INFO[2024-08-29T17:25:06.984] [192.168.0.12][omm] write file /data/mogdb/tool/script/py_pstree.py
INFO[2024-08-29T17:25:07.099] [192.168.0.11][omm] write file /data/mogdb/tool/ptk_tool/bin/pscp
INFO[2024-08-29T17:25:07.131] [192.168.0.12][omm] write file /data/mogdb/tool/ptk_tool/bin/README.md
INFO[2024-08-29T17:25:07.337] [192.168.0.11][omm] write file /data/mogdb/tool/ptk_tool/bin/pssh
INFO[2024-08-29T17:25:07.362] [192.168.0.12][omm] write file /data/mogdb/tool/ptk_tool/bin/pscp
INFO[2024-08-29T17:25:07.562] [192.168.0.11][omm] write file /data/mogdb/tool/ptk_tool/bin/task_pool.py
INFO[2024-08-29T17:25:07.600] [192.168.0.12][omm] write file /data/mogdb/tool/ptk_tool/bin/pssh
INFO[2024-08-29T17:25:07.796] [192.168.0.11][omm] make user omm’s dir(s): /data/mogdb/app
INFO[2024-08-29T17:25:07.825] [192.168.0.12][omm] write file /data/mogdb/tool/ptk_tool/bin/task_pool.py
INFO[2024-08-29T17:25:08.061] [192.168.0.12][omm] make user omm’s dir(s): /data/mogdb/app
INFO[2024-08-29T17:25:08.066] [192.168.0.11][omm] extract MogDB-5.0.8-Kylin-64bit.tar.gz to dir /data/mogdb/app
INFO[2024-08-29T17:25:08.331] [192.168.0.12][omm] extract MogDB-5.0.8-Kylin-64bit.tar.gz to dir /data/mogdb/app
INFO[2024-08-29T17:25:10.767] [192.168.0.11][omm] change mode of /data/mogdb/app to 700
INFO[2024-08-29T17:25:10.868] [192.168.0.11][omm] make user omm’s dir(s): /data/mogdb/app/share/postgresql
INFO[2024-08-29T17:25:11.045] [192.168.0.12][omm] change mode of /data/mogdb/app to 700
INFO[2024-08-29T17:25:11.146] [192.168.0.12][omm] make user omm’s dir(s): /data/mogdb/app/share/postgresql
INFO[2024-08-29T17:25:11.305] [192.168.0.11][omm] copy /data/mogdb/tool/script/gspylib/etc/sql/pmk_schema.sql to /data/mogdb/app/share/postgresql
INFO[2024-08-29T17:25:11.392] [192.168.0.11][omm] copy /data/mogdb/tool/script/gspylib/etc/sql/pmk_schema_single_inst.sql to /data/mogdb/app/share/postgresql
INFO[2024-08-29T17:25:11.481] [192.168.0.11][omm] write file /data/mogdb/app/bin/transfer.py
INFO[2024-08-29T17:25:11.622] [192.168.0.11][omm] set user omm profiles
INFO[2024-08-29T17:25:11.670] [192.168.0.12][omm] copy /data/mogdb/tool/script/gspylib/etc/sql/pmk_schema.sql to /data/mogdb/app/share/postgresql
INFO[2024-08-29T17:25:11.762] [192.168.0.12][omm] copy /data/mogdb/tool/script/gspylib/etc/sql/pmk_schema_single_inst.sql to /data/mogdb/app/share/postgresql
INFO[2024-08-29T17:25:11.854] [192.168.0.12][omm] write file /data/mogdb/app/bin/transfer.py
INFO[2024-08-29T17:25:11.999] [192.168.0.12][omm] set user omm profiles
INFO[2024-08-29T17:25:12.202] [192.168.0.11][omm] validate and try to fix ld library for gs_initdb
INFO[2024-08-29T17:25:12.292] [192.168.0.11][omm] validate and try to fix ld library for mogdb
INFO[2024-08-29T17:25:12.384] [192.168.0.11][omm] make user omm’s dir(s): /data/mogdb/log/gs_profile,/data/mogdb/log/pg_log,/data/mogdb/log/pg_audit,/data/mogdb/log/bin,/data/mogdb/log/pg_log/dn_6001,/data/mogdb/log/pg_audit/dn_6001
INFO[2024-08-29T17:25:12.618] [192.168.0.12][omm] validate and try to fix ld library for gs_initdb
INFO[2024-08-29T17:25:12.715] [192.168.0.12][omm] validate and try to fix ld library for mogdb
INFO[2024-08-29T17:25:12.812] [192.168.0.12][omm] make user omm’s dir(s): /data/mogdb/log/gs_profile,/data/mogdb/log/pg_log,/data/mogdb/log/pg_audit,/data/mogdb/log/bin,/data/mogdb/log/pg_log/dn_6002,/data/mogdb/log/pg_audit/dn_6002
INFO[2024-08-29T17:25:14.659] [192.168.0.11][omm] make user omm’s dir(s): /data/mogdb/tmp
INFO[2024-08-29T17:25:14.939] [192.168.0.11][omm] save version to upgrade_version
INFO[2024-08-29T17:25:15.256] [192.168.0.12][omm] make user omm’s dir(s): /data/mogdb/tmp
INFO[2024-08-29T17:25:15.265] [192.168.0.11][omm] create file cluster_manual_start
INFO[2024-08-29T17:25:15.358] [192.168.0.11][omm] generate cluster_static_config file
INFO[2024-08-29T17:25:15.500] [192.168.0.11][omm] make user omm’s dir(s): /data/mogdb/data
INFO[2024-08-29T17:25:15.527] [192.168.0.12][omm] save version to upgrade_version
INFO[2024-08-29T17:25:15.764] [192.168.0.11][omm] write file /data/mogdb/tool/.ptk_deployer
INFO[2024-08-29T17:25:15.868] [192.168.0.12][omm] create file cluster_manual_start
INFO[2024-08-29T17:25:15.960] [192.168.0.12][omm] generate cluster_static_config file
INFO[2024-08-29T17:25:16.105] [192.168.0.12][omm] make user omm’s dir(s): /data/mogdb/data
INFO[2024-08-29T17:25:16.382] [192.168.0.12][omm] write file /data/mogdb/tool/.ptk_deployer
INFO[2024-08-29T17:25:16.526] generate certification files
INFO[2024-08-29T17:25:18.918] download certification files
INFO[2024-08-29T17:25:19.883] upload certification files to omm@192.168.0.12
INFO[2024-08-29T17:25:21.045] certification files setup success
INFO[2024-08-29T17:25:21.045] initialize db on omm@192.168.0.11
INFO[2024-08-29T17:25:21.045] initialize db on omm@192.168.0.12
INFO[2024-08-29T17:25:21.136] [192.168.0.11][omm] the database is initializing, please wait a few minutes
INFO[2024-08-29T17:25:21.139] [192.168.0.12][omm] the database is initializing, please wait a few minutes
INFO[2024-08-29T17:25:36.967] [192.168.0.11][omm] config postgresql.conf
INFO[2024-08-29T17:25:37.027] [192.168.0.12][omm] config postgresql.conf
INFO[2024-08-29T17:25:37.106] [192.168.0.11][omm] config pg_hba.conf
INFO[2024-08-29T17:25:37.165] [192.168.0.12][omm] config pg_hba.conf
INFO[2024-08-29T17:25:37.212] [192.168.0.11][omm] copy ssl files to data dir
INFO[2024-08-29T17:25:37.278] [192.168.0.12][omm] copy ssl files to data dir
INFO[2024-08-29T17:25:37.375] logic nodes installed success
INFO[2024-08-29T17:25:37.375] generating ptkc …
INFO[2024-08-29T17:25:37.670] start build ssh trust …
INFO[2024-08-29T17:25:38.592] ssh trust build success
INFO[2024-08-29T17:25:38.592] start launch db …
INFO[2024-08-29T17:25:38.592] [192.168.0.11][omm] start db using gs_ctl …
INFO[2024-08-29T17:25:38.592] [192.168.0.11][omm] the database is starting, please wait a few minutes
INFO[2024-08-29T17:25:38.592] [192.168.0.12][omm] start db using gs_ctl …
INFO[2024-08-29T17:25:38.592] [192.168.0.12][omm] the database is starting, please wait a few minutes
ERRO[2024-08-29T17:25:39.717] 192.168.0.12: gs_ctl: Process exited with status 1; 192.168.0.11: gs_ctl: Process exited with status 1
INFO[2024-08-29T17:25:39.717] clear temp dirs …
INFO[2024-08-29T17:25:39.810] clear temp dirs success
INFO[2024-08-29T17:25:39.810] time elapsed: 1m4s

cluste_name | host | user | port | status | message
---------------±--------------±-----±------±-------------±--------------------------------------
cluster_scrm | 192.168.0.11 | omm | 26000 | start_failed | gs_ctl: Process exited with status 1 **
** | 192.168.0.12 | omm | 26000 | start_failed | gs_ctl: Process exited with status 1

[root@mydb01 software]# ./ptk ls
cluster_name | id | addr | user | data_dir | db_version | create_time | comment
---------------±-----±--------------------±-----±-----------------±-----------------------------±--------------------±---------
cluster_scrm | 6001 | 192.168.0.11:26000 | omm | /data/mogdb/data | MogDB 5.0.8 (build 41aa0432) | 2024-08-29T17:25:01 |
| 6002 | 192.168.0.12:26000 | omm | /data/mogdb/data |

tart_failed | gs_ctl: Process exited with status 1安装完成后启动集群失败
3、检查集群状态

[root@mydb01 software]# ./ptk cluster status -n cluster_scrm
[ Cluster State ]
cluster_name : cluster_scrm
cluster_state : Stopped
database_version : MogDB 5.0.8 (build 41aa0432)

[ Datanode State ]
cluster_name | id | ip | port | user | nodename | db_role | state | uptime | upstream
---------------±-----±--------------±------±-----±---------±------------------±--------±-------±----------
cluster_scrm | 6001 | 192.168.0.11 | 26000 | omm | dn_6001 | primary(previous) | Stopped | - | -
| 6002 | 192.168.0.12 | 26000 | omm | dn_6002 | standby(previous) | Stopped | - | -
[root@mydb01 software]#
集群未启动
4、调整数据库shared_buffers参数
将数据库参数shared_buffers由6G调整为2G

[root@mydb01 software]# su - omm
Last login: Fri Aug 30 10:54:54 CST 2024 on pts/0
[omm@mydb01 ~]$ gs_guc set -I all -N all -c “shared_buffers=2GB”
The gs_guc run with the following arguments: [gs_guc -I all -N all -c shared_buffers=2GB set ].
Begin to perform the total nodes: 2.
Popen count is 2, Popen success count is 2, Popen failure count is 0.
Begin to perform gs_guc for datanodes.
Command count is 2, Command success count is 2, Command failure count is 0.

Total instances: 2. Failed instances: 0.
ALL: Success to perform gs_guc!

检查确认参数
[omm@mydb01 ~]$ cd /data/mogdb/data/
[omm@mydb01 data]$ cat postgresql.conf|grep shared_buffers
shared_buffers = 2GB # min 128kB
bulk_write_ring_size = 2GB # for bulkload, max shared_buffers
standby_shared_buffers_fraction = 1 #control shared buffers use in standby, 0.1-1.0
[omm@mydb01 data]$ exit
logout

使用ptk工具启动集群
[root@mydb01 software]# ./ptk cluster start -n cluster_scrm
INFO[2024-08-30T10:57:13.549] checking cluster state before start
INFO[2024-08-30T10:57:13.953] operation: start
INFO[2024-08-30T10:57:13.953] ========================================
INFO[2024-08-30T10:57:13.953] start db [192.168.0.11:26000] …
INFO[2024-08-30T10:57:15.082] start db [192.168.0.11:26000] successfully
INFO[2024-08-30T10:57:15.082] start db [192.168.0.12:26000] …
INFO[2024-08-30T10:57:16.453] start db [192.168.0.12:26000] successfully
INFO[2024-08-30T10:57:16.883] ========================================
INFO[2024-08-30T10:57:16.883] start cluster successfully
集群启动成功

检查集群
[root@mydb01 software]# ./ptk ls
cluster_name | id | addr | user | data_dir | db_version | create_time | comment
---------------±-----±--------------------±-----±-----------------±-----------------------------±--------------------±---------
cluster_scrm | 6001 | 192.168.0.11:26000 | omm | /data/mogdb/data | MogDB 5.0.8 (build 41aa0432) | 2024-08-29T17:25:01 |
| 6002 | 192.168.0.12:26000 | omm | /data/mogdb/data | | |
检查集群状态
[root@mydb01 software]# ./ptk cluster status -n cluster_scrm
[ Cluster State ]
cluster_name : cluster_scrm
cluster_state : Degraded
database_version : MogDB 5.0.8 (build 41aa0432)

[ Datanode State ]
cluster_name | id | ip | port | user | nodename | db_role | state | uptime | upstream
---------------±-----±--------------±------±-----±---------±--------±-----------------------------------±---------±----------
cluster_scrm | 6001 | 192.168.0.11 | 26000 | omm | dn_6001 | primary | Normal | 00:01:13 | -
| 6002 | 192.168.0.12 | 26000 | omm | dn_6002 | standby | Need repair(System id not matched) | - | -
[root@mydb01 software]#
集群和数据库可以正常启动
【说明】将shared_buffers参数分别调整到4G和3G数据库仍然不能正常启动,由此判断操作系统参数设置不当导致的数据库和集群不能正常启动。
5、调整vm.min_free_bytes参数
通过检查发现vm.min_free_bytes为1677716,该参数设置太大。调整为物理内存5%
6、重新设置shared_buffers参数

[root@mydb01 software]# su - omm
Last login: Fri Aug 30 10:54:54 CST 2024 on pts/0
[omm@mydb01 ~]$ gs_guc set -I all -N all -c “shared_buffers=6GB”
The gs_guc run with the following arguments: [gs_guc -I all -N all -c shared_buffers=2GB set ].
Begin to perform the total nodes: 2.
Popen count is 2, Popen success count is 2, Popen failure count is 0.
Begin to perform gs_guc for datanodes.
Command count is 2, Command success count is 2, Command failure count is 0.

Total instances: 2. Failed instances: 0.
ALL: Success to perform gs_guc!
shared_buffers设置为6GB后,数据库和集群可以正常启动。

-the end-

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论