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.

0 0 đánh giá
Đánh giá bài viết
Theo dõi
Thông báo của
guest

0 Góp ý
Phản hồi nội tuyến
Xem tất cả bình luận