pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daulat Ram <Daulat.Ram@exponential.com>
To: Andreas Kretschmer <andreas@a-kretschmer.de>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: RE: Postgres Point in time Recovery (PITR),
Date: Mon, 11 Nov 2019 10:08:00 +0000
Message-ID: <MN2PR01MB5854BF1B0CFEEF44CE0130AC9B740@MN2PR01MB5854.prod.exchangelabs.com> (raw)
In-Reply-To: <40EDA313-B337-4C07-8D2E-38CE75D19BFB@a-kretschmer.de>
References: <MN2PR01MB5854BEF9884EA942657A18799B6C0@MN2PR01MB5854.prod.exchangelabs.com>
	<40EDA313-B337-4C07-8D2E-38CE75D19BFB@a-kretschmer.de>

Hello, 

I am trying to setup barman for my  test environment with the following steps but I m not able to start the backup. Please advice !

Postgres 11.2 streaming replication on docker container , Centos
Server A : pg1 (primary)
Server B : pg2 (Standby)

I am using pg2 as a Barman server.  Barman 2.8 is installed on pg2
Also I have installed " yum install barman-cli-2.8-1.el6.noarch.rpm"  on pg1 (postgres server) for 'barman-wal-archive.

@pg1 

1 . Connect on the server pgsql and log into the postgres account:
	sudo -i -u postgres
2 . createuser --interactive -P barman
3 . createuser  barman
4 . Edit postgresql.conf , for 
listen_addresses = '*'   and sudo service postgresql restart
wal_level = replica
archive_mode = on               
archive_command = 'barman-wal-archive pg2 pgsql %p'
5. host    all             all             pg2/32         trust


@pg2 (Barman Server)
1 .  switch to user barman and generate the keys:	ssh-keygen -t rsa
2 . Copy the key to the user account postgres on pgsql: 	ssh-copy-id postgres@pg1
3 . Barman also requires access to the postgres account on the server pg2. Copy the key into the directory of the postgres user and test the connection:

ssh-copy-id postgres@localhost
ssh postgres@localhost -C true

4 . Once this is done, log in as postgres user on pg1and generate an SSH key: ssh-keygen -t rsa

5 . Copy the generated key to the list of authorized keys of the user barman on pg2: ssh-copy-id barman@pg2

6 . Test the connection to the server: 

@barmaner server /etc/barman.d/pgsql.conf

[test]
; Human readable description
description =  "Example of PostgreSQL Database (via SSH)"

ssh_command = ssh postgres@pg1
conninfo = host=pg1 user=barman dbname=postgres
backup_method = rsync
;reuse_backup = link
; Identify the standard behavior for backup operations: possible values are
; exclusive_backup (default), concurrent_backup
; concurrent_backup is the preferred method with PostgreSQL >= 9.6
backup_options = exclusive_backup

; Number of parallel workers to perform file copy during backup and recover
;parallel_jobs = 1
archiver = on
;archiver_batch_size = 50

barman@vipostgres-db-test:/etc/barman.d$ barman check pgsql
WARNING: No backup strategy set for server 'pgsql' (using default 'exclusive_backup').
WARNING: The default backup strategy will change to 'concurrent_backup' in the future. Explicitly set 'backup_options' to silence this warning.
Server pgsql:
        WAL archive: FAILED (please make sure WAL shipping is setup)
        PostgreSQL: FAILED
        directories: OK
        retention policy settings: OK
        backup maximum age: OK (no last_backup_maximum_age provided)
        compression settings: OK
        failed backups: OK (there are 0 failed backups)
        minimum redundancy requirements: OK (have 0 backups, expected at least 0)
        ssh: FAILED (Connection failed using 'ssh postgres@vipostgres-cn-test -o BatchMode=yes -o StrictHostKeyChecking=no' return code 255)
        not in recovery: OK
        pg_receivexlog: FAILED
        pg_receivexlog compatible: FAILED (PostgreSQL version: None, pg_receivexlog version: None)
        receive-wal running: FAILED (See the Barman log file for more details)
        archiver errors: OK

