Thread: Problems with precompiled pgsql on mac

Problems with precompiled pgsql on mac

From
Peter Elmers
Date:
Hi Guys!

I am trying to deploy an application together with postgresql.
Therefore, i compiled postgres versions on Intel, G4 and G5.
Mostly, this works perfectly. But on some machines, the installation
was successful and postgres does not start.

PostGres does not write any log. If i try to start the postmaster
directly, he says, it will start but no process is shown within the
process list.

Maybe one of you had this problem already?

Best Regards,


Peter

Re: Problems with precompiled pgsql on mac

From
Shane Ambler
Date:
Peter Elmers wrote:
> Hi Guys!

A bit more info would help -

> I am trying to deploy an application together with postgresql.
> Therefore, i compiled postgres versions on Intel, G4 and G5.
> Mostly, this works perfectly. But on some machines, the installation was
> successful and postgres does not start.

Is there some common info on the machines that don't work?
Is it only cpu type that fails? Is the correct binary installed on them?
Is there a system version or installed software that is common to the
failing machines?
How much RAM is on the failing machines?
Are you adjusting the postgres.conf file? What changes? Try with a
standard postgres.conf first.
Are you adjusting any of the sysctl settings?

What version are you installing?

I do remember reading somewhere about Apple Remote Desktop 2 (or maybe
it was 3) (which uses pg as data source) may conflict with a postgres
install.

> PostGres does not write any log. If i try to start the postmaster
> directly, he says, it will start but no process is shown within the
> process list.

There should at least be a serverlog in the data directory. If you have
setup rotating logs look in data/pg_log

Bad permission settings on the data dir can stop postgres from starting.
Has the postgres user been created and set as the owner of the data dir
with drwx------ permissions set on the data dir and all contents?

What script are you using to start? Is POSTGRESQLSERVER=-YES- in
/etc/hostconfig Some scripts use this or similar to turn postgres on or off.
One thing to try is to try starting with pg_ctl - you may get more
feedback than the startupitems script.

Two logs to look at are console.log and system.log which may have STDERR
output not seen at the terminal. You can use Console.app to view them or
open them directly, console.log is in /Library/Logs/Console and
system.log is in /var/log



--

Shane Ambler
pgSQL@Sheeky.Biz

Get Sheeky @ http://Sheeky.Biz

Re: Problems with precompiled pgsql on mac

From
Peter Elmers
Date:
Hi Shane,


> Peter Elmers wrote:
>> Hi Guys!
>
> A bit more info would help -
>
>> I am trying to deploy an application together with postgresql.
>> Therefore, i compiled postgres versions on Intel, G4 and G5.
>> Mostly, this works perfectly. But on some machines, the
>> installation was successful and postgres does not start.
>
> Is there some common info on the machines that don't work?
There must be. But at the moment, i did not find anything.
Architecture and Ressources are different.

> Is it only cpu type that fails? Is the correct binary installed on
> them?
The correct binary is used.

> Is there a system version or installed software that is common to
> the failing machines?
10.4.9. On my machines, this works perfectly.

> How much RAM is on the failing machines?
Also different.

> Are you adjusting the postgres.conf file? What changes? Try with a
> standard postgres.conf first.
Changes are made for the amount of connections. Otherwise i had to
change the sysctl settings.

max_connections = 50
shared_buffers = 1MB

> Are you adjusting any of the sysctl settings?
>
No

> What version are you installing?

I compiled 8.2.3

>
> I do remember reading somewhere about Apple Remote Desktop 2 (or
> maybe it was 3) (which uses pg as data source) may conflict with a
> postgres install.

>
>> PostGres does not write any log. If i try to start the postmaster
>> directly, he says, it will start but no process is shown within
>> the process list.
>
> There should at least be a serverlog in the data directory. If you
> have setup rotating logs look in data/pg_log
There is definitely no log.

>
> Bad permission settings on the data dir can stop postgres from
> starting. Has the postgres user been created and set as the owner
> of the data dir with drwx------ permissions set on the data dir and
> all contents?
I already checked this. All permissions are correct. We use a own
user to keep it clean if a possible postgres standard installation
exist on the target machine.

>
> What script are you using to start? Is POSTGRESQLSERVER=-YES- in /
> etc/hostconfig Some scripts use this or similar to turn postgres on
> or off.
> One thing to try is to try starting with pg_ctl - you may get more
> feedback than the startupitems script

