前面介绍了 PostgreSQL 基础概念及安装部署 相关的知识点,今天我将详细的为大家介绍 PostgreSQL 目录结构与配置文件 postgresql.conf 介绍 相关知识,希望大家能够从中收获多多!如有帮助,请点在看、转发支持一波!!!

环境搭建完成后,从环境变量里看它涉及的目录
export PGHOME=/usr/local/pgsql/
export PGUSER=postgres
export PGPORT=5432
export PGDATA=/app/pgsql/data
export PGLOG=/app/pgsql/log/postgres.log
export PATH=$PGHOME/bin:$PATH:$HOME/bin
export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH
PATH=/usr/local/pgsql/bin:$PATH
export PATH
目录结构及作用
软件安装目录
/usr/local/pgsql/ 相当于oracle的 /app/oracle 软件安装目录,psql、pg_ctl等软件可执行的一些命令都在这下面。
[postgres@yuan ~]$ cd /usr/local/pgsql/
[postgres@yuan pgsql]$ ll
total 16
drwxr-xr-x 2 root root 4096 Jul 9 17:54 bin
drwxr-xr-x 6 root root 4096 Jul 9 17:54 include
drwxr-xr-x 4 root root 4096 Jul 9 17:54 lib
lrwxrwxrwx 1 root root 26 Jul 9 17:56 postgresql-12.4 -> /usr/local/postgresql-12.4
drwxr-xr-x 6 root root 4096 Jul 9 17:54 share
[postgres@yuan pgsql]$ cd bin
[postgres@yuan bin]$ ll
total 12348
-rwxr-xr-x 1 root root 73808 Jul 9 17:54 clusterdb
-rwxr-xr-x 1 root root 73552 Jul 9 17:54 createdb
-rwxr-xr-x 1 root root 78416 Jul 9 17:54 createuser
-rwxr-xr-x 1 root root 68944 Jul 9 17:54 dropdb
-rwxr-xr-x 1 root root 68920 Jul 9 17:54 dropuser
-rwxr-xr-x 1 root root 975928 Jul 9 17:54 ecpg
-rwxr-xr-x 1 root root 142520 Jul 9 17:54 initdb
-rwxr-xr-x 1 root root 44344 Jul 9 17:54 pg_archivecleanup
-rwxr-xr-x 1 root root 130528 Jul 9 17:54 pg_basebackup
-rwxr-xr-x 1 root root 172512 Jul 9 17:54 pgbench
-rwxr-xr-x 1 root root 66984 Jul 9 17:54 pg_checksums
-rwxr-xr-x 1 root root 42880 Jul 9 17:54 pg_config
-rwxr-xr-x 1 root root 61376 Jul 9 17:54 pg_controldata
-rwxr-xr-x 1 root root 76888 Jul 9 17:54 pg_ctl
-rwxr-xr-x 1 root root 422888 Jul 9 17:54 pg_dump
-rwxr-xr-x 1 root root 109376 Jul 9 17:54 pg_dumpall
-rwxr-xr-x 1 root root 73064 Jul 9 17:54 pg_isready
-rwxr-xr-x 1 root root 93208 Jul 9 17:54 pg_receivewal
-rwxr-xr-x 1 root root 93832 Jul 9 17:54 pg_recvlogical
-rwxr-xr-x 1 root root 71256 Jul 9 17:54 pg_resetwal
-rwxr-xr-x 1 root root 187840 Jul 9 17:54 pg_restore
-rwxr-xr-x 1 root root 109784 Jul 9 17:54 pg_rewind
-rwxr-xr-x 1 root root 49216 Jul 9 17:54 pg_test_fsync
-rwxr-xr-x 1 root root 39152 Jul 9 17:54 pg_test_timing
-rwxr-xr-x 1 root root 148952 Jul 9 17:54 pg_upgrade
-rwxr-xr-x 1 root root 103904 Jul 9 17:54 pg_waldump
-rwxr-xr-x 1 root root 8227064 Jul 9 17:53 postgres
lrwxrwxrwx 1 root root 8 Jul 9 17:53 postmaster -> postgres
-rwxr-xr-x 1 root root 615376 Jul 9 17:54 psql
-rwxr-xr-x 1 root root 78032 Jul 9 17:54 reindexdb
-rwxr-xr-x 1 root root 86968 Jul 9 17:54 vacuumdb
数据目录
/app/pgsql/data 相当于oracle建库时指定的数据目录,数据库所需的参数文件,数据文件等均在这下面。
[postgres@yuan include]$ cd /app/pgsql/data
[postgres@yuan data]$ ll
total 60
drwx------ 5 postgres postgres 41 Jul 9 18:02 base
drwx------ 2 postgres postgres 4096 Jul 9 18:06 global
drwx------ 2 postgres postgres 6 Jul 9 18:02 pg_commit_ts
drwx------ 2 postgres postgres 6 Jul 9 18:02 pg_dynshmem
-rw------- 1 postgres postgres 4789 Jul 9 18:03 pg_hba.conf
-rw------- 1 postgres postgres 1636 Jul 9 18:02 pg_ident.conf
drwx------ 4 postgres postgres 68 Jul 9 18:10 pg_logical
drwx------ 4 postgres postgres 36 Jul 9

本文详细介绍了PostgreSQL的目录结构,包括软件安装目录、数据目录及日志目录,以及核心配置文件postgresql.conf的解析,涵盖了连接设置、内存设置、IO设置、日志设置和autovacuum设置等多个方面,旨在帮助读者深入理解PostgreSQL的运行机制和优化配置。
最低0.47元/天 解锁文章
1002





