网站域名绑定破解,网站建设启动大会,中国十大装修公司品牌排行榜,wordpress换了固定链接404开头还是介绍一下群#xff0c;如果感兴趣Polardb ,mongodb ,MySQL ,Postgresql ,redis #xff0c;SQL SERVER ,ORACLE,Oceanbase 等有问题#xff0c;有需求都可以加群群内有各大数据库行业大咖#xff0c;CTO#xff0c;可以解决你的问题。加群请加 liuaustin3微信号 如果感兴趣Polardb ,mongodb ,MySQL ,Postgresql ,redis SQL SERVER ,ORACLE,Oceanbase 等有问题有需求都可以加群群内有各大数据库行业大咖CTO可以解决你的问题。加群请加 liuaustin3微信号 在新加的朋友会分到3群共1170人左右 1 2 3 首先道歉昨天关于POSTGRESQL 的文章中的部分内容个人觉得有误导的部分或者说没有解释清楚的地方。虽然相关的部分是官方的提供的相关的文件特通过此文更新相关的内容。 在上一篇文章中有这样一个部分 因为这个地方有不同的意见 1 实际上这块的部分代表了reload 的部分而通常我们撰写这块的方式是 ExecReload/usr/local/postgres/bin/pg_ctl reload -D ${PGDATA} 但是官方安装完毕后这个部门给的命令是 kill -HUP $MAINPID ,熟悉这PG 这块的小伙伴都明白kill 在对于PG 来说是一个要了命的命令所以本文最后会给出更新的部分咱们不按官方的来。 但是问题又来了为甚一个RELOAD的命令本身在官方的命令里面是通过 kill 来完成的而不是我们常用的命令。 这里为避免歧义特此解释 kill -hup 是一个用于发送 SIGHUP 信号给进程的命令。SIGHUP 信号是一种发送给进程的 POSIX 信号代表终端挂起信号hangup signal。 当一个进程收到 SIGHUP 信号时通常会导致该进程重新加载配置文件、重新初始化或重新启动。这通常用于实现热重载配置或重新加载程序的功能。 所以说 kill -hup 并不是等同于 kill -9 XXX 两个没有可比性, 他是通过kill命令来给进程发送信号的。 * Re-read config files, and tell children to do same.*/
static void
process_pm_reload_request(void)
{pending_pm_reload_request false;ereport(DEBUG2,(errmsg_internal(postmaster received reload request signal)));if (Shutdown SmartShutdown){ereport(LOG,(errmsg(received SIGHUP, reloading configuration files)));ProcessConfigFile(PGC_SIGHUP);SignalChildren(SIGHUP);if (StartupPID ! 0)signal_child(StartupPID, SIGHUP);if (BgWriterPID ! 0)signal_child(BgWriterPID, SIGHUP);if (CheckpointerPID ! 0)signal_child(CheckpointerPID, SIGHUP);if (WalWriterPID ! 0)signal_child(WalWriterPID, SIGHUP);if (WalReceiverPID ! 0)signal_child(WalReceiverPID, SIGHUP);if (AutoVacPID ! 0)signal_child(AutoVacPID, SIGHUP);if (PgArchPID ! 0)signal_child(PgArchPID, SIGHUP);if (SysLoggerPID ! 0)signal_child(SysLoggerPID, SIGHUP);/* Reload authentication config files too */if (!load_hba())ereport(LOG,/* translator: %s is a configuration file */(errmsg(%s was not reloaded, HbaFileName)));if (!load_ident())ereport(LOG,(errmsg(%s was not reloaded, IdentFileName))); 代码中在接受到kill -hup 主进程号后开始针对PG的配置文件和 PG的 hba 文件和 ident 等部分信息的加载。 下面重写了相关的文件昨天昨天文件的替换 # Its not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. It is recommended to use systemd
# dropin feature; i.e. create file with suffix .conf under
# /etc/systemd/system/postgresql-14.service.d directory overriding the
# units defaults. You can also use systemctl edit postgresql-14
# Look at systemd.unit(5) manual page for more info.# Note: changing PGDATA will typically require adjusting SELinux
# configuration as well.# Note: do not use a PGDATA pathname containing spaces, or you will
# break postgresql-14-setup.
[Unit]
DescriptionPostgreSQL 14 database server
Documentationhttps://www.postgresql.org/docs/14/static/
Aftersyslog.target
Afternetwork-online.target[Service]
TypenotifyUserpostgres
Grouppostgres# Location of database directory
EnvironmentPGDATA/pgdata/data/ #请根据实际情况修改你的PG数据库目录地址到这个位置
EnvironmentPGPORT5432 #请根据实际情况修改此位置为你的PG的端口号# StandardOutputsyslog# Disable OOM kill on the postmaster
OOMScoreAdjust-1000
EnvironmentPG_OOM_ADJUST_FILE/proc/self/oom_score_adj
EnvironmentPG_OOM_ADJUST_VALUE0#请根据实际的情况来编辑下方的ExecStart/usr/local/postgres/bin/postmaster -D ${PGDATA}
ExecStop/usr/local/postgres/bin/pg_ctl stop -D ${PGDATA} -m fast
ExecReload/usr/local/postgres/bin/pg_ctl reload -D ${PGDATA}
ExecStatus/usr/local/postgres/bin/pg_ctl status -D ${PGDATA}#ExecReload/bin/kill -HUP $MAINPID
#KillModemixed
#KillSignalSIGINT# Do not set any timeout value, so that systemd will not kill postmaster
# during crash recovery.
TimeoutSec0# 0 is the same as infinity, but infinity needs systemd 229
TimeoutStartSec0TimeoutStopSec1h[Install]
WantedBymulti-user.target 更详细的分析和解释请参加 德哥相关文字 https://developer.aliyun.com/article/60259