Thread: Problems with initdb

Problems with initdb

From
Kim Kohen
Date:
Hi all,

I'm endeavouring to build postgresql from source (something with which I
have no experience). I can configure, make and make install and all runs
fine but when I try to run initdb it fails with a message about shared
memory buffers and maximum connections. The docs refer to changing these in
the .config file but if I create a config file and place it in the data
folder then initdb refuses to run on that folder.

Is there another way to change the maximum connections and shared buffer
size - prior to any dbs being initialised? Can this be set somewhere when
doing the make or make install?

Any help for a newbie trying hard to understand would be appreciated.

cheers

Kim



Re: Problems with initdb

From
Tom Lane
Date:
Kim Kohen <kim@webguide.com.au> writes:
> I'm endeavouring to build postgresql from source (something with which I
> have no experience). I can configure, make and make install and all runs
> fine but when I try to run initdb it fails with a message about shared
> memory buffers and maximum connections. The docs refer to changing these in
> the .config file but if I create a config file and place it in the data
> folder then initdb refuses to run on that folder.

If initdb fails on this, then either you don't have shared memory
support in your kernel at all, or the limits are so small that Postgres
can't usefully run under them.  Putting in a config file wouldn't help.

What platform are you on exactly, and what exactly is the failure
message?  Also, what PG version are we talking about?

            regards, tom lane

Re: Problems with initdb

From
Kim Kohen
Date:
G'day Tom

Thanks for the reply

> If initdb fails on this, then either you don't have shared memory
> support in your kernel at all, or the limits are so small that Postgres
> can't usefully run under them.  Putting in a config file wouldn't help.
> What platform are you on exactly, and what exactly is the failure
> message?  Also, what PG version are we talking about?
€€€€
I'm installing on Mac OSX (10.3.8 - 1,5gig ram) and the exact error message
is:

creating template1 database in /usr/local/pgsql/data/base/1 ... FATAL:
could not create shared memory segment: Cannot allocate memory
DETAIL:  Failed system call was shmget(key=1, size=1122304, 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 1122304 bytes), reduce PostgreSQL's shared_buffers
parameter (currently 50) and/or its max_connections parameter (currently
10).

I know Postgres can be run on this machine (I downloaded a binary a couple
of weeks ago and it's been running fine) but I need full text indexing and
want to try tsearch2. From what I can find, the only way I can do this is to
compile from source, hence my predicament. I'm open to suggestions of how I
can use tsearch2 with the existing install but I must say that I'm not
averse to learning how to compile things - I figure it can't be a bad thing
to know.

Cheers and thanks again

Kim



Re: Problems with initdb

From
Kim Kohen
Date:
G'day Tom

>  Also, what PG version are we talking about?
€€€€
Sorry, forgot the PG version - it's 8.0.1 which is the same version as the
binary I have running.

Cheers

Kim



Re: Problems with initdb

From
Tom Lane
Date:
Kim Kohen <kim@webguide.com.au> writes:
> As I was sending the last email to you it struck me as strange that I could
> be running a binary copy but another would fail to initialise. Simple test -
> I shut down the other server and tried again - initdb ran fine and I now
> have the compiled version up and running.

Yeah ... the default shmem limits on OS X are too small to allow two
postmasters to run at once :-(.  See the PG admin guide for details
on how to increase the limits.

            regards, tom lane