現状
# ipcs -M shminfo: shmmax: 33554432 (max shared memory segment size) shmmin: 1 (min shared memory segment size) shmmni: 192 (max number of shared memory identifiers) shmseg: 128 (max shared memory segments per process) shmall: 8192 (max amount of shared memory in pages)
または
# sysctl -a | grep kern.ipc kern.ipc.maxsockbuf: 262144 kern.ipc.sockbuf_waste_factor: 8 kern.ipc.somaxconn: ...... kern.ipc.msgseg: 2048 kern.ipc.msgssz: 8 kern.ipc.msgtql: 40 kern.ipc.msgmnb: 2048 kern.ipc.msgmni: 40 kern.ipc.msgmax: 16384 kern.ipc.semaem: 16384 kern.ipc.semvmx: 32767 kern.ipc.semusz: 136 kern.ipc.semume: 10 kern.ipc.semopm: 100 kern.ipc.semmsl: 60 kern.ipc.semmnu: 30 kern.ipc.semmns: 60 kern.ipc.semmni: 10 kern.ipc.semmap: 30 ......
To allow many simultaneous connections to your PostgreSQL server, you should raise the SystemV shared memory limits in your kernel. Here are example values for allowing up to 180 clients (configurations in postgresql.conf also needed, of course): options SYSVSHM options SYSVSEM options SYSVMSG options SHMMAXPGS=65536 options SEMMNI=40 options SEMMNS=240 options SEMUME=40 options SEMMNU=120
shmmaxが32M(33554432/1024/1024)。これを増加させる。
kern.ipc.shmmax=536870912 kern.ipc.shmall=131072
/boot/loader.confに以下の記述をして、セマフォ関係もDefaultの5倍くらいにしておく
kern.ipc.semmni=50 kern.ipc.semmns=300 kern.ipc.semmnu=150
/usr/local/pgsql/data/postgresql.conf 3)
shared_buffers = 28MB # min 128kB ↓ shared_buffers = 256MB # min 128kB
/usr/local/pgsql/data/postgresql.conf 4)
max_connections = 48 ↓ max_connections = 128
/usr/local/pgsql/data/postgresql.conf
#wal_buffers = 64kB # min 32kB ↓ #wal_buffers = 256kB # min 32kB
showコマンド
SHOW all;
… | ||
max_connections | 128 | Sets the maximum number of concurrent connections. |
max_files_per_process | 1000 | Sets the maximum number of simultaneously open files for each server process. |
max_function_args | 100 | Shows the maximum number of function arguments. |
max_identifier_length | 63 | Shows the maximum identifier length. |
… |
または
SHOW max_connections; 128
SELECT datname, usename, COUNT(*) FROM pg_stat_activity GROUP BY datname, usename;