Thread: Changing from default configuration options in 7.1?

Changing from default configuration options in 7.1?

From
Steve Wampler
Date:
I just upgraded from 7.0.3 to  7.1 (using the RH rpms) with no
major problems.  Nice!

However, I'm getting some strange behaviour from the init
script (/etc/rc.d/init.d/postgresql).  In particular, a
restart when the database is running fails because the
"sleep 2" in stop() is no longer long enough (on a dual-cpu
PIII/650 machine!).  So "pidof postmaster" returns a non-null
value and *that* results in a syntax error:

  Checking postgresql installation:                          [  OK  ]
  ./postgresql: [: 18209: unary operator expected

(I think the test should become something like "if [ -n "$pid" ];..."
instead of just "if [ $pid ]", which at least prevents the
syntax error...)

Of course, fixing the syntax error isn't the main problem, which
is that the shutdown of the old postmaster(s) hasn't completed yet,
resulting in a "false positive" from the pidof operation.

I bumped the "sleep 2" up to "sleep 5" and the problem went away.
Surely there's a better fix?


--
Steve Wampler-  SOLIS Project, National Solar Observatory
swampler@noao.edu

Re: Changing from default configuration options in 7.1?

From
Karl DeBisschop
Date:
Steve Wampler wrote:
>
> I just upgraded from 7.0.3 to  7.1 (using the RH rpms) with no
> major problems.  Nice!
>
> However, I'm getting some strange behaviour from the init
> script (/etc/rc.d/init.d/postgresql).  In particular, a
> restart when the database is running fails because the
> "sleep 2" in stop() is no longer long enough (on a dual-cpu
> PIII/650 machine!).  So "pidof postmaster" returns a non-null
> value and *that* results in a syntax error:
>
>   Checking postgresql installation:                          [  OK  ]
>   ./postgresql: [: 18209: unary operator expected

ISTM that every occurrence of

if [ $pid ]

should be

if [ -n "$pid" ]

>
> (I think the test should become something like "if [ -n "$pid" ];..."
> instead of just "if [ $pid ]", which at least prevents the
> syntax error...)
>
> Of course, fixing the syntax error isn't the main problem, which
> is that the shutdown of the old postmaster(s) hasn't completed yet,
> resulting in a "false positive" from the pidof operation.
>
> I bumped the "sleep 2" up to "sleep 5" and the problem went away.
> Surely there's a better fix?

In the stop() function, I use:

        su -l postgres -c "/usr/bin/pg_ctl -D $PGDATA -w stop"

with no sleep at all

I sent both these changes to lamar during rc4, but I got no reply. I
don't know if he got them and determined that my patches were worthless,
or if they did not reach him. In any case, those two changes work for
me. YMMV.

--
Karl

Newbie struggling to set $PGDATA

From
Geoff Caplan
Date:
Hello Steve,

Thursday, April 19, 2001, 4:53:58 PM, you wrote:


SW> I just upgraded from 7.0.3 to  7.1 (using the RH rpms) with no
SW> major problems.  Nice!

SW> However, I'm getting some strange behaviour from the init
SW> script (/etc/rc.d/init.d/postgresql).  In particular, a
SW> restart when the database is running fails because the
SW> "sleep 2" in stop() is no longer long enough (on a dual-cpu
SW> PIII/650 machine!).  So "pidof postmaster" returns a non-null
SW> value and *that* results in a syntax error:

SW>   Checking postgresql installation:                          [  OK  ]
SW>   ./postgresql: [: 18209: unary operator expected

SW> (I think the test should become something like "if [ -n "$pid" ];..."
SW> instead of just "if [ $pid ]", which at least prevents the
SW> syntax error...)

SW> Of course, fixing the syntax error isn't the main problem, which
SW> is that the shutdown of the old postmaster(s) hasn't completed yet,
SW> resulting in a "false positive" from the pidof operation.

SW> I bumped the "sleep 2" up to "sleep 5" and the problem went away.
SW> Surely there's a better fix?

Hi

Please help out a Linx/Postgres newbie.

I simply want to set the $PGDATA environmental variable, but can't
figure out how. The docs assume you already know...

I have tried setting it in my bash /etc/profile configuration file,
and it shows up ok if I "echo $PGDATA" in the shell. But none of the
postgres utilities such as "initdb" seem to be able to find it.

What don't I understand? I have already checked the docs/GreatBridge
manual/faqs/archive, so I would very much appreciate some help.

Geoff Caplan



Re: Newbie struggling to set $PGDATA

From
Tom Lane
Date:
Geoff Caplan <geoff@productivity.co.uk> writes:
> I have tried setting it in my bash /etc/profile configuration file,
> and it shows up ok if I "echo $PGDATA" in the shell. But none of the
> postgres utilities such as "initdb" seem to be able to find it.

You probably forgot to say "export PGDATA"; without that it's just a
local variable in your shell.

            regards, tom lane

Re: Newbie struggling to set $PGDATA

From
"Oliver Elphick"
Date:
Geoff Caplan wrote:

  >Please help out a Linx/Postgres newbie.
  >
  >I simply want to set the $PGDATA environmental variable, but can't
  >figure out how. The docs assume you already know...
  >
  >I have tried setting it in my bash /etc/profile configuration file,
  >and it shows up ok if I "echo $PGDATA" in the shell. But none of the
  >postgres utilities such as "initdb" seem to be able to find it.
  >
  >What don't I understand? I have already checked the docs/GreatBridge
  >manual/faqs/archive, so I would very much appreciate some help.

Maybe you need to export it.  Unless you export a variable, it remains
local to the shell where you define it.

PGDATA=/path/to/data
export PGDATA


or

export PGDATA=/path/to/data


--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Nay, in all these things we are more than conquerors
      through him that loved us."    Romans 8:37



Re: Newbie struggling to set $PGDATA

From
Nils Zonneveld
Date:

Geoff Caplan wrote:

> Please help out a Linx/Postgres newbie.
>
> I simply want to set the $PGDATA environmental variable, but can't
> figure out how. The docs assume you already know...
>
> I have tried setting it in my bash /etc/profile configuration file,
> and it shows up ok if I "echo $PGDATA" in the shell. But none of the
> postgres utilities such as "initdb" seem to be able to find it.
>
> What don't I understand? I have already checked the docs/GreatBridge
> manual/faqs/archive, so I would very much appreciate some help.
>
> Geoff Caplan
>

Look in your /etc/profile file if /etc/profile.local is called if so you
can add to profile.local or otherwise create a new profile.local with
the following lines:

PATH=$PATH:/usr/local/pgsql/bin
export PATH
MANPATH=$MANPATH:/usr/local/pgsql/man
export MANPATH
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH
PGLIB=/usr/local/pgsql/lib
export PGLIB
PGDATA=/var/lib/pgsql
export PGDATA

(depending on your own path settings of course)

If /etc/profile.local is not used, add the lines to /etc/profile.

HTH,

Nils Zonneveld