Thread: Databse installation problem

Databse installation problem

From
Bhushan Verma
Date:

I have tried to install postgres version 8.3.7 as follows

rm -rf /var/lib/pgsql
mkdir /var/lib/pgsql
./configure --prefix /var/lib/pgsql
gmake
su
gmake install
adduser postgres
mkdir /var/lib/pgsql/data
chown postgres /var/lib/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /var/lib/pgsql/data
/usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data >pgstartup.log 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

then i log on database to see the version
test=> select version();
                                                version
-------------------------------------------------------------------------------------------------------
 PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.3.0 20080314 (Red Hat 4.3.0-3)
(1 row)
but its showing me 8.3.1 that was my previous version.
Could anyone tell me what is the problem.

--
With Regards,
Bhushan

Re: Databse installation problem

From
Gurjeet Singh
Date:
This does not belong to pgsql-bugs.

I have a feeling that your previous version of postgres is still running. You should have stopped that daemon before doing 'rm -rf'. attaching/pasting your pgstartup.log would also help.

For now, kill your current postgres processes, and then try to start again.

Best regards,

On Mon, Sep 21, 2009 at 11:23 AM, Bhushan Verma <verma.bhushan@gmail.com> wrote:

I have tried to install postgres version 8.3.7 as follows

rm -rf /var/lib/pgsql
mkdir /var/lib/pgsql
./configure --prefix /var/lib/pgsql
gmake
su
gmake install
adduser postgres
mkdir /var/lib/pgsql/data
chown postgres /var/lib/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /var/lib/pgsql/data
/usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data >pgstartup.log 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

then i log on database to see the version
test=> select version();
                                                version
-------------------------------------------------------------------------------------------------------
 PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.3.0 20080314 (Red Hat 4.3.0-3)
(1 row)
but its showing me 8.3.1 that was my previous version.
Could anyone tell me what is the problem.

--
With Regards,
Bhushan



--
Lets call it Postgres

EnterpriseDB      http://www.enterprisedb.com

gurjeet[.singh]@EnterpriseDB.com

singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com
Twitter: singh_gurjeet
Skype: singh_gurjeet

Mail sent from my BlackLaptop device

Re: Databse installation problem

From
Tim Bowden
Date:
On Mon, 2009-09-21 at 11:23 +0530, Bhushan Verma wrote:
>
> I have tried to install postgres version 8.3.7 as follows
>
> rm -rf /var/lib/pgsql
> mkdir /var/lib/pgsql
> ./configure --prefix /var/lib/pgsql
> gmake
> su
> gmake install
> adduser postgres
> mkdir /var/lib/pgsql/data
> chown postgres /var/lib/pgsql/data
> su - postgres
> /usr/local/pgsql/bin/initdb -D /var/lib/pgsql/data
> /usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data >pgstartup.log
> 2>&1 &
> /usr/local/pgsql/bin/createdb test
> /usr/local/pgsql/bin/psql test
>
> then i log on database to see the version
> test=> select version();
>                                                 version
> -------------------------------------------------------------------------------------------------------
>  PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled by GCC gcc (GCC)
> 4.3.0 20080314 (Red Hat 4.3.0-3)
> (1 row)
> but its showing me 8.3.1 that was my previous version.
> Could anyone tell me what is the problem.
>
> --
> With Regards,
> Bhushan

Have you tried running ldconfig to refresh the lib cache?

fwiw I always put /var/lib/pgsql/lib (or equivalent) in /etc/ld.so.conf
(or /etc/ld.so.conf.d/local.conf for debian based system)

HTH,
Tim Bowden


Re: Databse installation problem

From
Bhushan Verma
Date:
Hi,thanks for your mail.
I have alredy stopped the database before new installation.
I have tried as you said but I am getting the same version 8.3.1.

As per Tim Bowden said , I have also done these steps but not able to get the 8.3.7 version.

On 9/21/09, Gurjeet Singh <singh.gurjeet@gmail.com> wrote:
This does not belong to pgsql-bugs.

I have a feeling that your previous version of postgres is still running. You should have stopped that daemon before doing 'rm -rf'. attaching/pasting your pgstartup.log would also help.

For now, kill your current postgres processes, and then try to start again.

Best regards,


On Mon, Sep 21, 2009 at 11:23 AM, Bhushan Verma <verma.bhushan@gmail.com> wrote:

I have tried to install postgres version 8.3.7 as follows

rm -rf /var/lib/pgsql
mkdir /var/lib/pgsql
./configure --prefix /var/lib/pgsql
gmake
su
gmake install
adduser postgres
mkdir /var/lib/pgsql/data
chown postgres /var/lib/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /var/lib/pgsql/data
/usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data >pgstartup.log 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

then i log on database to see the version
test=> select version();
                                                version
-------------------------------------------------------------------------------------------------------
 PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.3.0 20080314 (Red Hat 4.3.0-3)
