Saturday, October 1, 2011

Install PostgreSQL


Install PostgreSQL - Prepare your system




The shared_buffers default value setting in postgresql.conf is low (for legacy reasons). If you increase it, PostgreSQL may request a shared memory segment that exceeds your kernel's SHMMAX paramter.
The recommended method for configuring shared memory in OS X
is to create a file named /etc/sysctl.conf, containing variable assignments such as:

kern.sysv.shmmax=33554432
kern.sysv.shmmin=1
kern.sysv.shmmni=256
kern.sysv.shmseg=64
kern.sysv.shmall=8192
Note that in some OS X versions, all five shared-memory parameters must be set in /etc/sysctl.conf, else the values will be ignored. Beware that recent releases of OS X ignore attempts to set SHMMAX to a value that isn't an exact multiple of 4096. SHMALL is measured in 4 kB pages on this platform.


Installing PostgreSQL




The installer of last versions of PostgreSQL (9.1) downloaded from EnterpriseDB takes care of create the postgres user and the /etc/sysctl.conf file with the right set of values according you memory configuration.

This simplifies a lot the installation process. After asking for administrative access to your computer, the installer makes the modifications and ask for a reboot of your Mac. You need to run twice the installer to finish the process.


Starting and stopping PostgreSQL




One-click-installer also creates a launchd file:
/Library/LaunchDaemons/com.edb.launchd.postgresql-9.1.plist

You can use these command lines to start or stop PostgreSQL at any time:

$ sudo launchctl start com.edb.launchd.postgresql-9.1
$ sudo launchctl stop com.edb.launchd.postgresql-9.1

No comments:

Post a Comment