We use a own start script together with the systemstarter to get the
database up each time the computer starts. In detail, it just uses
"pg_ctl -D $Somewhere -l $OtherWhere start"

> Two logs to look at are console.log and system.log which may have
> STDERR output not seen at the terminal. You can use Console.app to
> view them or open them directly, console.log is in /Library/Logs/
> Console and system.log is in /var/log
I tailed the system.log directly after trying to start pg_ctl. Not a
single line about postgres. Also for the crashlog.
The Console.log is new to me. I will check this.


Thanks for your help!

>
>
>
> --
>
> Shane Ambler
> pgSQL@Sheeky.Biz
>
> Get Sheeky @ http://Sheeky.Biz
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: explain analyze is your friend


Re: Problems with precompiled pgsql on mac

From
Thomas Pundt
Date:
Hi,

On Tuesday 27 March 2007 09:38, Peter Elmers wrote:
| I tailed the system.log directly after trying to start pg_ctl. Not a
| single line about postgres. Also for the crashlog.
| The Console.log is new to me. I will check this.

also: you might want to try ktrace-ing the program and look at where
exactly it barfs. I'd guess this could be a shared memory problem (too
low shm settings).

Ciao,
Thomas

--
Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/ ----

Re: Problems with precompiled pgsql on mac

From
Peter Elmers
Date:
Hi Thomas,

We already ktrace'd the programm on one of the failing machines and
noticed nothing special.
It looks nearly identical to the output of one of our computers with
a running version.

Thanks,

Peter

Am 27.03.2007 um 10:29 schrieb Thomas Pundt:

> Hi,
>
> On Tuesday 27 March 2007 09:38, Peter Elmers wrote:
> | I tailed the system.log directly after trying to start pg_ctl. Not a
> | single line about postgres. Also for the crashlog.
> | The Console.log is new to me. I will check this.
>
> also: you might want to try ktrace-ing the program and look at where
> exactly it barfs. I'd guess this could be a shared memory problem (too
> low shm settings).
>
> Ciao,
> Thomas
>
> --
> Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/
> ----
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
>                 http://www.postgresql.org/about/donate


Re: Problems with precompiled pgsql on mac

From
Shane Ambler
Date:
Peter Elmers wrote:
> Hi Shane,
>
>
>> Peter Elmers wrote:
>>> Hi Guys!
>>
>> A bit more info would help -
>>
>>> I am trying to deploy an application together with postgresql.
>>> Therefore, i compiled postgres versions on Intel, G4 and G5.
>>> Mostly, this works perfectly. But on some machines, the installation
>>> was successful and postgres does not start.
>>
>> Is there some common info on the machines that don't work?
> There must be. But at the moment, i did not find anything. Architecture
> and Ressources are different.

So it isn't just one cpu type that fails.

Is there software running (most likely of the server variety) already
that may use up various shared resources that prevents postgres from
allocating what it needs? I'm referring to the sysctl options that you
would normally increase so you can use some of the larger settings in
postgres buffers etc. Something else may already be using most of these
resources.

Do you have the option of being able to stop any of these services for a
few minutes to test if this is the case?

>> Is it only cpu type that fails? Is the correct binary installed on them?
> The correct binary is used.
>
>> Is there a system version or installed software that is common to the
>> failing machines?
> 10.4.9. On my machines, this works perfectly.
>
>> How much RAM is on the failing machines?
> Also different.

Shouldn't matter if you aren't trying to allocate the resources but do
all the failing machines have more than 4GB RAM?

>> Are you adjusting the postgres.conf file? What changes? Try with a
>> standard postgres.conf first.
> Changes are made for the amount of connections. Otherwise i had to
> change the sysctl settings.
>
> max_connections = 50
> shared_buffers = 1MB
>
>> Are you adjusting any of the sysctl settings?
>>
> No
>
>> What version are you installing?
>
> I compiled 8.2.3
>
>>
>> What script are you using to start? Is POSTGRESQLSERVER=-YES- in
>> /etc/hostconfig Some scripts use this or similar to turn postgres on
>> or off.
>> One thing to try is to try starting with pg_ctl - you may get more
>> feedback than the startupitems script
>
> We use a own start script together with the systemstarter to get the
> database up each time the computer starts. In detail, it just uses
> "pg_ctl -D $Somewhere -l $OtherWhere start"

Try starting it with pg_ctl directly instead of using the script - the
script may recieve and hide some startup output that you will see on the
terminal if you run pg_ctl directly.


