Re: Duda con Barman

2018-02-06 Thread Daymel Bonne
El 6 de febrero de 2018, 20:07, Alberto Cardenas Cardenas<
alberto.cardenas.c...@gmail.com> escribió:

> Gracias por la respuesta me quedo muy claro, pero ahora tengo otra duda, y
> es con los respaldos incrementales.
>
> Mi configuracion de barman es la siguiente: ejemplo servidor se llama
> esclavo2 , es un servidor esclavo replicado.
>
> [esclavo2]
>
> description =  "Servidor Esclavo PostgreSQL server"
> conninfo = host=esclavo2 user=barman dbname=postgres
> streaming_conninfo = host=esclavo2 user=streaming_barman
>
> backup_method = rsync
> reuse_backup = link
> backup_options = concurrent_backup
>
> streaming_backup_name = barman_streaming_backup
> streaming_archiver = on
> slot_name = barman
> streaming_archiver_name = barman_receive_wal
>
>
> ;streaming_archiver_batch_size = 50
> ; PATH setting for this server
> path_prefix = "/usr/pgsql-9.6/bin"
>
> retention_policy_mode = auto
> retention_policy = RECOVERY WINDOW OF 1 days
> wal_retention_policy = main
>
> ssh_command = ssh postgres@esclavo2
> archiver = on
> parallel_jobs = 1
>
>
>
> Este es el resultado del barman check
>
> esclavo2:
> PostgreSQL: OK
> is_superuser: OK
> PostgreSQL streaming: OK
> wal_level: OK
> replication slot: OK
> directories: OK
> retention policy settings: OK
> backup maximum age: OK (interval provided: 1 day, latest backup
> age: 1 minute, 30 seconds)
> compression settings: OK
> failed backups: OK (there are 0 failed backups)
> minimum redundancy requirements: OK (have 65 backups, expected at
> least 0)
> ssh: OK (PostgreSQL server)
> archive_mode: OK
> archive_command: OK
> continuous archiving: OK
> pg_receivexlog: OK
> pg_receivexlog compatible: OK
> receive-wal running: OK
> archiver errors: OK
>
>
>
> En el cron tengo la siguiente tarea:
>
> */5 * * * * barman backup --reuse-backup=link esclavo2
>
>
> Este fue el backpu full inicial
>
> esclavo2 20180206T083014 - Tue Feb  6 08:30:21 2018 - Size: 130.3 MiB -
> WAL Size: 102.4 MiB (tablespaces: tbs_indices:/var/lib/pgsql/9.
> 6/data/indices)
>
> Estos son backup Incrementales (supuestamente)
>
> esclavo2 20180206T165503 - Tue Feb  6 16:55:16 2018 - Size: 2.2 GiB - WAL
> Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
> esclavo2 20180206T133503 - Tue Feb  6 13:35:08 2018 - Size: 2.2 GiB - WAL
> Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
> esclavo2 20180206T133002 - Tue Feb  6 13:30:08 2018 - Size: 2.2 GiB - WAL
> Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
> esclavo2 20180206T132502 - Tue Feb  6 13:25:08 2018 - Size: 2.2 GiB - WAL
> Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
> esclavo2 20180206T132002 - Tue Feb  6 13:20:08 2018 - Size: 2.2 GiB - WAL
> Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
> esclavo2 20180206T131503 - Tue Feb  6 13:15:09 2018 - Size: 2.2 GiB - WAL
> Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
>
>
> Esta es la informacion del ultimo bachup
>
> barman show-backup esclavo2  20180206T165503
> Backup 20180206T165503:
>   Server Name: esclavo2
>   Status : DONE
>   PostgreSQL Version : 90606
>   PGDATA directory   : /var/lib/pgsql/9.6/data
>   Tablespaces:
> tbs_indices: /var/lib/pgsql/9.6/data/indices (oid: 86015)
>
>   Base backup information:
> Disk usage   : 2.2 GiB (2.2 GiB with WALs)
> Incremental size : 135.1 KiB (-99.99%)
> Timeline : 3
> Begin WAL: 00030001003B
> End WAL  : 00030001003B
> WAL number   : 0
> Begin time   : 2018-02-06 16:55:03.947275-08:00
> End time : 2018-02-06 16:55:16.688294-08:00
> Copy time: 2 seconds + 9 seconds startup
> Estimated throughput : 55.6 KiB/s
> Begin Offset : 40
> End Offset   : 152
> Begin LSN   : 1/3B28
> End LSN : 1/3B98
>
>   WAL information:
> No of files  : 0
> Disk usage   : 0 B
> Last available   : None
>
>   Catalog information:
> Retention Policy : VALID
> Previous Backup  : 20180206T133503
> Next Backup  : - (this is the latest base backup)
>
>
>
>
> Lo que no entiendo de todo esto es, porque todos los respaldos
> incrementales pesas 2.2 GB, pesan , si tengo u respaldo full , se supone
> que los incrementales son solo la diferencia del full, o estoy equivocado
>

Por la opción reuse_backup = link, barman reutiliza los ficheros del
respaldo respaldo anterior para hacer los incrementales, y utiliza la
funcionalidad de enlaces duros en linux [1].

