Re: pg_basebackup for streaming base backups - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: pg_basebackup for streaming base backups
Date
Msg-id AANLkTi=Ocqmpx3M3hN__T47MHhPsndj-1KsmDX6_CN=f@mail.gmail.com
Whole thread Raw
In response to Re: pg_basebackup for streaming base backups  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: pg_basebackup for streaming base backups  (Fujii Masao <masao.fujii@gmail.com>)
Re: pg_basebackup for streaming base backups  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
On Mon, Jan 17, 2011 at 13:38, Peter Eisentraut <peter_e@gmx.net> wrote:
> On lör, 2011-01-15 at 19:10 +0100, Magnus Hagander wrote:
>> This patch creates pg_basebackup in bin/, being a client program for
>> the streaming base backup feature.
>>
>> I think it's more or less done now. I've again split it out of
>> pg_streamrecv, because it had very little shared code with that
>> (basically just the PQconnectdb() wrapper).
>>
>> One thing I'm thinking about - right now the tool just takes -c
>> <conninfo> to connect to the database. Should it instead be taught to
>> take the connection parameters that for example pg_dump does - one for
>> each of host, port, user, password? (shouldn't be hard to do..)
>
> Probably yes, for consistency.  I have been thinking for a while,
> however, that it would be very good if the tools also supported a
> conninfo string, so you don't have to invent a new option for every new
> connection option.  psql already supports that.

libpq has an option to expand a connection string if it's passed in
the database name, it seems. The problem is that this is done on the
dbname parameter - won't work in pg_dump for example, without special
treatment, since the db name is used in the client there.


> Some other comments:
>
> I had trouble at first interpreting the documentation.  In particular,
> where does the data come from, and where does it go to?  -d speaks of
> restoring, but I was just looking for making a backup, not restoring it.
> Needs some clarification, and some complete examples.  Also what happens
> if -c, or -d and -t are omitted.

You get an error. (not with -c anymore)

I'll look at adding some further clarifications to it. Concrete
suggestions from you or others are of course also appreciated :-)


> Downthread you say that this tool is also useful for making base backups
> independent of replication functionality.  Sounds good.  But then the
> documentation says that the connection must be with a user that has the
> replication permission.  Something is conceptually wrong here: why would
> I have to grant replication permission just to take a base backup for
> the purpose of making a backup?

It uses the replication features for it. You also have to set
max_walsenders > 0, which is in the replication section of the
postgresql.conf file.

The point I wanted to make downthread was that it's useful without
having a replication *slave*. But yes, you need the master.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pg_basebackup for streaming base backups
Next
From: Peter Eisentraut
Date:
Subject: Re: psql: Add \dL to show languages