当前位置:网站首页>PG operation and maintenance -- service start and stop
PG operation and maintenance -- service start and stop
2022-07-16 08:50:00 【51CTO】
pg Start stop
Kai Ku
(1) Direct operation postgres The process starts
postgres -D /home/osdba/pgdata &
-D Used to specify the data directory , Command the last & Indicates background execution
(2) Use pg_ctl Command to start
pg_ctl -D /home/osdba/pgdata start
Stop storage
(1) Direct to running postgres The main process sends signal The signal , Stop database
(2) Use pg_ctl Command to stop the database
Three modes to stop a database
(1)smart shutdown
New connections are not allowed , Wait until all existing connections are completed before closing the database .
(2)fast shutdown
Quick off mode , New connections are no longer allowed , Send to all active service processes SIGTERM The signal , Let them exit immediately , Wait for all child processes to exit and shut down the database . If the service is in online backup state , The backup will be terminated directly .
(3)immediate shutdown
Turn off mode immediately , The main process postgres Send... To all child processes SIGQUIT The signal , And quit immediately , All child processes will also exit immediately . When exiting in this mode , It will not shut down the database system properly , The database will replay the next time you start wal Log recovery .
The operation is as follows
pg_ctl Tools
function
(1) Initialize database instance
(2) start-up 、 End 、 restart pg
(3) see pg state
(4) Let the database instance read the configuration file again
(5) Allows a signal to be sent to a specified process
Use pg_ctl reload Commands and direct call functions pg_reload_conf() The essence is to send SIGHUP Command to the service main process .
Single user mode
Refers to start pg When combined with --single Parameters , At this time pg The process will not enter the background service mode , For the following scenarios
(1)initdb Stage
(2) Repair the system table
(3) When multi-user mode does not accept all commands , You can use single user mode to connect to the database
PG The transaction age of one record in cannot exceed 231, If beyond this range , This data will be lost ,pg This is not allowed , When recording the age distance 231 There are still 10 million times , There will be an alarm in the log . If you don't deal with , There are still onemillion hours , The database server will automatically disable connections from any user .
In this case , You can only start the database in single user mode VACUUM Name to repair .
边栏推荐
- [go] Ⅱ. Introduction à l'API reposante et au processus et à la structure du Code de l'API
- 程序员转型项目管理?考个PMP?
- Win11本地用户和组怎么管理?Win11创建用户管理员的方法
- 电脑共享文件打不开要如何解决
- HCIP第二个实验
- HCIP第五天笔记
- Leetcode (Sword finger offer) - 45 Arrange the array into the smallest number
- 【历史上的今天】7 月 13 日:数据库之父逝世;苹果公司购买 CUPS 代码;IBM 芯片联盟
- 【ES6】let、const关键字和解构赋值
- HCIP第四天笔记
猜你喜欢

What if the win11 touchpad doesn't work? The solution of win11 touch panel not working

Test basis 1

【深入浅出玩转FPGA8------亚稳态】

Test basis 2
![[server data recovery] a data recovery case in which a brand of MSA SAN storage RAID5 is paralyzed and the upper Lun cannot be used](/img/1f/bf0ae6c9c7e2f8eaa81ea41d504c5b.jpg)
[server data recovery] a data recovery case in which a brand of MSA SAN storage RAID5 is paralyzed and the upper Lun cannot be used

Test basis 4

不要小看WebSocket!长连接、有状态、双向、全双工都是王炸技能

【服务器数据恢复】某品牌MSA SAN存储RAID5瘫痪,上层LUN无法使用的数据恢复案例

Flutter RenderFlex overflowed by pixels on the bottom键盘弹出警告异常

Win11安全中心删除的文件如何恢复?
随机推荐
Test basis 1
二项堆原理与解析
拔掉电源会怎样?GaussDB(for Redis)双活让你有备无患
不会真有人觉得聊天机器人难吧——使用BERT加载预训练模型得到中文句子向量
Lesson 3: stock trading III
VRRP基础配置
程序的运行过程
Jerry's phone book synchronization Bluetooth may have no sound [chapter]
No one really thinks that chatting robots are difficult -- using Bert to load the pre training model to get Chinese sentence vectors
Explain ebpf in simple terms | 7 core issues you need to understand
win10系统如何实现开机启动程序?用shell:startup命令
要么退休,要么转行,要么转管理ps居然俩月没写博客了
不会真有人觉得聊天机器人难吧——微调BERT模型得到句子间的相似度
面试诈骗:竟然还有靠面试挣钱的公司
Extract the language you need from the multilingual data set and save it as CSV
我用开天平台做了一个城市防疫政策查询系统,你不试试?
What if the win11 touchpad doesn't work? The solution of win11 touch panel not working
Win11安全中心删除的文件如何恢复?
Response.Write具体介绍
Brief discussion -- views on the management of technological transformation