Thứ Bảy, 6 tháng 9, 2025

Tìm hiểu về cấu trúc thư mục cài đặt Postgresql

Cấu trúc thư mục trong PostgreSQL phụ thuộc vào cài đặt cụ thể của hệ thống và nguyên tắc quản lý dữ liệu của PostgreSQL. Tuy nhiên, dưới đây là một mô tả tổng quan về cấu trúc thư mục chính trong một cài đặt tiêu chuẩn của PostgreSQL. Chúng thường có các thư mục và hệ thống files system như thế này:

word image 1836 1

drwx——. 20 postgres postgres 4.0K May 15 21:41 .

drwxr-xr-x. 3 postgres postgres 18 May 13 10:50 ..

drwx——. 12 postgres postgres 4.0K May 14 12:05 base

-rw——-. 1 postgres postgres 30 May 15 00:00 current_logfiles

drwx——. 2 postgres postgres 4.0K May 14 12:05 global

drwx——. 2 postgres postgres 84 May 15 00:00 log

drwx——. 2 postgres postgres 6 May 13 11:12 pg_commit_ts

drwx——. 2 postgres postgres 6 May 13 11:12 pg_dynshmem

-rw——-. 1 postgres postgres 4.6K May 13 11:37 pg_hba.conf

-rw——-. 1 postgres postgres 1.6K May 13 11:12 pg_ident.conf

drwx——. 4 postgres postgres 68 May 14 12:07 pg_logical

drwx——. 4 postgres postgres 36 May 13 11:12 pg_multixact

drwx——. 2 postgres postgres 6 May 13 11:12 pg_notify

drwx——. 2 postgres postgres 6 May 13 14:50 pg_replslot

drwx——. 2 postgres postgres 6 May 13 11:12 pg_serial

drwx——. 2 postgres postgres 6 May 13 11:12 pg_snapshots

drwx——. 2 postgres postgres 6 May 13 22:36 pg_stat

drwx——. 2 postgres postgres 6 May 13 11:12 pg_stat_tmp

drwx——. 2 postgres postgres 18 May 13 18:00 pg_subtrans

drwx——. 2 postgres postgres 6 May 13 11:12 pg_tblspc

drwx——. 2 postgres postgres 6 May 13 11:12 pg_twophase

-rw——-. 1 postgres postgres 3 May 13 11:12 PG_VERSION

drwx——. 3 postgres postgres 4.0K May 14 11:56 pg_wal

drwx——. 2 postgres postgres 78 May 13 17:30 pg_xact

-rw——-. 1 postgres postgres 88 May 13 11:12 postgresql.auto.conf

-rw——-. 1 postgres postgres 29K May 13 22:36 postgresql.conf

-rw——-. 1 postgres postgres 50 May 13 22:36 postmaster.opts

-rw——-. 1 postgres postgres 97 May 13 22:36 postmaster.pid

base: là thư mục chứa dữ liệu của database, trong này chứa các thư mục con khác nhau nữa, tên thư mục là tên oid của database, đối tượng tạo trong CSDL.

[root@localhost base]# pwd

/pgdata/15/data/base

[root@localhost base]# ls -lha

total 116K

drwx——. 12 postgres postgres 4.0K May 14 12:05 .

drwx——. 20 postgres postgres 4.0K May 15 16:24 ..

drwx——. 2 postgres postgres 8.0K May 13 22:37 1

drwx——. 2 postgres postgres 8.0K May 13 22:37 16413

drwx——. 2 postgres postgres 8.0K May 13 22:37 16695

drwx——. 2 postgres postgres 8.0K May 14 11:31 16778

drwx——. 2 postgres postgres 8.0K May 14 11:38 16779

drwx——. 2 postgres postgres 8.0K May 14 11:49 16780

drwx——. 2 postgres postgres 8.0K May 14 12:05 16833

drwx——. 2 postgres postgres 8.0K May 13 11:12 4

drwx——. 2 postgres postgres 8.0K May 13 22:38 5

