Code前端首页关于Code前端联系我们

PostgreSQL 可以简单解释一下 |启动和停止数据库

terry 2年前 (2023-09-26) 阅读数 45 #数据库

1。概述

上一章我们介绍了基于CentOS7.9操作系统环境安装PostgreSQL的过程。本章介绍Postgres数据库的常用命令和基本操作。

2。启动和停止 Postgre 数据库

2.1。切换到 postgres 用户

[root@localhost ~]# su - postgres

2.2。查看PG数据库进程

[postgres@localhost ~] $ ps -aux|grep postgres

PostgreSQL深入浅出 | 数据库的启动与停止

2.3,启动数据库

[postgres@localhost ~]$ pg_ctl -D /usr/local/pgsql/pgdasta l/ tmp/logfile start
/usr/local/ pgsql/pgdata:数据库数据目录
/tmp/logfile:进入日志

PostgreSQL深入浅出 | 数据库的启动与停止

启动成功后查看进程s localhost ~]$ ps - aux|grep postgres

PostgreSQL深入浅出 | 数据库的启动与停止

2.4。停止数据库

[postgres@localhost ~]$ pg_ctl stop -D /usr/local/pgsql/pgdata -m fast

PostgreSQL深入浅出 | 数据库的启动与停止

补充:

-m 参数有三个针对数据库的常规选项:
smart:等待所有连接关闭后再关闭数据库。
快:可以理解为Oracle数据库的立即模式。
立即数:可以理解为Oracle数据库的一种中断模式。

3。查看 PostgreSQL 数据库

[postgres@localhost ~]$ pg_ctl status

PostgreSQL深入浅出 | 数据库的启动与停止

版权声明

本文仅代表作者观点,不代表Code前端网立场。
本文系作者Code前端网发表,如需转载,请注明页面地址。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门