跳到主要内容

连接配置

SELECT count(*) FROM pg_stat_activity; // 查询连接数

SHOW max_connections; //查询当前最大连接数

ALTER SYSTEM SET max_connections = 1500; // 设置最大连接数
SHOW config_file; // 现在配置文件路径
SELECT pg_reload_conf(); // 重新加载配置, 需要重启数据库
SHOW max_connections;

在线配置: 打开网站: https://pgtune.leopard.in.ua/https://hub.docker.com/_/postgres/ 查看详细的配置说明然后再配置, docker 必须添加listen_addresses = '*'来运行其他容器访问

listen_addresses = '*'

postgres:

SHOW config_file; // 在数据库客户端执行, 找到并替换容器的路径

docker cp conf/postgresql.conf postgres:/var/lib/postgresql/data/postgresql.conf

citus:

SHOW config_file;  // 在数据库客户端执行, 找到并替换容器的路径

docker cp citus/postgres.conf citus:/var/lib/postgresql/data/postgresql.conf