--

Shane Ambler
pgSQL@Sheeky.Biz

Get Sheeky @ http://Sheeky.Biz

Re: Problems with precompiled pgsql on mac

From
Peter Elmers
Date:
Hi together,

The problem is not solved, but we reduced it: it occures only if
apple remote desktop is running. So switching off ARD results in a
running postgresql system.
But this can only be a workaround. Does anybody know why the two
programs do not work together? Google says that ARD uses postgres,
too. But we are using another port and another user...

Best Regards,


Peter


Am 27.03.2007 um 10:40 schrieb Peter Elmers:

> Hi Thomas,
>
> We already ktrace'd the programm on one of the failing machines and
> noticed nothing special.
> It looks nearly identical to the output of one of our computers
> with a running version.
>
> Thanks,
>
> Peter
>
> Am 27.03.2007 um 10:29 schrieb Thomas Pundt:
>
>> Hi,
>>
>> On Tuesday 27 March 2007 09:38, Peter Elmers wrote:
>> | I tailed the system.log directly after trying to start pg_ctl.
>> Not a
>> | single line about postgres. Also for the crashlog.
>> | The Console.log is new to me. I will check this.
>>
>> also: you might want to try ktrace-ing the program and look at where
>> exactly it barfs. I'd guess this could be a shared memory problem
>> (too
>> low shm settings).
>>
>> Ciao,
>> Thomas
>>
>> --
>> Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/
>> ----
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 7: You can help support the PostgreSQL project by donating at
>>
>>                 http://www.postgresql.org/about/donate
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster


Re: Problems with precompiled pgsql on mac

From
Tom Lane
Date:
Peter Elmers <p.elmers@gmx.de> writes:
> The problem is not solved, but we reduced it: it occures only if
> apple remote desktop is running. So switching off ARD results in a
> running postgresql system.
> But this can only be a workaround. Does anybody know why the two
> programs do not work together? Google says that ARD uses postgres,
> too. But we are using another port and another user...

Yeah, I believe ARD does have an embedded postgres instance.  You might
be running into Apple's ridiculously low system-wide SHMMAX setting;
it's only big enough to let one postgres run at a time, unless you
hobble performance by reducing shared_buffers etc well below default.
See our manual for how to increase SHMMAX on OS X --- it's trickier
than it ought to be :-(

            regards, tom lane

Re: Problems with precompiled pgsql on mac

From
Peter Elmers
Date:
Hi!

Yes, that is indeed the problem.
I tried the recommended settings for sysctl.conf. Now ard and
postgresql are working well together.

Now i am ongoing to optimize the settings. Without changing the
sysctl.conf or rc, i am able to get postgres running with the
following settings:

max_connections = 40
shared_buffers=640kB

Does anybody see any problems with theese settings? The amount of
parallel connections should not be a big problem, because it is a
dedicated database.


Thanks Tom and best Regards,


Peter

Am 10.04.2007 um 16:30 schrieb Tom Lane:

> Peter Elmers <p.elmers@gmx.de> writes:
>> The problem is not solved, but we reduced it: it occures only if
>> apple remote desktop is running. So switching off ARD results in a
>> running postgresql system.
>> But this can only be a workaround. Does anybody know why the two
>> programs do not work together? Google says that ARD uses postgres,
>> too. But we are using another port and another user...
>
> Yeah, I believe ARD does have an embedded postgres instance.  You
> might
> be running into Apple's ridiculously low system-wide SHMMAX setting;
> it's only big enough to let one postgres run at a time, unless you
> hobble performance by reducing shared_buffers etc well below default.
> See our manual for how to increase SHMMAX on OS X --- it's trickier
> than it ought to be :-(
>
>             regards, tom lane
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org


Re: Problems with precompiled pgsql on mac

From
Tom Lane
Date:
Peter Elmers <p.elmers@gmx.de> writes:
> Now i am ongoing to optimize the settings. Without changing the
> sysctl.conf or rc, i am able to get postgres running with the
> following settings:

> max_connections = 40
> shared_buffers=640kB

> Does anybody see any problems with theese settings?

Yeah, that's only 80 buffers, which is at least one order of magnitude
too low for reasonable performance, probably two orders.  This would
do for a toy installation that wasn't working hard, but not for any
serious load.

Darwin's default SHMMAX is barely enough for one postmaster; you really
can't run two without fixing it.

            regards, tom lane