1、使用smart参数关闭数据库:
smart:最为安全,但最慢,需要将所有连接都断开后,才会关库,默认关库模式。
smart: 等所有的连接中止后,关闭数据库。如果客户端连接不终止, 则无法关闭数据库。
[postgresql@master ~]$ pg_ctl stop -D $PGDATA -m smart
waiting for server to shut down.... done
server stopped
[postgresql@master ~]$
使用smart参数关闭数据库的日志:
2025-09-06 19:40:20.479 CST [56233] LOG: received smart shutdown request
2025-09-06 19:40:20.480 CST [56233] LOG: background worker "logical replication launcher" (PID 56241) exited with exit code 1
2025-09-06 19:40:20.480 CST [56236] LOG: shutting down
2025-09-06 19:40:20.485 CST [56233] LOG: database system is shut down
2、使用fast参数关闭数据库:
fast:强制中断会话,而不管有操作有没有提交,在做系统维护(系统维护时一般应用都正常关闭了,或者不再会有事务操作。)时,需要这种模式来关闭数据库。
fast: 快速关闭数据库, 断开客户端的连接,让已有的事务回滚,然后正常关闭数据库。
[postgresql@master ~]$ pg_ctl stop -D $PGDATA -m fast
waiting for server to shut down.... done
server stopped
[postgresql@ma
12-12
3464
3464

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