(1 row)
but its showing me 8.3.1 that was my previous version.
Could anyone tell me what is the problem.

--
With Regards,
Bhushan



--
Lets call it Postgres

EnterpriseDB      http://www.enterprisedb.com

gurjeet[.singh]@EnterpriseDB.com

singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com
Twitter: singh_gurjeet
Skype: singh_gurjeet

Mail sent from my BlackLaptop device



--
With Regards,
Bhushan

Re: Databse installation problem

From
Tim Bowden
Date:
On Mon, 2009-09-21 at 11:54 +0530, Bhushan Verma wrote:
> Hi,thanks for your mail.
> I have alredy stopped the database before new installation.
> I have tried as you said but I am getting the same version 8.3.1.
>
> As per Tim Bowden said , I have also done these steps but not able to
> get the 8.3.7 version.
>
> On 9/21/09, Gurjeet Singh <singh.gurjeet@gmail.com> wrote:
>         This does not belong to pgsql-bugs.
>
>         I have a feeling that your previous version of postgres is
>         still running. You should have stopped that daemon before
>         doing 'rm -rf'. attaching/pasting your pgstartup.log would
>         also help.
>
>         For now, kill your current postgres processes, and then try to
>         start again.
>
>         Best regards,
>
>
>         On Mon, Sep 21, 2009 at 11:23 AM, Bhushan Verma
>         <verma.bhushan@gmail.com> wrote:
>
>                 I have tried to install postgres version 8.3.7 as
>                 follows
>
>                 rm -rf /var/lib/pgsql
>                 mkdir /var/lib/pgsql
>                 ./configure --prefix /var/lib/pgsql
>                 gmake
>                 su
>                 gmake install
>                 adduser postgres
>                 mkdir /var/lib/pgsql/data
>                 chown postgres /var/lib/pgsql/data
>                 su - postgres
>                 /usr/local/pgsql/bin/initdb -D /var/lib/pgsql/data
>                 /usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data
>                 >pgstartup.log 2>&1 &
>                 /usr/local/pgsql/bin/createdb test
>                 /usr/local/pgsql/bin/psql test
>
>                 then i log on database to see the version
>                 test=> select version();
>
>                 version
>
-------------------------------------------------------------------------------------------------------
>                  PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled
>                 by GCC gcc (GCC) 4.3.0 20080314 (Red Hat 4.3.0-3)
>                 (1 row)
>                 but its showing me 8.3.1 that was my previous version.
>                 Could anyone tell me what is the problem.
>
>                 --
>                 With Regards,
>                 Bhushan