El concepto principal es que una copia de seguridad base POSTERIOR
compartirá los archivos que no han cambiados desde la copia de seguridad
ANTERIOR 

Re: Duda con Barman

2018-02-06 Thread Alberto Cardenas Cardenas
Gracias por la respuesta me quedo muy claro, pero ahora tengo otra duda, y
es con los respaldos incrementales.

Mi configuracion de barman es la siguiente: ejemplo servidor se llama
esclavo2 , es un servidor esclavo replicado.

[esclavo2]

description =  "Servidor Esclavo PostgreSQL server"
conninfo = host=esclavo2 user=barman dbname=postgres
streaming_conninfo = host=esclavo2 user=streaming_barman

backup_method = rsync
reuse_backup = link
backup_options = concurrent_backup

streaming_backup_name = barman_streaming_backup
streaming_archiver = on
slot_name = barman
streaming_archiver_name = barman_receive_wal


;streaming_archiver_batch_size = 50
; PATH setting for this server
path_prefix = "/usr/pgsql-9.6/bin"

retention_policy_mode = auto
retention_policy = RECOVERY WINDOW OF 1 days
wal_retention_policy = main

ssh_command = ssh postgres@esclavo2
archiver = on
parallel_jobs = 1



Este es el resultado del barman check

esclavo2:
PostgreSQL: OK
is_superuser: OK
PostgreSQL streaming: OK
wal_level: OK
replication slot: OK
directories: OK
retention policy settings: OK
backup maximum age: OK (interval provided: 1 day, latest backup
age: 1 minute, 30 seconds)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: OK (have 65 backups, expected at
least 0)
ssh: OK (PostgreSQL server)
archive_mode: OK
archive_command: OK
continuous archiving: OK
pg_receivexlog: OK
pg_receivexlog compatible: OK
receive-wal running: OK
archiver errors: OK



En el cron tengo la siguiente tarea:

*/5 * * * * barman backup --reuse-backup=link esclavo2


Este fue el backpu full inicial

esclavo2 20180206T083014 - Tue Feb  6 08:30:21 2018 - Size: 130.3 MiB - WAL
Size: 102.4 MiB (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)

Estos son backup Incrementales (supuestamente)

esclavo2 20180206T165503 - Tue Feb  6 16:55:16 2018 - Size: 2.2 GiB - WAL
Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
esclavo2 20180206T133503 - Tue Feb  6 13:35:08 2018 - Size: 2.2 GiB - WAL
Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
esclavo2 20180206T133002 - Tue Feb  6 13:30:08 2018 - Size: 2.2 GiB - WAL
Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
esclavo2 20180206T132502 - Tue Feb  6 13:25:08 2018 - Size: 2.2 GiB - WAL
Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
esclavo2 20180206T132002 - Tue Feb  6 13:20:08 2018 - Size: 2.2 GiB - WAL
Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)
esclavo2 20180206T131503 - Tue Feb  6 13:15:09 2018 - Size: 2.2 GiB - WAL
Size: 0 B (tablespaces: tbs_indices:/var/lib/pgsql/9.6/data/indices)


Esta es la informacion del ultimo bachup

barman show-backup esclavo2  20180206T165503
Backup 20180206T165503:
  Server Name: esclavo2
  Status : DONE
  PostgreSQL Version : 90606
  PGDATA directory   : /var/lib/pgsql/9.6/data
  Tablespaces:
tbs_indices: /var/lib/pgsql/9.6/data/indices (oid: 86015)

  Base backup information:
Disk usage   : 2.2 GiB (2.2 GiB with WALs)
Incremental size : 135.1 KiB (-99.99%)
Timeline : 3
Begin WAL: 00030001003B
End WAL  : 00030001003B
WAL number   : 0
Begin time   : 2018-02-06 16:55:03.947275-08:00
End time : 2018-02-06 16:55:16.688294-08:00
Copy time: 2 seconds + 9 seconds startup
Estimated throughput : 55.6 KiB/s
Begin Offset : 40
End Offset   : 152
Begin LSN   : 1/3B28
End LSN : 1/3B98

  WAL information:
No of files  : 0
Disk usage   : 0 B
Last available   : None

  Catalog information:
Retention Policy : VALID
Previous Backup  : 20180206T133503
Next Backup  : - (this is the latest base backup)




Lo que no entiendo de todo esto es, porque todos los respaldos
incrementales pesas 2.2 GB, pesan , si tengo u respaldo full , se supone
que los incrementales son solo la diferencia del full, o estoy equivocado


Saludos cordiales

El 6 de febrero de 2018, 6:49, Martin Marques <
martin.marq...@2ndquadrant.com> escribió:

> El 05/02/18 a las 22:22, Alberto Cardenas Cardenas escribió:
> > Hola lista, tengo una duda he leído la documentación de Barman, pero sin
> > embargo no se como poder restaurar archivos respaldados anteriores a
> > cierta ventana de tiempo (retention_policy), me explico.
>
> Todo lo que sacas del servidor de barman (lo que esta fuera de la
> ventana que configuraste para retener respaldos) barman no tiene forma
> de de saber donde está o como usar dichos archivos. Para barman esos
> archivos ya no están (aunque si están en otro lugar).
>
> Queda en vos copiar