postgresql数据库启动与停止

一、启动数据库

pg_ctl start -D $PGDATA或pg_ctl start -D /kingdee/pgsql

$PGDATA执行postgresql的数据库的数据目录

二、停止数据库

pg_ctl stop -D $PGDATA   [-m shutdown-mode]

-m shutdown-mode指数据库停止的方法,有以下三种:

smart: 等所有的连接终止后关闭数据库。如果客户端连接不终止,则无法关闭数据库。

fast: 相当于oracle数据库的immdiate模式

immediate:相当于oracle数据库的abort模式

[pgsql@easha1 ~]$ pg_ctl start -D $PGDATA
waiting for server to start....2022-01-05 11:01:16.931 CST [7425] LOG:  starting PostgreSQL 14.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit
2022-01-05 11:01:16.932 CST [7425] LOG:  listening on IPv6 address "::1", port 5432
2022-01-05 11:01:16.932 CST [7425] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2022-01-05 11:01:16.933 CST [7425] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2022-01-05 11:01:16.935 CST [7426] LOG:  database system was shut down at 2022-01-05 10:28:59 CST
2022-01-05 11:01:16.936 CST [7425] LOG:  database system is ready to accept connections
 done
server started
[pgsql@easha1 ~]$

[pgsql@easha1 ~]$ pg_ctl stop -D $PGDATA -m fast
waiting for server to shut down....2022-01-05 11:02:50.390 CST [7425] LOG:  received fast shutdown request
2022-01-05 11:02:50.391 CST [7425] LOG:  aborting any active transactions
2022-01-05 11:02:50.392 CST [7425] LOG:  background worker "logical replication launcher" (PID 7433) exited with exit code 1
2022-01-05 11:02:50.392 CST [7427] LOG:  shutting down
2022-01-05 11:02:50.423 CST [7425] LOG:  database system is shut down
 done
server stopped
[pgsql@easha1 ~]$
 

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值