drwx——. 2 postgres postgres 6 May 13 15:39 pgsql_tmp

global: Thư mục con chứa các bảng sử dụng nội bộ trong PostgreSQL (system catalog). Ví dụ như catalog chứa thông tin về database pg_database.

Log: Thư mục này lưu giữ các tệp nhật ký PostgreSQL, ghi lại các sự kiện và hoạt động của máy chủ cơ sở dữ liệu, đây là file log của hệ thống CSDL như thông tin bật, tắt CSDL, các sự kiện lỗi…

pg_commit_ts: Thư mục con chứa thông tin về trạng thái commit của dữ liệu timestamp, đảm bảo tính toàn vẹn và khôi phục dữ liệu.

pg_dynshmem: Thư mục này chứa các phân đoạn bộ nhớ chia sẻ động được sử dụng bởi các quy trình PostgreSQL: dynamic shared memory

pg_logical: Thư mục con chứa trạng thái dữ liệu sử dụng trong chức năng logical decoding (chức năng decoding dữ liệu từ WAL).

pg_multixact: Thư mục con chứa dữ liệu trạng thái multitransaction (sử dụng cho locks mức độ dòng dữ liệu).

pg_notify: Thư mục con chứa dữ liệu về chức năng LISTEN/NOTIFY.

pg_replslot: Thư mục con chứa dữ liệu về replication slot

pg_serial: Thư mục con chứa thông tin về các transaction commited ở mức độ phân li serializable.

pg_snapshots: Thư mục con chứa thông tin về các snapshots đã xuất.

pg_stat: Thư mục này chứa dữ liệu thống kê về hiệu suất cơ sở dữ liệu.

pg_stat_tmp: Thư mục này lưu trữ dữ liệu thống kê tạm thời.

pg_subtrans: Thư mục con chứa dữ liệu về các subtransaction (khi sử dụng SAVEPOINT).

pg_tblspc: Thư mục này lưu trữ thông tin không gian bảng để quản lý lưu trữ dữ liệu vật lý. Thư mục con chứa thông tin symbolic links tới các tablespaces. khi tạo 1 TABLESPACE để chứa dữ liệu bên ngoài database cluster, PostgreSQL sẽ tạo một symbolic links tới thư mục tạo từ TABLESPACE trong thư mục này.

pg_twophase: Thư mục con chứa các tập tin trạng thái cho các prepared transactions.

pg_wal: Thư mục con chứa thông tin về WAL files, log của database phục vụ quá trình recovery.

pg_xact: Thư mục này lưu trữ dữ liệu trạng thái giao dịch để khôi phục sau sự cố.

current_logfiles: chỉ ra đường dẫn đến file nhật ký của hệ thống logfile đang hoạt động ghi dữ liệu.

pg_hba.conf: Tệp này chứa cấu hình cho xác thực người dùng và kiểm soát quyền truy cập cơ sở dữ liệu.

postgresql.conf: chứa thông tin cấu hình chính toàn bộ database.

pg_ident.conf: Tệp này chỉ định trình định danh cho phiên bản PostgreSQL.

postgresql.auto.conf: Tệp này lưu trữ các giá trị của các tham số đã được sửa đổi bằng lệnh ALTER SYSTEM.

postmaster.opts: Tệp này chứa các tùy chọn để khởi động quy trình máy chủ PostgreSQL.

postmaster.pid: Tệp này lưu trữ ID quy trình (PID) của quy trình máy chủ PostgreSQL đang chạy.

PG_VERSION: chứa thông tin phiên bản postgresql hiện tại.