Ok, actually reading what you did this time, why are you
running /usr/local/pgsql/bin/* when your configure --prefix
is /var/lib/pgsql/?

You're stating the old install not the new install.

HTH,
Tim Bowden



Re: Databse installation problem

From
Bhushan Verma
Date:
Hi, Ok you ar right.
Now I triied as follows:
its showing psql 8.3.7 but server 8.3.1 and query returns 8.3.1

[root@netocean2 pgsql]# /var/lib/pgsql/bin/psql test
Welcome to psql 8.3.7 (server 8.3.1), the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

test=>
test=> select version();
                                                version
-------------------------------------------------------------------------------------------------------
 PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.3.0 20080314 (Red Hat 4.3.0-3)
(1 row)


On 9/21/09, Tim Bowden <tim.bowden@westnet.com.au> wrote:
On Mon, 2009-09-21 at 11:54 +0530, Bhushan Verma wrote:
> Hi,thanks for your mail.
> I have alredy stopped the database before new installation.
> I have tried as you said but I am getting the same version 8.3.1.
>
> As per Tim Bowden said , I have also done these steps but not able to
> get the 8.3.7 version.
>
> On 9/21/09, Gurjeet Singh <singh.gurjeet@gmail.com> wrote:
>         This does not belong to pgsql-bugs.
>
>         I have a feeling that your previous version of postgres is
>         still running. You should have stopped that daemon before
>         doing 'rm -rf'. attaching/pasting your pgstartup.log would
>         also help.
>
>         For now, kill your current postgres processes, and then try to
>         start again.
>
>         Best regards,
>
>
>         On Mon, Sep 21, 2009 at 11:23 AM, Bhushan Verma
>         <verma.bhushan@gmail.com> wrote:
>
>                 I have tried to install postgres version 8.3.7 as
>                 follows
>
>                 rm -rf /var/lib/pgsql
>                 mkdir /var/lib/pgsql
>                 ./configure --prefix /var/lib/pgsql
>                 gmake
>                 su
>                 gmake install
>                 adduser postgres
>                 mkdir /var/lib/pgsql/data
>                 chown postgres /var/lib/pgsql/data
>                 su - postgres
>                 /usr/local/pgsql/bin/initdb -D /var/lib/pgsql/data
>                 /usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data
>                 >pgstartup.log 2>&1 &
>                 /usr/local/pgsql/bin/createdb test
>                 /usr/local/pgsql/bin/psql test
>
>                 then i log on database to see the version
>                 test=> select version();
>
>                 version
>                 -------------------------------------------------------------------------------------------------------
>                  PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled
>                 by GCC gcc (GCC) 4.3.0 20080314 (Red Hat 4.3.0-3)
>                 (1 row)
>                 but its showing me 8.3.1 that was my previous version.
>                 Could anyone tell me what is the problem.
>
>                 --
>                 With Regards,
>                 Bhushan


Ok, actually reading what you did this time, why are you
running /usr/local/pgsql/bin/* when your configure --prefix
is /var/lib/pgsql/?

You're stating the old install not the new install.


HTH,
Tim Bowden



--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice



--
With Regards,
Bhushan

Re: Databse installation problem

From
Tim Bowden
Date:
On Mon, 2009-09-21 at 12:59 +0530, Bhushan Verma wrote:
> Hi, Ok you ar right.
> Now I triied as follows:
> its showing psql 8.3.7 but server 8.3.1 and query returns 8.3.1
>
> [root@netocean2 pgsql]# /var/lib/pgsql/bin/psql test
> Welcome to psql 8.3.7 (server 8.3.1), the PostgreSQL interactive
> terminal.
>
> Type:  \copyright for distribution terms
>        \h for help with SQL commands
>        \? for help with psql commands
>        \g or terminate with semicolon to execute query
>        \q to quit
>
> test=>
> test=> select version();
>                                                 version
> -------------------------------------------------------------------------------------------------------
>  PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled by GCC gcc (GCC)
> 4.3.0 20080314 (Red Hat 4.3.0-3)
> (1 row)
>
>
> On 9/21/09, Tim Bowden <tim.bowden@westnet.com.au> wrote:
>         On Mon, 2009-09-21 at 11:54 +0530, Bhushan Verma wrote:
>         > Hi,thanks for your mail.
>         > I have alredy stopped the database before new installation.
>         > I have tried as you said but I am getting the same version
>         8.3.1.
>         >
>         > As per Tim Bowden said , I have also done these steps but
>         not able to
>         > get the 8.3.7 version.
>         >
>         > On 9/21/09, Gurjeet Singh <singh.gurjeet@gmail.com> wrote:
>         >         This does not belong to pgsql-bugs.
>         >
>         >         I have a feeling that your previous version of
>         postgres is
>         >         still running. You should have stopped that daemon
>         before
>         >         doing 'rm -rf'. attaching/pasting your pgstartup.log
>         would
>         >         also help.
>         >
>         >         For now, kill your current postgres processes, and
>         then try to
>         >         start again.
>         >
>         >         Best regards,
>         >
>         >
>         >         On Mon, Sep 21, 2009 at 11:23 AM, Bhushan Verma
>         >         <verma.bhushan@gmail.com> wrote:
>         >
>         >                 I have tried to install postgres version
>         8.3.7 as
>         >                 follows
>         >
>         >                 rm -rf /var/lib/pgsql
>         >                 mkdir /var/lib/pgsql
>         >                 ./configure --prefix /var/lib/pgsql
>         >                 gmake
>         >                 su
>         >                 gmake install
>         >                 adduser postgres
>         >                 mkdir /var/lib/pgsql/data
>         >                 chown postgres /var/lib/pgsql/data
>         >                 su - postgres
>         >                 /usr/local/pgsql/bin/initdb
>         -D /var/lib/pgsql/data
>         >                 /usr/local/pgsql/bin/postgres
>         -D /var/lib/pgsql/data
>         >                 >pgstartup.log 2>&1 &
>         >                 /usr/local/pgsql/bin/createdb test
>         >                 /usr/local/pgsql/bin/psql test
>         >
>         >                 then i log on database to see the version
>         >                 test=> select version();
>         >
>         >                 version
>         >
>         -------------------------------------------------------------------------------------------------------
>         >                  PostgreSQL 8.3.1 on i386-redhat-linux-gnu,
>         compiled
>         >                 by GCC gcc (GCC) 4.3.0 20080314 (Red Hat
>         4.3.0-3)
>         >                 (1 row)
>         >                 but its showing me 8.3.1 that was my
>         previous version.
>         >                 Could anyone tell me what is the problem.
>         >
>         >                 --
>         >                 With Regards,
>         >                 Bhushan
>
>
>         Ok, actually reading what you did this time, why are you
>         running /usr/local/pgsql/bin/* when your configure --prefix
>         is /var/lib/pgsql/?
>
>         You're stating the old install not the new install.
>
>
>         HTH,
>         Tim Bowden


You seem to be using psql from 8.3.7 but running the 8.3.1 server still.
How *exactly* are you stopping the old server and starting the new one,
and are there any messages in /var/lib/pgsql/data/serverlog?

Tim Bowden

BTW, please don't top post.  It ruins the flow of the conversation and
makes it very difficult to follow.


Re: Databse installation problem

From
Bhushan Verma
Date:
Hi,
I am stopping the server as follows
/etc/init.d/postgres stop

starting the new /etc/init.d/postgres

my pg_log contains as follows logs

LOG:  database system was shut down at 2009-09-21 13:40:53 IST
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections

 
>and are there any messages in /var/lib/pgsql/data/serverlog?
what do you mean by serverlog is this same as pg_log.


On 9/21/09, Tim Bowden <tim.bowden@westnet.com.au> wrote:
On Mon, 2009-09-21 at 12:59 +0530, Bhushan Verma wrote:
> Hi, Ok you ar right.
> Now I triied as follows:
> its showing psql 8.3.7 but server 8.3.1 and query returns 8.3.1
>
> [root@netocean2 pgsql]# /var/lib/pgsql/bin/psql test
> Welcome to psql 8.3.7 (server 8.3.1), the PostgreSQL interactive
> terminal.
>
> Type:  \copyright for distribution terms
>        \h for help with SQL commands
>        \? for help with psql commands
>        \g or terminate with semicolon to execute query
>        \q to quit
>
> test=>
> test=> select version();
>                                                 version
> -------------------------------------------------------------------------------------------------------
>  PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled by GCC gcc (GCC)
> 4.3.0 20080314 (Red Hat 4.3.0-3)
> (1 row)
>
>
> On 9/21/09, Tim Bowden <tim.bowden@westnet.com.au> wrote:
>         On Mon, 2009-09-21 at 11:54 +0530, Bhushan Verma wrote:
>         > Hi,thanks for your mail.
>         > I have alredy stopped the database before new installation.
>         > I have tried as you said but I am getting the same version
>         8.3.1.
>         >
>         > As per Tim Bowden said , I have also done these steps but
>         not able to
>         > get the 8.3.7 version.
>         >
>         > On 9/21/09, Gurjeet Singh <singh.gurjeet@gmail.com> wrote:
>         >         This does not belong to pgsql-bugs.
>         >
>         >         I have a feeling that your previous version of
>         postgres is
>         >         still running. You should have stopped that daemon
>         before
>         >         doing 'rm -rf'. attaching/pasting your pgstartup.log
>         would
>         >         also help.
>         >
>         >         For now, kill your current postgres processes, and
>         then try to
>         >         start again.
>         >
>         >         Best regards,
>         >
>         >
>         >         On Mon, Sep 21, 2009 at 11:23 AM, Bhushan Verma
>         >         <verma.bhushan@gmail.com> wrote:
>         >
>         >                 I have tried to install postgres version
>         8.3.7 as
>         >                 follows
>         >
>         >                 rm -rf /var/lib/pgsql
>         >                 mkdir /var/lib/pgsql
>         >                 ./configure --prefix /var/lib/pgsql
>         >                 gmake
>         >                 su
>         >                 gmake install
>         >                 adduser postgres
>         >                 mkdir /var/lib/pgsql/data
>         >                 chown postgres /var/lib/pgsql/data
>         >                 su - postgres
>         >                 /usr/local/pgsql/bin/initdb
>         -D /var/lib/pgsql/data
>         >                 /usr/local/pgsql/bin/postgres
>         -D /var/lib/pgsql/data
>         >                 >pgstartup.log 2>&1 &
>         >                 /usr/local/pgsql/bin/createdb test
>         >                 /usr/local/pgsql/bin/psql test
>         >
>         >                 then i log on database to see the version
>         >                 test=> select version();
>         >
>         >                 version
>         >
>         -------------------------------------------------------------------------------------------------------
>         >                  PostgreSQL 8.3.1 on i386-redhat-linux-gnu,
>         compiled
>         >                 by GCC gcc (GCC) 4.3.0 20080314 (Red Hat
>         4.3.0-3)
>         >                 (1 row)
>         >                 but its showing me 8.3.1 that was my
>         previous version.
>         >                 Could anyone tell me what is the problem.
>         >
>         >                 --
>         >                 With Regards,
>         >                 Bhushan
>
>
>         Ok, actually reading what you did this time, why are you
>         running /usr/local/pgsql/bin/* when your configure --prefix
>         is /var/lib/pgsql/?
>
>         You're stating the old install not the new install.
>
>
>         HTH,
>         Tim Bowden



You seem to be using psql from 8.3.7 but running the 8.3.1 server still.
How *exactly* are you stopping the old server and starting the new one,
and are there any messages in /var/lib/pgsql/data/serverlog?

Tim Bowden

BTW, please don't top post.  It ruins the flow of the conversation and
makes it very difficult to follow.




--
With Regards,
Bhushan

Re: Databse installation problem

From
Bhushan Verma
Date:
Hi,

I am stopping the server as follows
/etc/init.d/postgres stop

starting the new /etc/init.d/postgres

my pg_log contains as follows logs

LOG:  database system was shut down at 2009-09-21 13:40:53 IST
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections
 
>and are there any messages in /var/lib/pgsql/data/serverlog?
what do you mean by serverlog is this same as pg_log.


You seem to be using psql from 8.3.7 but running the 8.3.1 server still.
How *exactly* are you stopping the old server and starting the new one,
and are there any messages in /var/lib/pgsql/data/serverlog?

Tim Bowden

BTW, please don't top post.  It ruins the flow of the conversation and
makes it very difficult to follow.




--
With Regards,
Bhushan

Re: Databse installation problem

From
Tim Bowden
Date:
On Mon, 2009-09-21 at 13:54 +0530, Bhushan Verma wrote:
> Hi,
>
> I am stopping the server as follows
> /etc/init.d/postgres stop
>
> starting the new /etc/init.d/postgres

Have you edited /etc/init.d/postgres to point prefix at /var/lib/pgsql
(and updated any other settings that need to be changed for the new
server; PGDATA maybe)?  I suspect it is still starting the old
installation in /usr/local/...

>
> my pg_log contains as follows logs
>
> LOG:  database system was shut down at 2009-09-21 13:40:53 IST
> LOG:  autovacuum launcher started
> LOG:  database system is ready to accept connections
>
> >and are there any messages in /var/lib/pgsql/data/serverlog?
> what do you mean by serverlog is this same as pg_log.

serverlog is the default log file for postgresql and is in the data dir
(by default, along with pg_hba.conf, pg_ident.conf, postgresql.conf and
so on; see PGLOG in /etc/init.d/postgresql to find out what is happening
with logs on your installation).  Where did
*your* /etc/init.d/postgresql file come from?

>
>
>                 You seem to be using psql from 8.3.7 but running the
>                 8.3.1 server still.
>                 How *exactly* are you stopping the old server and
>                 starting the new one,
>                 and are there any messages
>                 in /var/lib/pgsql/data/serverlog?
>
>                 Tim Bowden
>
>                 BTW, please don't top post.  It ruins the flow of the
>                 conversation and
>                 makes it very difficult to follow.
>



Tim Bowden




Re: Databse installation problem

From
Bhushan Verma
Date:
Thanks for your quick response.

I have copied this configuration file form my installed postgres 8.3.1

I am pasting this file for your reference .
By the way PGDATA is /var/lib/pgsql/data

Yes there is a log file file pgstartup.log
PGLOG=/var/lib/pgsql/pgstartup.log
its contains only ths startup and shutdown messages.

/etc/init.d/postgres file contents
------------------

# PGVERSION is the full package version, e.g., 8.2.0
# Note: the specfile ordinarily updates this during install
#PGVERSION=8.3.1
PGVERSION=8.3.7
# PGMAJORVERSION is major version, e.g., 8.2 (this should match PG_VERSION)
PGMAJORVERSION=`echo "$PGVERSION" | sed 's/^\([0-9]*\.[0-9]*\).*$/\1/'`

# Source function library.
. /etc/rc.d/init.d/functions

# Get function listing for cross-distribution logic.
TYPESET=`typeset -f|grep "declare"`

# Get config.
. /etc/sysconfig/network

# Find the name of the script
NAME=`basename $0`
if [ ${NAME:0:1} = "S" -o ${NAME:0:1} = "K" ]
then
    NAME=${NAME:3}
fi

# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]
then
    SU=runuser
else
    SU=su
fi


# Set defaults for configuration variables
PGENGINE=/usr/bin
PGPORT=5432
PGDATA=/var/lib/pgsql
if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base/template1" ]
then
    echo "Using old-style directory structure"
else
    PGDATA=/var/lib/pgsql/data
fi
PGLOG=/var/lib/pgsql/pgstartup.log

# Override defaults from /etc/sysconfig/pgsql if file is present
[ -f /etc/sysconfig/pgsql/${NAME} ] && . /etc/sysconfig/pgsql/${NAME}

export PGDATA
export PGPORT

# Check that networking is up.
# Pretty much need it for postmaster.
[ "${NETWORKING}" = "no" ] && exit 1

[ -f "$PGENGINE/postmaster" ] || exit 1

script_result=0

start(){
    PSQL_START=$"Starting ${NAME} service: "

    # Make sure startup-time log file is valid
    if [ ! -e "$PGLOG" -a ! -h "$PGLOG" ]
    then
        touch "$PGLOG" || exit 1
        chown postgres:postgres "$PGLOG"
        chmod go-rwx "$PGLOG"
        [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$PGLOG" 2>/dev/null
    fi

    # Check for the PGDATA structure
    if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ]
    then
    # Check version of existing PGDATA

        if [ x`cat "$PGDATA/PG_VERSION"` != x"$PGMAJORVERSION" ]
        then
            SYSDOCDIR="(Your System's documentation directory)"
            if [ -d "/usr/doc/postgresql-$PGVERSION" ]
            then
                SYSDOCDIR=/usr/doc
            fi
            if [ -d "/usr/share/doc/postgresql-$PGVERSION" ]
            then
                SYSDOCDIR=/usr/share/doc
            fi
            if [ -d "/usr/doc/packages/postgresql-$PGVERSION" ]
            then
                SYSDOCDIR=/usr/doc/packages
            fi
            if [ -d "/usr/share/doc/packages/postgresql-$PGVERSION" ]
            then
                SYSDOCDIR=/usr/share/doc/packages
            fi
            echo
            echo $"An old version of the database format was found."
            echo $"You need to upgrade the data format before using PostgreSQL."
            echo $"See $SYSDOCDIR/postgresql-$PGVERSION/README.rpm-dist for more information."
            exit 1
        fi

    # No existing PGDATA! Warn the user to initdb it.

    else
        echo
                echo "$PGDATA is missing. Use \"service postgresql initdb\" to initialize the cluster first."
        echo_failure
        echo
        exit 1
     fi

    echo -n "$PSQL_START"
    $SU -l postgres -c "$PGENGINE/postmaster -p '$PGPORT' -D '$PGDATA' ${PGOPTS} &" >> "$PGLOG" 2>&1 < /dev/null
    sleep 2
    pid=`pidof -s "$PGENGINE/postmaster"`
    if [ $pid ] && [ -f "$PGDATA/postmaster.pid" ]
    then
        success "$PSQL_START"
        touch /var/lock/subsys/${NAME}
        head -n 1 "$PGDATA/postmaster.pid" > "/var/run/postmaster.${PGPORT}.pid"
        echo
    else
        failure "$PSQL_START"
        echo
        script_result=1
    fi
}

stop(){
    echo -n $"Stopping ${NAME} service: "
    $SU -l postgres -c "$PGENGINE/pg_ctl stop -D '$PGDATA' -s -m fast" > /dev/null 2>&1 < /dev/null
    ret=$?
    if [ $ret -eq 0 ]
    then
        echo_success
    else
        echo_failure
        script_result=1
    fi
    echo
    rm -f "/var/run/postmaster.${PGPORT}.pid"
    rm -f "/var/lock/subsys/${NAME}"
}

restart(){
    stop
    start
}

condrestart(){
    [ -e /var/lock/subsys/${NAME} ] && restart
}

condstop(){
    [ -e /var/lock/subsys/${NAME} ] && stop
}

reload(){
    $SU -l postgres -c "$PGENGINE/pg_ctl reload -D '$PGDATA' -s" > /dev/null 2>&1 < /dev/null
}

initdb(){
    if [ -f "$PGDATA/PG_VERSION" ]
    then
    echo "Data directory is not empty!"
    echo_failure
    script_result=1
    else
    echo -n $"Initializing database: "
    if [ ! -e "$PGDATA" -a ! -h "$PGDATA" ]
    then
        mkdir -p "$PGDATA" || exit 1
        chown postgres:postgres "$PGDATA"
        chmod go-rwx "$PGDATA"
    fi
    # Clean up SELinux tagging for PGDATA
    [ -x /sbin/restorecon ] && /sbin/restorecon "$PGDATA"
    # Initialize the database
    $SU -l postgres -c "$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident sameuser'" >> "$PGLOG" 2>&1 < /dev/null
    # Create directory for postmaster log
    mkdir "$PGDATA/pg_log"
    chown postgres:postgres "$PGDATA/pg_log"
    chmod go-rwx "$PGDATA/pg_log"

    if [ -f "$PGDATA/PG_VERSION" ]
    then
        echo_success
    else
        echo_failure
        script_result=1
    fi
    fi
}

# This script is slightly unusual in that the name of the daemon (postmaster)
# is not the same as the name of the subsystem (postgresql)

# See how we were called.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
    status postmaster
    script_result=$?
    ;;
  restart)
    restart
    ;;
  condrestart)
    condrestart
    ;;
  condstop)
    condstop
    ;;
  reload|force-reload)
    reload
    ;;
  initdb)
    initdb
    ;;
  *)
    echo $"Usage: $0 {start|stop|status|restart|condrestart|condstop|reload|force-reload|initdb}"
    exit 1
esac

exit $script_result


---------------


On 9/21/09, Tim Bowden <tim.bowden@westnet.com.au> wrote:
On Mon, 2009-09-21 at 13:54 +0530, Bhushan Verma wrote:
> Hi,
>
> I am stopping the server as follows
> /etc/init.d/postgres stop
>
> starting the new /etc/init.d/postgres


Have you edited /etc/init.d/postgres to point prefix at /var/lib/pgsql
(and updated any other settings that need to be changed for the new
server; PGDATA maybe)?  I suspect it is still starting the old
installation in /usr/local/...


>
> my pg_log contains as follows logs
>
> LOG:  database system was shut down at 2009-09-21 13:40:53 IST
> LOG:  autovacuum launcher started
> LOG:  database system is ready to accept connections
>
> >and are there any messages in /var/lib/pgsql/data/serverlog?
> what do you mean by serverlog is this same as pg_log.


serverlog is the default log file for postgresql and is in the data dir
(by default, along with pg_hba.conf, pg_ident.conf, postgresql.conf and
so on; see PGLOG in /etc/init.d/postgresql to find out what is happening
with logs on your installation).  Where did
*your* /etc/init.d/postgresql file come from?


>
>
>                 You seem to be using psql from 8.3.7 but running the
>                 8.3.1 server still.
>                 How *exactly* are you stopping the old server and
>                 starting the new one,
>                 and are there any messages
>                 in /var/lib/pgsql/data/serverlog?
>
>                 Tim Bowden
>
>                 BTW, please don't top post.  It ruins the flow of the
>                 conversation and
>                 makes it very difficult to follow.
>




Tim Bowden






--
With Regards,
Bhushan

Re: Databse installation problem

From
Tim Bowden
Date:
On Mon, 2009-09-21 at 15:49 +0530, Bhushan Verma wrote:
> Thanks for your quick response.
>
> I have copied this configuration file form my installed postgres
> 8.3.1
>
> I am pasting this file for your reference .
> By the way PGDATA is /var/lib/pgsql/data
>
> Yes there is a log file file pgstartup.log
> PGLOG=/var/lib/pgsql/pgstartup.log
> its contains only ths startup and shutdown messages.
>
> /etc/init.d/postgres file contents


This config file is not right (Note: PGENGINE=/usr/bin)

Try staring up by hand as per the docs, then try using the startup
script that comes with postgresql instead of your existing script (which
looks to have been modified by whoever packaged the previous version of
postgresql; see postgresql-8.4.1/contrib/start-scripts/linux).  Modify
as needed and try starting again.

Have you checked you can do an upgrade from 8.3.1 - 8.3.7 without a
dump?  Quite possibly, but I'm not sure.


Tim Bowden



Re: Databse installation problem

From
Tim Bowden
Date:
On Mon, 2009-09-21 at 19:14 +0800, Tim Bowden wrote:

> see postgresql-8.4.1/contrib/start-scripts/linux
>

Um, maybe try postgresql-8.3.7 src instead...  Got that path from the
latest postgresql in my src dir :o

Tim Bowden


Re: [BUGS] Databse installation problem

From
tomas@tuxteam.de
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Sep 21, 2009 at 11:23:09AM +0530, Bhushan Verma wrote:
> I have tried to install postgres version 8.3.7 as follows

Definitely not a PostgreSQL bug. Please don't post this to
pgsql-bugs@postgresql.org.

> rm -rf /var/lib/pgsql
> mkdir /var/lib/pgsql
> ./configure --prefix /var/lib/pgsql
> gmake
> su
> gmake install
> adduser postgres
> mkdir /var/lib/pgsql/data
> chown postgres /var/lib/pgsql/data
> su - postgres
> /usr/local/pgsql/bin/initdb -D /var/lib/pgsql/data
> /usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data >pgstartup.log 2>&1 &

And? What does pgstartup.log say?

> /usr/local/pgsql/bin/createdb test
> /usr/local/pgsql/bin/psql test
>
> then i log on database to see the version
> test=> select version();
>                                                 version
> -------------------------------------------------------------------------------------------------------
>  PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.3.0
> 20080314 (Red Hat 4.3.0-3)
> (1 row)
> but its showing me 8.3.1 that was my previous version.
> Could anyone tell me what is the problem.

I'd guess that the distribution's postgres daemon is still there. You
might have forgotten to uninstall it first (the startup log might have a
hint towards this).

Please refer to the Red Hat documentation: it explicitly recommends to
uninstall first the distribution-provided PostgreSQL before installing
from sources.

You may install both in  parallel, but then you have to know what you
are doing.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFKt2tuBcgs9XrR2kYRArcIAJ93bPIUf6TVZwhV+qIkVrdZBs9gQQCfRqp/
i4zON15NGwM4l2Up7X4ajBg=
=VXJz
-----END PGP SIGNATURE-----

Re: Databse installation problem

From
Bhushan Verma
Date:
Hi,
Thanks for your help.
There was  a problem related to server its picking the old server executable ie /usr/bin/postgres
this is returning the version 8.3.1  therefore I am giving my postgres path now its showing correct version.

Who is installed this /usr/bin/postgres executable?

I have one more problem:
I have installed the postgres 8.3.7 on Fedora 9 machine
using  PostgreSQL Installation Instructions.

./configure --prefix /var/lib/pgsql

My question is that everything is fine but its not showing the directory
/usr/include/pgsql that contains the server and headers file etc.
This directoy is required to build any user application using the postgres.

Am I missing something?

One more question is there any RPM available for postgres 8.3.7.
I tried to search on postgres site but its not available for 8.3.7.



On 9/21/09, Tim Bowden <tim.bowden@westnet.com.au> wrote:
On Mon, 2009-09-21 at 19:14 +0800, Tim Bowden wrote:

> see postgresql-8.4.1/contrib/start-scripts/linux
>


Um, maybe try postgresql-8.3.7 src instead...  Got that path from the
latest postgresql in my src dir :o


Tim Bowden


--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice



--
With Regards,
Bhushan

Re: Databse installation problem

From
Tim Bowden
Date:
On Tue, 2009-09-22 at 11:24 +0530, Bhushan Verma wrote:
> Hi,
> Thanks for your help.
> There was  a problem related to server its picking the old server
> executable ie /usr/bin/postgres

Yes, that is what Gurjeet Singh suggested at the beginning and what I've
been trying to help you with.

> this is returning the version 8.3.1  therefore I am giving my postgres
> path now its showing correct version.
>
> Who is installed this /usr/bin/postgres executable?

Who installed it?  No idea.  You would get a much better response if you
asked your sysadmin.  I strongly suspect no one on this list has touched
the machine.

>
> I have one more problem:

I would strongly recommend starting a new thread for a new problem.
Once people have decided a thread is not of interest to them they won't
see your new problem.  You are much more likely to get an answer if you
start a new thread.

> I have installed the postgres 8.3.7 on Fedora 9 machine
> using  PostgreSQL Installation Instructions.
>
> ./configure --prefix /var/lib/pgsql
>
> My question is that everything is fine but its not showing the
> directory
> /usr/include/pgsql that contains the server and headers file etc.
> This directoy is required to build any user application using the
> postgres.
>
> Am I missing something?

Yes.
(see http://tinyurl.com./e6m6)

>
> One more question is there any RPM available for postgres 8.3.7.
> I tried to search on postgres site but its not available for 8.3.7.
>

Probably not. Fedora shiped with PostgreSQL 8.3.1 (as packaged by the
Fedora dev's, which would be the origin of /usr/bin/postgres you found).
If you are going to uninstall 8.3.1 then I would highly recommend using
yum to uninstall the rpm's.  Simply deleting the directory concerned
will leave your packaging system in a broken state such that it may barf
if you try a system upgrade.  Going off your previous posts, I suspect
you may have had two installs of 8.3.1 (one from the Fedora rpm's, and
one compiled from source in /urs/local/pgsql).  I suspect you have been
using the rpm version if you're been starting and stopping it with the
script you supplied earlier.

Once again, I would recommend you don't top post; Even if you don't see
the problem with it, it is not all that uncommon for some old hands to
ignore posts from persistent top posters, and they're the ones most
likely to be able to help.  you'll probably get more leeway for it on a
novice list, but don't expect it.  See
http://www.catb.org/jargon/html/T/top-post.html or
http://mailformat.dan.info/quoting/bottom-posting.html for an
explanation.

While I'm at it, also worth reading is
http://catb.org/~esr/faqs/smart-questions.html and
http://www.chiark.greenend.org.uk/~sgtatham/bugs.html.

Regards,
Tim Bowden


Re: Databse installation problem

From
Bhushan Verma
Date:
Thankyou very much one gain for your support.
>Who installed it?  No idea.  You would get a much better response if you
>asked your sysadmin.  I strongly suspect no one on this list has touched
>the machine.

Thats right I asked you the wrong question.
I was trying to aks is /usr/bin/postgres ships with fedora 9 or it generates during
postgres installation/upgrdation.


Re: [BUGS] Databse installation problem

From
Robert Haas
Date:
On Mon, Sep 21, 2009 at 1:53 AM, Bhushan Verma <verma.bhushan@gmail.com> wrote:
>
> I have tried to install postgres version 8.3.7 as follows
>
> rm -rf /var/lib/pgsql
> mkdir /var/lib/pgsql
> ./configure --prefix /var/lib/pgsql
> gmake
> su
> gmake install
> adduser postgres
> mkdir /var/lib/pgsql/data
> chown postgres /var/lib/pgsql/data
> su - postgres
> /usr/local/pgsql/bin/initdb -D /var/lib/pgsql/data
> /usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data >pgstartup.log 2>&1 &
> /usr/local/pgsql/bin/createdb test
> /usr/local/pgsql/bin/psql test
>
> then i log on database to see the version
> test=> select version();
>                                                 version
> -------------------------------------------------------------------------------------------------------
>  PostgreSQL 8.3.1 on i386-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.3.0
> 20080314 (Red Hat 4.3.0-3)
> (1 row)
> but its showing me 8.3.1 that was my previous version.
> Could anyone tell me what is the problem.

You still have the old version in your PATH variable, and before the
new version.

...Robert