查看正在在运行的瀚高数据库服务的启动方式:是由systemd(systemctl)启动的,还是由pg

tech2022-09-20  73

目录

环境

症状

问题原因

解决方案

报错编码

环境

系统平台:Linux x86-64 Red Hat Enterprise Linux 7,中标麒麟(CPU海光)7,中标麒麟(CPU龙芯)6

版本:5.6.5,5.6.4,4.3.4.7,4.3.4.6,4.3.4.5,4.3.4.4,4.3.4.3,4.3.4.2

症状

瀚高数据库在RHEL 7系列操作系统中的开机自动启动是用systemd来实现的,另外,瀚高数据库也有pg_ctl 命令去启动、关闭、重启瀚高数据库服务。 那么,若是systemd拉起的瀚高数据库服务,由pg_ctl去关闭、重启,这样的话,会导致systemd无法检测到瀚高数据库的状态,反之亦然。因此不推荐这两种方法交叉使用。 本文提供了一种方法,来查看正在运行的瀚高数据库服务的启动方式:是由systemd(systemctl)启动的,还是由pg_ctl启动的。 注意,此问题不仅仅是瀚高数据库存在,Oracle数据库也存在本问题,请参见Oracle文章:

Auto Startup/Shutdown Issue In RHEL 7.X Using Systemctl After Manually Shutdown/Start Database (Doc ID 2401600.1)

 

问题原因

本问题的原因是systemd固有的设计方式与实现机制。

解决方案

一、systemd(systemctl)启动瀚高数据库服务的证据

 

[root@dbserver 2017]# ps -ef |grep postg root       2016      1  0 05:42 ?        00:00:00 /opt/HighGo4.3.4.7-see/bin/postgres -D /opt/HighGo4.3.4.7-see/data root       2017   2016  0 05:42 ?        00:00:00 postgres: logger process   root       2019   2016  0 05:42 ?        00:00:00 postgres: checkpointer process   root       2020   2016  0 05:42 ?        00:00:00 postgres: writer process   root       2021   2016  0 05:42 ?        00:00:00 postgres: wal writer process   root       2022   2016  0 05:42 ?        00:00:00 postgres: autovacuum launcher process   root       2023   2016  0 05:42 ?        00:00:00 postgres: archiver process   root       2024   2016  0 05:42 ?        00:00:00 postgres: stats collector process   root       2025   2016  0 05:42 ?        00:00:00 postgres: bgworker: logical replication launcher   root       6039   2132  0 06:29 pts/0    00:00:00 grep --color=auto postg [root@dbserver 2017]# [root@dbserver 2017]#

[root@dbserver 2017]# systemctl status hgdb-see-4.3.4.7 ● hgdb-see-4.3.4.7.service - hgdb-see-4.3.4.7    Loaded: loaded (/usr/lib/systemd/system/hgdb-see-4.3.4.7.service; enabled; vendor preset: disabled)    Active: active (running) since Sat 2020-02-29 05:42:02 EST; 50min ago   Process: 2011 ExecStart=/opt/HighGo4.3.4.7-see/etc/hgdb-see-4.3.4.7 start (code=exited, status=0/SUCCESS)   Process: 1171 ExecStartPre=/usr/bin/sleep 30 (code=exited, status=0/SUCCESS)  Main PID: 2016 (postgres)     Tasks: 9    CGroup: /system.slice/hgdb-see-4.3.4.7.service             ----------------------->>>>本段输出中,CGroup及下面的输出是systemd启动瀚高数据库的证据

更多详细信息请登录【瀚高技术支持平台】查看https://support.highgo.com/#/index/docContent/16004f7201cb31f4 

最新回复(0)