Forum OpenACS Q&A: Postgres and Open files

Collapse
Posted by Jun Yamog on
Hi,

I am just posting this up in the probability that some people may run
into this problem.

Basically postgres backends is aborting and connections from nsd to
postgres is getting cut off.  Upon investigation it was because the
system was running out of file handles.

Solution in Linux:

- checkout the the current open file handles. go to /proc/sys/fs. cat
file-nr.
- cat file-max.  This is the current maximum file handles that can be
opened.  Now increase it by "echo '[your new max]' > file-max".
- To make the solution permanent on Red Hat 6.2 and above edit
/etc/sysctl.conf.  Put the lines "fs.file-max = [your new max]".

There also lots of tips on the postgres docs on the admin pages.
Check them out it's very useful.  I hope in the future someone will
stumble on this post with same problem.

Collapse
Posted by Gilbert Wong on

Same goes for FreeBSD. I've been using:

sysctl -w kern.maxfiles=5000
sysctl -w kern.maxfilesperproc=5000

on my FreeBSD box. I believe the default was 1024.