docker run --name postgres -e POSTGRES_PASSWORD=123456 -p 5432:5432 -v /mydata/postgres/pgdata:/var/lib/postgresql/data -d postgres
修改postgresql最大连接数
vim /mydata/postgres/pgdata/postgresql.conf
附:常用连接数查看命令
-- 1.查看当前配置的最大连接数
show max_connections;-- 2.查询当前活跃连接数
select count(1) from pg_stat_activity;-- 3.查看指定IP的活跃连接信息
select * from pg_stat_activity where client_addr = '192.168.xx.xx';-- 4.按IP地址查询当前活跃的连接数
select client_addr, count(1) num from pg_stat_activity group by client_addr order by num desc;-- 5.按用户查询当前活跃的连接数
select usename, count(1) num from pg_stat_activity group by usename order by num desc;-- 6.清理空闲连接
select pg_terminate_backend(pid) from pg_stat_activity where state='idle';