PostgreSQL 配置文件介绍

PostgreSQL 使用环境变量 PGDATA 指向的目录做为数据存放的目录,这个目录是在安装时指定的,所以
在安装时需要指定一个合适的目录作为数据目录的根目录。

每一个 PG 数据库实例都需要有这样的一个目录,此数据目录的初始化是使用命令 initdb 来完成的。

初始化完成后,PGDATA 数据目录下就会生成三个配置文件:

  • postgresql.conf 数据库实例的主配置文件,基本上所有的配置参数都在此文件中;
  • pg_hba.conf 认证配置文件,配置了允许哪些IP的主机访问数据库,认证的方法是什么等信息;
  • pg_ident.conf 认证方式ident的用户映射文件。
postgres@ubuntu2204:~/pgsql1$ ll
total 136
drwx------ 19 postgres postgres  4096 Jul  6 08:05 ./
drwxr-x---  3 postgres postgres  4096 Jul  6 07:56 ../
drwx------  5 postgres postgres  4096 Jul  6 07:41 base/
drwx------  2 postgres postgres  4096 Jul  6 08:06 global/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_commit_ts/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_dynshmem/
-rw-------  1 postgres postgres  4789 Jul  6 07:41 pg_hba.conf
-rw-------  1 postgres postgres  1636 Jul  6 07:41 pg_ident.conf
drwx------  4 postgres postgres  4096 Jul  6 08:10 pg_logical/
drwx------  4 postgres postgres  4096 Jul  6 07:41 pg_multixact/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_notify/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_replslot/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_serial/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_snapshots/
drwx------  2 postgres postgres  4096 Jul  6 08:05 pg_stat/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_stat_tmp/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_subtrans/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_tblspc/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_twophase/
-rw-------  1 postgres postgres     3 Jul  6 07:41 PG_VERSION
drwx------  3 postgres postgres  4096 Jul  6 07:41 pg_wal/
drwx------  2 postgres postgres  4096 Jul  6 07:41 pg_xact/
-rw-------  1 postgres postgres    88 Jul  6 07:41 postgresql.auto.conf
-rw-------  1 postgres postgres 29442 Jul  6 07:56 postgresql.conf
-rw-------  1 postgres postgres    54 Jul  6 08:05 postmaster.opts
-rw-------  1 postgres postgres    87 Jul  6 08:05 postmaster.pid
图片[1]-PostgreSQL 配置文件介绍-李佳程的个人主页

pg_hba.conf 文件主要内容:

图片[2]-PostgreSQL 配置文件介绍-李佳程的个人主页

pg_ident.conf 文件主要内容:

图片[3]-PostgreSQL 配置文件介绍-李佳程的个人主页

postgresql.conf 文件主要内容:

postgres@ubuntu2204:~/pgsql1$ cat postgresql.conf | grep -v "^[[:space:]].*#" | grep -v "^#" | grep -v "^$"
图片[4]-PostgreSQL 配置文件介绍-李佳程的个人主页

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享