Re: initdb problem - Mailing list pgsql-admin

From Joe Barwell
Subject Re: initdb problem
Date
Msg-id 46885393.275.4b70.28086267@ihug.co.nz
Whole thread Raw
In response to initdb problem  (Joe Barwell <jbar@es.co.nz>)
List pgsql-admin
Hello people,

My initdb problem has been solved (PostgreSQL 8.2.4, Mac OS
X 10.3.9). I thought I would post a brief summary, but first
I'd like to thank everyone on this list who so kindly and
generously made suggestions. I'd particularly like to thank
Sean Dooley <srd1@st-andrews.ac.uk>, who assisted me greatly
offlist, and whose suggestions eventually provided the
solution.

Earlier in this thread it was suggested that another, older
version of postgres may already be running on my machine,
but I believe that not to have been the case. One of Sean's
suggestions was to run the following in Terminal:

ps -aux | grep post

which returned nothing other than itself, whereas run
earlier today it shows:

postgres   686   0.0  0.2    40484   1284 std- S    Fri07AM
 0:03.53 /opt/local/lib/postgresql82/bi
postgres   689   0.0  0.1    40484    484  ??  Ss   Fri07AM
 1:00.27 postgres: writer process
postgres   690   0.0  0.0    36460    168  ??  Ss   Fri07AM
 0:07.16 postgres: stats collector proc
postgres  1228   0.0  0.4    41092   2804  ??  Ss    7:57AM
 0:00.46 postgres: acorn testdb 127.0.0
postgres  1230   0.0  0.4    41092   2428  ??  Ss    7:58AM
 0:00.18 postgres: acorn postgres 127.0
acorn     1255   0.0  0.0     8860    120 std  R+    9:56AM
 0:00.00 grep post

Postgres is also now clearly visible in Activity Monitor
(five times, as above).

What worked for me was the following:

At Sean's suggestion I uninstalled the Postgres 8.2.4 I'd
got from the universal binary installer, and instead used
macports
<http://svn.macosforge.org/repository/macports/downloads/>
(NB, requires apple developer tools be already installed) to
install postgres:

sudo port selfupdate
sudo port install postgresql82
sudo port install postgresql82-doc
sudo port install postgresql82-server

The latter installation handily advised (in Terminal)
editing the file /etc/hostconfig by adding the line:

POSTGRESQL82-SERVER=-YES-

to make postgres server run on startup.

I then ran through the following:

sudo mkdir -p /opt/local/var/db/postgresql82/defaultdb
sudo chown postgres:postgres
/opt/local/var/db/postgresql82/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql82/bin/initdb
-D /opt/local/var/db/postgresql82/defaultdb'

which created the cluster. At the end of that Terminal
advised using:

/opt/local/lib/postgresql82/bin/postgres -D
/opt/local/var/db/postgresql82/defaultdb
or
/opt/local/lib/postgresql82/bin/pg_ctl -D
/opt/local/var/db/postgresql82/defaultdb -l logfile start

to start the database server, but what actually worked was
the following:

sudo su postgres -c '/opt/local/lib/postgresql82/bin/pg_ctl
-D /opt/local/var/db/postgresql82/defaultdb start'


(this fed the log back to Terminal). Beware when trying to
specify a logfile location that one chooses a directory to
which the postgres user can write--i.e. it may be simpler to
use a full path, such as:

sudo su postgres -c '/opt/local/lib/postgresql82/bin/pg_ctl
-D /opt/local/var/db/postgresql82/defaultdb -l
/opt/local/var/db/postgresql82/defaultdb/logfile start'

as otherwise the logfile will default to creation in the
current directory, for which postgres may not have
permissions.

Now that I have postgres running I think it best if I soon
leave this forum, and join another more suited to the
no-doubt many other very basic problems and questions I
shall encounter. Thanks again.

Cheers!

Joe

pgsql-admin by date:

Previous
From: Simon
Date:
Subject: --with-ldap prerequisites
Next
From: "Simon Riggs"
Date:
Subject: Re: missing history file