Обсуждение: initdb fails to allocate shared memory

Поиск
Список
Период
Сортировка

initdb fails to allocate shared memory

От
"A.M."
Дата:
I am using pgsql9.0b4 (but pgsql8.4 exhibits the same behavior) on MacOS 10.6.4 and initdb fails:

/usr/local/pgsql90beta/bin/initdb -D /Volumes/Data/pgsql90b/ -E UTF8
The files belonging to this database system will be owned by user "agentm".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default text search configuration will be set to "english".

creating directory /Volumes/Data/pgsql90b ... ok
creating subdirectories ... ok
selecting default max_connections ... 10
selecting default shared_buffers ... 400kB
creating configuration files ... ok
creating template1 database in /Volumes/Data/pgsql90b/base/1 ... FATAL:  could not create shared memory segment: Cannot
allocatememory 
DETAIL:  Failed system call was shmget(key=1, size=1703936, 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 1703936 bytes), reduce PostgreSQL's shared_buffers parameter (currently 50)
and/orits max_connections parameter (currently 14). 
    The PostgreSQL documentation contains more information about shared memory configuration.
child process exited with exit code 1
initdb: removing data directory "/Volumes/Data/pgsql90b"

I would like to create the database space and then reduce the shared memory requirements in postgresql.conf, but this
situationseems to create a chicken-and-egg problem. How can I reduce shared_buffers or max_connections prior to running
initdb?

Cheers,
M


Re: initdb fails to allocate shared memory

От
"Joshua D. Drake"
Дата:
On Wed, 2010-08-25 at 11:15 -0400, A.M. wrote:
> I am using pgsql9.0b4 (but pgsql8.4 exhibits the same behavior) on MacOS 10.6.4 and initdb fails:
> initdb: removing data directory "/Volumes/Data/pgsql90b"
>
> I would like to create the database space and then reduce the shared memory requirements in postgresql.conf, but this
situationseems to create a chicken-and-egg problem. How can I reduce shared_buffers or max_connections prior to running
initdb?

If you don't have enough shared memory to initdb, you don't have enough
to run postgresql. You need to increase your shared memory for MacOS
per:

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

And then initdb.

Sincerely,

Joshua D. Drake

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt

Re: initdb fails to allocate shared memory

От
"A.M."
Дата:
On Aug 25, 2010, at 11:31 AM, Joshua D. Drake wrote:

> On Wed, 2010-08-25 at 11:15 -0400, A.M. wrote:
>> I am using pgsql9.0b4 (but pgsql8.4 exhibits the same behavior) on MacOS 10.6.4 and initdb fails:
>> initdb: removing data directory "/Volumes/Data/pgsql90b"
>>
>> I would like to create the database space and then reduce the shared memory requirements in postgresql.conf, but
thissituation seems to create a chicken-and-egg problem. How can I reduce shared_buffers or max_connections prior to
runninginitdb? 
>
> If you don't have enough shared memory to initdb, you don't have enough
> to run postgresql. You need to increase your shared memory for MacOS
> per:
>
> http://www.postgresql.org/docs/8.4/static/kernel-resources.html
>
> And then initdb.

Then it seems that the error reporting could be improved to not mention "shared_buffers" and "max_connections" neither
ofwhich I can touch during initdb. 

"creating template1 database in /Volumes/Data/pgsql90b/base/1 ... FATAL:  could not create shared memory segment:
Cannotallocate memory 
DETAIL:  Failed system call was shmget(key=1, size=1703936, 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 1703936 bytes), reduce PostgreSQL's shared_buffers parameter (currently 50)
and/orits max_connections parameter (currently 14). 
    The PostgreSQL documentation contains more information about shared memory configuration."

Cheers,
M

Re: initdb fails to allocate shared memory

От
Tom Lane
Дата:
"A.M." <agentm@themactionfaction.com> writes:
> Then it seems that the error reporting could be improved to not mention "shared_buffers" and "max_connections"
neitherof which I can touch during initdb. 

The error has to be phrased to cover the case where you hit it after
initdb.  It would be quite unhelpful to *not* mention those settings.

However, it's odd that you got this variant of the HINT and not the one
that suggests increasing SHMMAX.  Looking at the code, that means that
shmget returned ENOMEM, not EINVAL, which surprises me.  What did you
have your kernel settings at?  Could we see the output of
    sysctl -a | grep sysv

            regards, tom lane

Re: initdb fails to allocate shared memory

От
Tom Lane
Дата:
I wrote:
> Could we see the output of
>     sysctl -a | grep sysv

"ipcs -a" might be informative, too.

            regards, tom lane

Re: initdb fails to allocate shared memory

От
"Joshua D. Drake"
Дата:
On Wed, 2010-08-25 at 11:15 -0400, A.M. wrote:
> I am using pgsql9.0b4 (but pgsql8.4 exhibits the same behavior) on MacOS 10.6.4 and initdb fails:
> initdb: removing data directory "/Volumes/Data/pgsql90b"
>
> I would like to create the database space and then reduce the shared memory requirements in postgresql.conf, but this
situationseems to create a chicken-and-egg problem. How can I reduce shared_buffers or max_connections prior to running
initdb?

If you don't have enough shared memory to initdb, you don't have enough
to run postgresql. You need to increase your shared memory for MacOS
per:

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

And then initdb.

Sincerely,

Joshua D. Drake

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt