[slightly-OT] postgresql 8.1.3 on intel OS X problems


#1

Hi,

Anybody have success with postgresql 8.1.3 on a new Intel OS X box? All
hints welcome, please!

I installed postgres 8.1.3 via darwinports, and everything is great
until the initdb step.

Initdb fails on shmget saying it couldn’t allocate enough memory (see
below). So, I edited /etc/rc and increased kern.sysv.shmmax from
4194304 to 41943040 (4MB to 40MB)

After reboot and attempt to initdb, I get the same error.

Thanks,
John

jdell@xyz->sudo su postgres8 -c ‘/opt/local/lib/pgsql8/bin/initdb -D
/opt/local/var/db/pgsql8/postgres8’
Password:
The files belonging to this database system will be owned by user
“postgres8”.
This user must also own the server process.

The database cluster will be initialized with locale C.

fixing permissions on existing directory
/opt/local/var/db/pgsql8/postgres8 … ok
creating directory /opt/local/var/db/pgsql8/postgres8/global … ok
creating directory /opt/local/var/db/pgsql8/postgres8/pg_xlog … ok
creating directory
/opt/local/var/db/pgsql8/postgres8/pg_xlog/archive_status … ok
creating directory /opt/local/var/db/pgsql8/postgres8/pg_clog … ok
creating directory /opt/local/var/db/pgsql8/postgres8/pg_subtrans … ok
creating directory /opt/local/var/db/pgsql8/postgres8/pg_twophase … ok
creating directory
/opt/local/var/db/pgsql8/postgres8/pg_multixact/members … ok
creating directory
/opt/local/var/db/pgsql8/postgres8/pg_multixact/offsets … ok
creating directory /opt/local/var/db/pgsql8/postgres8/base … ok
creating directory /opt/local/var/db/pgsql8/postgres8/base/1 … ok
creating directory /opt/local/var/db/pgsql8/postgres8/pg_tblspc … ok
selecting default max_connections … 10
selecting default shared_buffers … 50
creating configuration files … ok
creating template1 database in /opt/local/var/db/pgsql8/postgres8/base/1
… FATAL: could not create shared memory segment: Cannot allocate
memory
DETAIL: Failed system call was shmget(key=1, size=1318912, 03600).
HINT: This error usually means that PostgreSQL’s request for a shared
memory segment exceeded available memory or swap space. To reduce the
request size (currently 1318912 bytes), reduce PostgreSQL’s
shared_buffers parameter (currently 50) and/or its max_connections
parameter (currently 10).
The PostgreSQL documentation contains more information about
shared memory configuration.
child process exited with exit code 1
initdb: removing contents of data directory
“/opt/local/var/db/pgsql8/postgres8”


#2

On Mar 2, 2006, at 5:06 PM, John D. wrote:

Hi,

Anybody have success with postgresql 8.1.3 on a new Intel OS X
box? All hints welcome, please!

I haven’t had any problems with the version from http://
sourceforge.net/projects/pgsqlformac/

=dudley


#3

Replying to myself…

Apparently this is not an uncommon problem according to google :slight_smile:

One post suggested changing the values as follows in /etc/rc:

old sysctl:
sysctl -w kern.sysv.shmmax=4194304 kern.sysv.shmmin=1
kern.sysv.shmmni=32 kern.sysv.shmseg=8 kern.sysv.shmall=1024

new sysctl:
sysctl -w kern.sysv.shmmax=167772160 kern.sysv.shmmin=1
kern.sysv.shmmni=32 kern.sysv.shmseg=8 kern.sysv.shmall=65536

When you change these values, you must reboot. Note, the shmmax value
must be a multiple of 1024.

This works!

http://joseph.randomnetworks.com/archives/2004/07/06/tweaking-mac-os-x-sysctl-values/
http://www.entropy.ch/phpbb2/viewtopic.php?t=652

and postgres docs about this:

http://www.postgresql.org/docs/current/static/kernel-resources.html

John