=============================
Website không chứa bất kỳ quảng cáo nào, mọi đóng góp để duy trì phát triển cho website (donation) xin vui lòng gửi về STK 90.2142.8888 - Ngân hàng Vietcombank Thăng Long - TRAN VAN BINH
=============================
Nếu bạn không muốn bị AI thay thế và tiết kiệm 3-5 NĂM trên con đường trở thành DBA chuyên nghiệp hay làm chủ Database thì hãy đăng ký ngay KHOÁ HỌC ORACLE DATABASE A-Z ENTERPRISE, được Coaching trực tiếp từ tôi với toàn bộ bí kíp thực chiến, thủ tục, quy trình của gần 20 năm kinh nghiệm (mà bạn sẽ KHÔNG THỂ tìm kiếm trên Internet/Google) từ đó giúp bạn dễ dàng quản trị mọi hệ thống Core tại Việt Nam và trên thế giới, đỗ OCP.
- CÁCH ĐĂNG KÝ: Gõ (.) hoặc để lại số điện thoại hoặc inbox https://m.me/tranvanbinh.vn hoặc Hotline/Zalo 090.29.12.888
- Chi tiết tham khảo:
https://bit.ly/oaz_w
=============================
2 khóa học online qua video giúp bạn nhanh chóng có những kiến thức nền tảng về Linux, Oracle, học mọi nơi, chỉ cần có Internet/4G:
- Oracle cơ bản: https://bit.ly/admin_1200
- Linux: https://bit.ly/linux_1200
=============================
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH:
📧 Mail: binhoracle@gmail.com
☎️ Mobile/Zalo: 0902912888
👨 Facebook: https://www.facebook.com/BinhOracleMaster
👨 Inbox Messenger: https://m.me/101036604657441 (profile)
👨 Fanpage: https://www.facebook.com/tranvanbinh.vn
👨 Inbox Fanpage: https://m.me/tranvanbinh.vn
👨👩 Group FB: https://www.facebook.com/groups/DBAVietNam
👨 Website: https://www.tranvanbinh.vn
👨 Blogger: https://tranvanbinhmaster.blogspot.com
🎬 Youtube: https://www.youtube.com/@binhguru
👨 Tiktok: https://www.tiktok.com/@binhguru
👨 Linkin: https://www.linkedin.com/in/binhoracle
👨 Twitter: https://twitter.com/binhguru
👨 Podcast: https://www.podbean.com/pu/pbblog-eskre-5f82d6
👨 Địa chỉ: Tòa nhà Sun Square - 21 Lê Đức Thọ - Phường Mỹ Đình 1 - Quận Nam Từ Liêm - TP.Hà Nội

=============================
cở sở dữ liệu, cơ sở dữ liệu quốc gia, database, AI, trí tuệ nhân tạo, artificial intelligence, machine learning, deep learning, LLM, ChatGPT, DeepSeek, Grok, oracle tutorial, học oracle database, Tự học Oracle, Tài liệu Oracle 12c tiếng Việt, Hướng dẫn sử dụng Oracle Database, Oracle SQL cơ bản, Oracle SQL là gì, Khóa học Oracle Hà Nội, Học chứng chỉ Oracle ở đầu, Khóa học Oracle online,sql tutorial, khóa học pl/sql tutorial, học dba, học dba ở việt nam, khóa học dba, khóa học dba sql, tài liệu học dba oracle, Khóa học Oracle online, học oracle sql, học oracle ở đâu tphcm, học oracle bắt đầu từ đâu, học oracle ở hà nội, oracle database tutorial, oracle database 12c, oracle database là gì, oracle database 11g, oracle download, oracle database 19c/21c/23c/23ai, oracle dba tutorial, oracle tunning, sql tunning , oracle 12c, oracle multitenant, Container Databases (CDB), Pluggable Databases (PDB), oracle cloud, oracle security, oracle fga, audit_trail,oracle RAC, ASM, oracle dataguard, oracle goldengate, mview, oracle exadata, oracle oca, oracle ocp, oracle ocm , oracle weblogic, postgresql tutorial, mysql tutorial, mariadb tutorial, ms sql server tutorial, nosql, mongodb tutorial, oci, cloud, middleware tutorial, docker, k8s, micro service, hoc solaris tutorial, hoc linux tutorial, hoc aix tutorial, unix tutorial, securecrt, xshell, mobaxterm, putty

ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master