搭建 PostgreSQL

端口:5432
代理备份端口:6432
下载 postgresql-15.0-1-windows-x64

乱码显示
配置环境变量 PGDATA=数据目录位置
找到postgresql.conf文件,
修改参数

lc_messages='UTF8'
max_connections = 1000
shared_buffers=4GB
work_mem=8MB

问题:远程易掉线

方案:修改配置信息

tcp_keepalives_idle = 20 #20秒主动发心跳
tcp_keepalives_interval = 10 #10秒未收到返回心跳则本心跳失败
tcp_keepalives_count = 3 #连续3次心跳失败则主动断线

重启PostgreSQL的服务 
C:\Program Files\PostgreSQL\10\bin
pg_ctl restart

远程无法连接
修改对应data目录下的配置文件pg_hba.conf
在配置文件末尾添上:

host   all    all    0.0.0.0/0    md5


---------------------------------------------------------------
数据库管理工具pgAdmin4界面如何设置为中文显示
File->Preferences->Miscellaneous->User language
---------------------------------------------------------------
【StackBuilder 安装PgAgent 】

---------------------------------------------------------------
【SQL转储】

pg_dump seata > d:\seata20221123.bk
.\pg_dump.exe -U postgres -d seata > d:\seata20221123.bk
.\psql.exe -U postgres -d seata2 < d:\seata20221123.bk

问题:password authentication failed for user “postgres”
方案:pg_hba.conf,将文件里local的md5全部改为trust

数据库配置信息:
 

datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.p6spy.engine.spy.P6SpyDriver
    url: jdbc:p6spy:postgresql://0.0.0.0:15432/ptc?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
    username: postgres
    password:

你可能感兴趣的:(数据库,数据库,postgresql)