NOte: If I try to login mannulay on postgres from barman then it is aking for password :

 ssh postgres@pg1
Failed to add the host to the list of known hosts (/tmp/.ssh/known_hosts).
========================== Authorized Access Notice ==================================================
This computer system is the property of Exponential Interactive Inc. Activities are actively monitored
and unauthorized access or use of this computer system is prohibited.
======================================================================================================
Password:


Thanks,


-----Original Message-----
From: Andreas Kretschmer <andreas@a-kretschmer.de> 
Sent: Friday, October 18, 2019 12:38 PM
To: pgsql-general@lists.postgresql.org; Daulat Ram <Daulat.Ram@exponential.com>; pgsql-general@lists.postgresql.org
Subject: Re: Postgres Point in time Recovery (PITR),

On 18 October 2019 07:59:21 CEST, Daulat Ram <Daulat.Ram@exponential.com> wrote:
>Hello All,
>Can you please share some ideas and scenarios how we can do the PITR in 
>case of disaster.
>
>
>Thanks,


Consider Barman.


--
2ndQuadrant - The PostgreSQL Support Company


Attachments:

barman_log.txt (text/plain, 1.4K) download 2019-11-11 02:05:02,204 [10832] barman.wal_archiver INFO: No xlog segments found from file archival for pgsql. 2019-11-11 02:05:02,204 [10833] barman.postgres WARNING: Error retrieving PostgreSQL status: could not connect to server: Connection refused 2019-11-11 02:05:02,205 [10832] barman.wal_archiver INFO: No xlog segments found from streaming for pgsql. 2019-11-11 02:05:02,205 [10833] barman.server ERROR: ArchiverFailure:failed opening the PostgreSQL streaming connection for server pgsql 2019-11-11 02:05:02,206 [10834] barman.wal_archiver INFO: No xlog segments found from file archival for test. 2019-11-11 02:06:01,292 [10847] barman.backup_executor WARNING: No backup strategy set for server 'pgsql' (using default 'exclusive_backup'). 2019-11-11 02:06:01,293 [10847] barman.backup_executor WARNING: The default backup strategy will change to 'concurrent_backup' in the future. Explicitly set 'backup_options' to silence this warning. 2019-11-11 02:06:01,508 [10852] barman.backup_executor WARNING: No backup strategy set for server 'pgsql' (using default 'exclusive_backup'). 2019-11-11 02:06:01,509 [10851] barman.backup_executor WARNING: No backup strategy set for server 'pgsql' (using default 'exclusive_backup'). 2019-11-11 02:06:01,510 [10852] barman.backup_executor WARNING: The default backup strategy will change to 'concurrent_backup' in the future. Explicitly set 'backup_options' to silence this

view thread (21+ messages)

Message-ID: <MN2PR01MB5854BF1B0CFEEF44CE0130AC9B740@MN2PR01MB5854.prod.exchangelabs.com>
Permalink:  ../MN2PR01MB5854BF1B0CFEEF44CE0130AC9B740@MN2PR01MB5854.prod.exchangelabs.com/
Also on:    postgresql.org/message-id/MN2PR01MB5854BF1B0CFEEF44CE0130AC9B740@MN2PR01MB5854.prod.exchangelabs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: Daulat.Ram@exponential.com, andreas@a-kretschmer.de
  Subject: Re: Postgres Point in time Recovery (PITR),
  In-Reply-To: <MN2PR01MB5854BF1B0CFEEF44CE0130AC9B740@MN2PR01MB5854.prod.exchangelabs.com>
  References: <MN2PR01MB5854BEF9884EA942657A18799B6C0@MN2PR01MB5854.prod.exchangelabs.com> <40EDA313-B337-4C07-8D2E-38CE75D19BFB@a-kretschmer.de> <MN2PR01MB5854BF1B0CFEEF44CE0130AC9B740@MN2PR01MB5854.prod.exchangelabs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox