Обсуждение: initdb start server recommendation

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

initdb start server recommendation

От
Bruce Momjian
Дата:
Currently initdb outputs suggested text on starting the server:
Success. You can now start the database server using:    /u/pgsql/bin/postgres -D /u/pgsql/dataor
/u/pgsql/bin/pg_ctl-D /u/pgsql/data -l logfile start
 

I am now thinking pg_ctl should be recommended first.  At the time this
text was written pg_ctl was new.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + Everyone has their own god. +



Re: initdb start server recommendation

От
Robert Haas
Дата:
On Fri, May 1, 2015 at 10:14 AM, Bruce Momjian <bruce@momjian.us> wrote:
> Currently initdb outputs suggested text on starting the server:
>
>         Success. You can now start the database server using:
>
>             /u/pgsql/bin/postgres -D /u/pgsql/data
>         or
>             /u/pgsql/bin/pg_ctl -D /u/pgsql/data -l logfile start
>
> I am now thinking pg_ctl should be recommended first.  At the time this
> text was written pg_ctl was new.

Sure, works for me.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: initdb start server recommendation

От
Euler Taveira
Дата:
On 01-05-2015 11:14, Bruce Momjian wrote:
> Currently initdb outputs suggested text on starting the server:
> 
>     Success. You can now start the database server using:
>     
>         /u/pgsql/bin/postgres -D /u/pgsql/data
>     or
>         /u/pgsql/bin/pg_ctl -D /u/pgsql/data -l logfile start
> 
> I am now thinking pg_ctl should be recommended first.  At the time this
> text was written pg_ctl was new.
> 
+1.

BTW, why are we advocating postgres binary use at all? AFAICS the main
postgres (or postmaster) uses are (i) startup script (which also
advocate for 'pg_ctl -w') and (ii) disaster/debugging purposes. None of
those use cases are intended for general users. Let's make it simple and
drop 'postgres' line.


--   Euler Taveira                   Timbira - http://www.timbira.com.br/  PostgreSQL: Consultoria, Desenvolvimento,
Suporte24x7 e Treinamento
 



Re: initdb start server recommendation

От
Andrew Dunstan
Дата:
On 05/01/2015 10:14 AM, Bruce Momjian wrote:
> Currently initdb outputs suggested text on starting the server:
>
>     Success. You can now start the database server using:
>     
>         /u/pgsql/bin/postgres -D /u/pgsql/data
>     or
>         /u/pgsql/bin/pg_ctl -D /u/pgsql/data -l logfile start
>
> I am now thinking pg_ctl should be recommended first.  At the time this
> text was written pg_ctl was new.
>


Frankly, I would just output the pg_ctl line. Anyone who actually needs 
this message should probably be using pg_ctl anyway.

cheers

andrew



Re: initdb start server recommendation

От
Magnus Hagander
Дата:
<p dir="ltr"><br /> On May 1, 2015 17:09, "Andrew Dunstan" <<a
href="mailto:andrew@dunslane.net">andrew@dunslane.net</a>>wrote:<br /> ><br /> ><br /> > On 05/01/2015
10:14AM, Bruce Momjian wrote:<br /> >><br /> >> Currently initdb outputs suggested text on starting the
server:<br/> >><br /> >>         Success. You can now start the database server using:<br /> >>      
 <br /> >>             /u/pgsql/bin/postgres -D /u/pgsql/data<br /> >>         or<br /> >>          
 /u/pgsql/bin/pg_ctl -D /u/pgsql/data -l logfile start<br /> >><br /> >> I am now thinking pg_ctl should be
recommendedfirst.  At the time this<br /> >> text was written pg_ctl was new.<br /> >><br /> ><br />
><br/> > Frankly, I would just output the pg_ctl line. Anyone who actually needs this message should probably be
usingpg_ctl anyway.<br /> ><br /><p dir="ltr">+1.<p dir="ltr">/Magnus <br /> 

Re: initdb start server recommendation

От
Peter Eisentraut
Дата:
On 5/1/15 10:55 AM, Euler Taveira wrote:
> On 01-05-2015 11:14, Bruce Momjian wrote:
>> Currently initdb outputs suggested text on starting the server:
>>
>>     Success. You can now start the database server using:
>>     
>>         /u/pgsql/bin/postgres -D /u/pgsql/data
>>     or
>>         /u/pgsql/bin/pg_ctl -D /u/pgsql/data -l logfile start
>>
>> I am now thinking pg_ctl should be recommended first.  At the time this
>> text was written pg_ctl was new.
>>
> +1.
> 
> BTW, why are we advocating postgres binary use at all? AFAICS the main
> postgres (or postmaster) uses are (i) startup script (which also
> advocate for 'pg_ctl -w') and (ii) disaster/debugging purposes. None of
> those use cases are intended for general users. Let's make it simple and
> drop 'postgres' line.

1. I like copying and pasting the "postgres" line during development.
That's not a reason to keep it, necessarily.

2. If you're saying, most people shouldn't run postgres directly, then
most people also shouldn't run initdb directly.  This message will
mainly be seen either by developers or testers or tutorial users or
do-it-yourselfers.  In which case knowing the functionality of the
postgres program is valid.

3. It's not clear that pg_ctl is necessarily the best way to start the
server.  With things like systemd, launchd, supervisord that like to
manage the daemons directly, using postgres directly might be the
preferable choice.





Re: initdb start server recommendation

От
Bruce Momjian
Дата:
On Tue, May  5, 2015 at 03:36:07PM -0400, Peter Eisentraut wrote:
> > BTW, why are we advocating postgres binary use at all? AFAICS the main
> > postgres (or postmaster) uses are (i) startup script (which also
> > advocate for 'pg_ctl -w') and (ii) disaster/debugging purposes. None of
> > those use cases are intended for general users. Let's make it simple and
> > drop 'postgres' line.
> 
> 1. I like copying and pasting the "postgres" line during development.
> That's not a reason to keep it, necessarily.
> 
> 2. If you're saying, most people shouldn't run postgres directly, then
> most people also shouldn't run initdb directly.  This message will
> mainly be seen either by developers or testers or tutorial users or
> do-it-yourselfers.  In which case knowing the functionality of the
> postgres program is valid.
> 
> 3. It's not clear that pg_ctl is necessarily the best way to start the
> server.  With things like systemd, launchd, supervisord that like to
> manage the daemons directly, using postgres directly might be the
> preferable choice.

Well, my initial suggestion was just to recommend pg_ctl first, rather
than remove the postgres binary line, so I assume you are fine with
doing that.

I think we should be looking at who is running initdb manually, then
decide what is the best recommendation.  While developers or testers are
certainly running initdb directly, I think our largest group of
initdb-directly users are those installing multiple clusters on a single
server.  

Frankly, I am not sure how they are starting the server as the
/etc/init.d startup files don't handle multiple clusters well, and I
have never seen instructions on how multi-cluster users are supposed to
set things up.  I assume they are copying the existing init.d file with
a new name and modifying PGDATA and maybe the port number, then doing
'service ... start' or something like that.  I doubt we want initdb to
recommend that.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + Everyone has their own god. +



Re: initdb start server recommendation

От
Andrew Dunstan
Дата:
On 05/07/2015 09:58 AM, Bruce Momjian wrote:

>    
>
> Frankly, I am not sure how they are starting the server as the
> /etc/init.d startup files don't handle multiple clusters well, and I
> have never seen instructions on how multi-cluster users are supposed to
> set things up.  I assume they are copying the existing init.d file with
> a new name and modifying PGDATA and maybe the port number, then doing
> 'service ... start' or something like that.  I doubt we want initdb to
> recommend that.
>


Then you haven't been paying attention, and no, that's not the right way 
to do it. The PGDG RPMs, for example, support multi-tenancy very easily, 
both for systems that use init scripts and those using systemd.  I have 
blogged about how to do this here: 

<http://web.archive.org/web/20111127175231/http://people.planetpostgresql.org/andrew/index.php?/archives/233-Multi-tenancy-under-systemd.html>

and here 

<http://web.archive.org/web/20111221072621/http://people.planetpostgresql.org/andrew/index.php?/archives/134-Multi-tenancy-done-right.html>


But in any case, it's largely irrelevant, ISTM. Anybody who actually 
needs that message from initdb should almost be using pg_ctl instead of 
calling postgres direct.

cheers

andrew



Re: initdb start server recommendation

От
Bruce Momjian
Дата:
On Thu, May  7, 2015 at 10:17:18AM -0400, Andrew Dunstan wrote:
> 
> On 05/07/2015 09:58 AM, Bruce Momjian wrote:
> 
> >
> >Frankly, I am not sure how they are starting the server as the
> >/etc/init.d startup files don't handle multiple clusters well, and I
> >have never seen instructions on how multi-cluster users are supposed to
> >set things up.  I assume they are copying the existing init.d file with
> >a new name and modifying PGDATA and maybe the port number, then doing
> >'service ... start' or something like that.  I doubt we want initdb to
> >recommend that.
> >
> 
> 
> Then you haven't been paying attention, and no, that's not the right
> way to do it. The PGDG RPMs, for example, support multi-tenancy very
> easily, both for systems that use init scripts and those using
> systemd.  I have blogged about how to do this here:
<http://web.archive.org/web/20111127175231/http://people.planetpostgresql.org/andrew/index.php?/archives/233-Multi-tenancy-under-systemd.html>
> and here
<http://web.archive.org/web/20111221072621/http://people.planetpostgresql.org/andrew/index.php?/archives/134-Multi-tenancy-done-right.html>

Uh, those posts are 5 years old and you had to get them from the Wayback
machine --- I think you made my point.  :-)

> But in any case, it's largely irrelevant, ISTM. Anybody who actually
> needs that message from initdb should almost be using pg_ctl instead
> of calling postgres direct.

Agreed.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + Everyone has their own god. +



Re: initdb start server recommendation

От
Euler Taveira
Дата:
On 05-05-2015 16:36, Peter Eisentraut wrote:
> 1. I like copying and pasting the "postgres" line during development.
> That's not a reason to keep it, necessarily.
> 
I prefer pg_ctl because of symmetry (start, stop, restart, reload and
even init).

> 2. If you're saying, most people shouldn't run postgres directly, then
> most people also shouldn't run initdb directly.  This message will
> mainly be seen either by developers or testers or tutorial users or
> do-it-yourselfers.  In which case knowing the functionality of the
> postgres program is valid.
> 
I'm not saying to discourage postgres binary use. It has its merit and
utility. However, the information after initdb is for general users and
not developers/testers (because the latter know how to start the
service) -- that's my impression.

We have an utility that concentrate all of the necessary modes (even
init) to operate postgres service. Why not advocate it for general
users? pg_ctl sounds more natural for postgres administration. How do
you explain that you have to start the service with 'postgres' but stop
it with 'pg_ctl' ou even 'kill'?

> 3. It's not clear that pg_ctl is necessarily the best way to start the
> server.  With things like systemd, launchd, supervisord that like to
> manage the daemons directly, using postgres directly might be the
> preferable choice.
> 
Agree. However, I'm saying that _general users_ (those that don't use OS
init interface) tend to prefer 'pg_ctl' to 'postgres'.


--   Euler Taveira                   Timbira - http://www.timbira.com.br/  PostgreSQL: Consultoria, Desenvolvimento,
Suporte24x7 e Treinamento
 



Re: initdb start server recommendation

От
Bruce Momjian
Дата:
On Fri, May  1, 2015 at 10:14:13AM -0400, Bruce Momjian wrote:
> Currently initdb outputs suggested text on starting the server:
> 
>     Success. You can now start the database server using:
>     
>         /u/pgsql/bin/postgres -D /u/pgsql/data
>     or
>         /u/pgsql/bin/pg_ctl -D /u/pgsql/data -l logfile start
> 
> I am now thinking pg_ctl should be recommended first.  At the time this
> text was written pg_ctl was new.

I have applied a patch to initdb to only recommend the pg_ctl method.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + Everyone has their own god. +