一、前提
下载:
第一步
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
具体地址
https://get.enterprisedb.com/postgresql/postgresql-12.22-1-windows-x64.exe
安装位置为:
D:\wamp\PostgreSQL\12
数据库位置:
D:\wamp\PostgreSQL\12\data
注意:
不要在postgres中直接安装pgadmin,最好是单独下载。
windows版下载:
https://www.pgadmin.org/download/pgadmin-4-windows/
具体地址:
https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v8.13/windows/pgadmin4-8.13-x64.exe
二、配置:
1、远程连接
在data目录,即:
D:\wamp\PostgreSQL\12\data
中编辑 pg_hba.conf
增加远程连接:
原始的最后二行:
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5
增加一行:
host all all 0.0.0.0/0 md5
2、修改最大连接数
找到 postgresql.conf
修改:
max_connections配置
原始:
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
修改为:
port = 5432 # (change requires restart)
max_connections = 5000 # (change requires restart)
修改wal_keep_segments配置:
原始:
#wal_keep_segments = 0 # in logfile segments; 0 disables
修改为:
wal_keep_segments = 3 # in logfile segments; 0 disables
3、重启服务即可。