This commit is contained in:
2025-05-07 21:04:00 +08:00
parent 17fca60282
commit 8e29d15e6d
15 changed files with 291 additions and 12 deletions

View File

@@ -0,0 +1,21 @@
# 部署 PostgreSQL 单节点
- 按实际环境修改
- docker-compose.yml
- pgsql/conf.d/\*.cnf
- 创建目录
```
grep '\<source:' docker-compose.yml | cut -d: -f2 | xargs mkdir -p
```
- 启动
```
docker-compose up -d
```
- 查看日志,直至出现 "PGSQL is ready for connections."
```
docker-compose logs pgsql
```

View File

@@ -0,0 +1,23 @@
version: "3.7"
services:
pgsql:
image: harbor.colben.cn/general/pgsql:15
container_name: pgsql
restart: "on-failure"
stop_grace_period: 32s
networks:
pgsql:
ports:
- 5432:5432
volumes:
- type: bind
source: ./pgsql/db
target: /var/lib/pgsql/
- type: bind
source: ./pgsql/conf.d
target: /etc/pgsql/conf.d
- type: bind
source: ./pgsql/log
target: /var/log/pgsql

View File

@@ -0,0 +1,19 @@
[mysqld]
mysqlx = OFF
skip-name-resolve = 1
max-user-connections = 600
## this should be less than 80% of total memory
innodb-buffer-pool-size = xxxxG
## this should be half of "innodb-buffer-pool-size"
innodb-buffer-pool-instances = xxxx
# binlog
server-id = 1
log-bin = /var/lib/mysql-bin/master
binlog-format = ROW
binlog-expire-logs-seconds = 172800
gtid-mode = ON
enforce-gtid-consistency = TRUE