Re: Starting PostgreSQL as an NT Service

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Starting PostgreSQL as an NT Service
Дата
Msg-id 6EE64EF3AB31D5448D0007DD34EEB34101AEA1@Herge.rcsinc.local
обсуждение исходный текст
Ответ на Starting PostgreSQL as an NT Service  ("Hans Oesterholt Dijkema" <hans@strader.xs4all.nl>)
Ответы Re: Starting PostgreSQL as an NT Service  (John Meinel <john@johnmeinel.com>)
Список pgsql-hackers-win32
> I just downloaded the latest binary (as of today). I can get it to
> register with pg_ctl register. I had to create an account for it to
run
> as, since you don't allow a user with admin rights.
>
> If I just do
> pg_ctl register -U postgres
> C:\postgres>net start postgresql
> System error 1069 has occurred.
>
> The service did not start due to a logon failure.
>
> I get this if the password for postgres is empty.
> So I added a password for user postgres ('a'), and tried again:
>
> C:\postgres>pg_ctl unregister -N PostgreSQL
>
> C:\postgres>pg_ctl register -U LILIANA\postgres -P a
>
> C:\postgres>net start postgresql
> The service is not responding to the control function.
>
> More help is available by typing NET HELPMSG 2186.
>
> I can start the service manually using:
>
> C:\postgres>runas /env /user:postgres "pg_ctl start -l logfile"
> Enter the password for postgres:
> Attempting to start pg_ctl start -l logfile as user
"LILIANA\postgres"..
>
> However, this leaves a dos-box running with "postmaster starting". I'm
> pretty sure this is because postmaster is running as a child of cmd.
> Because I can't stop this box, but if I run:
>
> C:\postgres>runas /env /user:postgres "pg_ctl stop"
> Enter the password for postgres:
> Attempting to start pg_ctl stop as user "LILIANA\postgres" ...

There are couple of gotchas:
1. The account that is starting postgresql can not have administrator
privileges.  This is a safety issue...works the same on unix.

2. The account starting postgresql must have 'log on as a service'
privilege.  More about this in a sec.

3. Make sure the postgresql NT user (in your case: 'postgres') has
permissions to the data folder.  Add this user to the folder and make
sure you apply the permissions to the subfolders.  It goes without
saying that the data folder should *not* be shared to the outside world
in any way.

4. Make sure you ran initdb previous to attempting to resister server.

You can omit the -U parameter to pg_ctl and play around with the
accounts with the service directly (select log on as... in service
properties).  It's easier there because you get more detailed error
information and you don't have to keep re-registering the server.

Merlin


В списке pgsql-hackers-win32 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Compile Failue on win32 - pipe.c using ereport
Следующее
От: "Darko Prenosil"
Дата:
Сообщение: Re: Starting PostgreSQL as an NT Service