Обсуждение: Postgres: Packaging & Server Startup

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

Postgres: Packaging & Server Startup

От
CM J
Дата:
Hi,

    I am working on packaging postgres database in our java based application.I downloaded postgresql-8.2.12-1-binaries-no-installer.zip from  the postgres site and installed it on a windows 2003 machine using administrator account.I later created a postgres service login account and changed the permissions on the postgres directory to include this user too.

    When logged in as administrator , i tried starting the server using the following cmd:

pg_ctl.exe -U postgres -P <mypasswd>  -w start -D D:\pgsql\data

        However, i get the following error message:

waiting for server to start...FATAL:  postgres: could not locate matching postgres executable

         I also tried the starting the server using runas :

runas /user:postgres "pg_ctl.exe -wait start -D D:\pgsql\data"

         The above too failed.Please let me know on what i am missing here.

Thanks.

Re: Postgres: Packaging & Server Startup

От
Richard Huxton
Дата:
CM J wrote:
> pg_ctl.exe -U postgres -P <mypasswd>  -w start -D D:\pgsql\data
>
>         However, i get the following error message:
>
> waiting for server to start...FATAL:  postgres: could not locate matching
> postgres executable

That does seem to suggest it found the executable but it didn't match
versions with the data directory. Do you have two copies installed? If
so, you'll probably want to specify the complete path to pg_ctl

--
  Richard Huxton
  Archonet Ltd

Re: Postgres: Packaging & Server Startup

От
CM J
Дата:
Hi,

      I don't have multiple postgres installed.Anyway, tried your suggestion to use the full path name and here is what i get:

D:\pgsql\bin>D:\pgsql\bin\pg_
ctl.exe -U postgres -P <mypasswd> -w start -D:\pgsql\data

pg_ctl: could not open PID file ":/pgsql/data/postmaster.pid": Invalid argument

       There is no data directory created by default (i used no-installer-zip file to install postgres), so i went ahead and created a dummy data directory which gave the same result as above. Any suggestions ??

Thanks.


On Tue, Mar 31, 2009 at 4:09 PM, Richard Huxton <dev@archonet.com> wrote:
CM J wrote:
> pg_ctl.exe -U postgres -P <mypasswd>  -w start -D D:\pgsql\data
>
>         However, i get the following error message:
>
> waiting for server to start...FATAL:  postgres: could not locate matching
> postgres executable

That does seem to suggest it found the executable but it didn't match
versions with the data directory. Do you have two copies installed? If
so, you'll probably want to specify the complete path to pg_ctl

--
 Richard Huxton
 Archonet Ltd

Re: Postgres: Packaging & Server Startup

От
CM J
Дата:
Hi,

       Please ignore my previous mail. I had given data directory location incorrectly.Anyways,even after giving the absolute path for exe location, i get the same error message as before:

D:\pgsql\bin\pg_ctl.exe -U postgres -P <mypasswd>  -w start -D D:\pgsql\data

waiting for server to start...FATAL:  postgres: could not locate matching postgres executable

Thanks !

On Tue, Mar 31, 2009 at 4:31 PM, CM J <postgres.newbie@gmail.com> wrote:
Hi,

      I don't have multiple postgres installed.Anyway, tried your suggestion to use the full path name and here is what i get:

D:\pgsql\bin>D:\pgsql\bin\pg_
ctl.exe -U postgres -P <mypasswd> -w start -D:\pgsql\data

pg_ctl: could not open PID file ":/pgsql/data/postmaster.pid": Invalid argument

       There is no data directory created by default (i used no-installer-zip file to install postgres), so i went ahead and created a dummy data directory which gave the same result as above. Any suggestions ??

Thanks.


On Tue, Mar 31, 2009 at 4:09 PM, Richard Huxton <dev@archonet.com> wrote:
CM J wrote:
> pg_ctl.exe -U postgres -P <mypasswd>  -w start -D D:\pgsql\data
>
>         However, i get the following error message:
>
> waiting for server to start...FATAL:  postgres: could not locate matching
> postgres executable

That does seem to suggest it found the executable but it didn't match
versions with the data directory. Do you have two copies installed? If
so, you'll probably want to specify the complete path to pg_ctl

--
 Richard Huxton
 Archonet Ltd


Re: Postgres: Packaging & Server Startup

От
Richard Huxton
Дата:
CM J wrote:
> Hi,
>
> I don't have multiple postgres installed.

Hmm. OK.

> Anyway, tried your suggestion
> to use the full path name and here is what i get:
>
> D:\pgsql\bin>D:\pgsql\bin\pg_ctl.exe -U postgres -P <mypasswd> -w start
> -D:\pgsql\data

You've got a typo here - the "-D" has run into "D:\..."

> pg_ctl: could not open PID file ":/pgsql/data/postmaster.pid": Invalid
> argument
>
>        There is no data directory created by default (i used
> no-installer-zip file to install postgres), so i went ahead and created a
> dummy data directory which gave the same result as above. Any suggestions ??

It's probably worth checking the permissions on that directory, but I
don't think it's the problem here. You have run "initdb" on that
directory though, haven't you? If not, do that before worrying about the
rest of this email.

>>> pg_ctl.exe -U postgres -P <mypasswd>  -w start -D D:\pgsql\data
>>>
>>>         However, i get the following error message:
>>>
>>> waiting for server to start...FATAL:  postgres: could not locate matching
>>> postgres executable

Reading the error message and searching the source-code for it (always
worth having a copy of the source, even if you don't read "C") I found
that the error message isn't being produced by pg_ctl. It's being
produced by "postgres" - the backend itself.

It's checking that it's version number matches the version number
reported by running /path/to/my/dir/postgres.exe -V (grab the source and
have a look in port/exec.c at about line 395).

Now, that means one of three things:
1. It can't reach the "current directory" (permissions)
2. It can't run postgres (permissions)
3. The version-string is incorrect.

I don't see how #2 is possible (pg_ctl has started postgres.exe fine) so
that leaves #1 or #3. The third is easy to check run "postgres.exe -V"
yourself and see what it says.

--
  Richard Huxton
  Archonet Ltd

Re: Postgres: Packaging & Server Startup

От
Raymond O'Donnell
Дата:
On 31/03/2009 12:14, CM J wrote:

> D:\pgsql\bin\pg_ctl.exe -U postgres -P <mypasswd>  -w start -D D:\pgsql\data

I wonder if that -P is causing trouble? According to the output of
--help, there's no -P option with a START operation; however, -p is used
to specify the path to the postgres binaries.

Just a stab in the dark.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

Re: Postgres: Packaging & Server Startup

От
CM J
Дата:
Hi,

       I did not run the initdb.exe and thats why i could not start the server.Here is what i did:

1. Executed initdb.exe as follows:

runas /user:postgres "D:\pgsql\bin\initdb.exe -D:\pgsql\data"

2.Started the server by executing the following cmd:

runas /user:postgres "D:\pgsql\bin\pg_ctl.exe   -w start -D D:\pgsql\data"

and it started fine.Thanks  to Richard and Ray !

On Tue, Mar 31, 2009 at 6:13 PM, Raymond O'Donnell <rod@iol.ie> wrote:
On 31/03/2009 12:14, CM J wrote:

> D:\pgsql\bin\pg_ctl.exe -U postgres -P <mypasswd>  -w start -D D:\pgsql\data

I wonder if that -P is causing trouble? According to the output of
--help, there's no -P option with a START operation; however, -p is used
to specify the path to the postgres binaries.

Just a stab in the dark.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------