Histórico da Página
...
Nesta página são demonstrados os passos com duas máquinas diferentes, uma contendo a instalação padrão do PostgreSQL para seu ambiente e outra contendo a configuração do Barman. Note que nos comandos de exemplo, estas são referidas como vm-postgresql01 e vm-barman, respectivamente.
No servidor PostgreSQL
Altere o arquivo /etc/hosts e inclua o servidor do Barman:
...
Bloco de código |
---|
systemctl restart postgresql-12.service |
...
No servidor Barman
Altere o arquivo /etc/hosts e inclua o servidor vmpostgresql:
...
Realize a cópia do arquivo: streaming-server.conf-template, para acesso ao servidor do postgresql:
Bloco de código | ||
---|---|---|
| ||
cp streaming-server.conf-template vm-postgresql.conf |
...
Ao realizar o comando, o resultado será apresentado na tela:
WARNING: No backup strategy set for server 'vmpostgresql' (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. Starting backup using rsync-exclusive method for server vmpostgresql in /var/lib/barman/vmpostgresql/base/20220304T120404 Backup start at LSN: 0/C000028 (00000001000000000000000C, 00000028) Starting backup copy via rsync/SSH for 20220304T120404 Copy done (time: 1 second) Asking PostgreSQL server to finalize the backup. Backup size: 24.5 MiB Backup end at LSN: 0/C000100 (00000001000000000000000C, 00000100) Backup completed (start time: 2022-03-04 12:04:05.098223, elapsed time: 2 seconds) Processing xlog segments from file archival for vmpostgresql 00000001000000000000000B 00000001000000000000000C 00000001000000000000000C.00000028.backup |
Para listar os backups realizados, execute o seguinte comando:
Bloco de código |
---|
barman list-backup vmpostgresql |
vmpostgresql 20220304T120404 - Fri Mar 4 12:04:06 2022 - Size: 24.5 MiB - WAL Size: 96.5 KiB vmpostgresql 20220303T210358 - Thu Mar 3 21:04:00 2022 - Size: 24.5 MiB - WAL Size: 32.2 KiB vmpostgresql 20220303T210310 - Thu Mar 3 21:03:11 2022 - Size: 24.5 MiB - WAL Size: 32.2 KiB vmpostgresql 20220303T210206 - Thu Mar 3 21:02:07 2022 - Size: 24.5 MiB - WAL Size: 32.2 KiB |
É possível listar os detalhes de um backup específico com o comando a seguir:
Bloco de código |
---|
barman show-backup vm-postgresql01 20220607T193746 |
Backup 20220607T193746: Server Name |
: vm-postgresql01 System Id : 7106500250670266068 Status |
: DONE PostgreSQL Version : 120011 PGDATA directory : /var/lib/pgsql/12/data Base backup information: Disk usage : 23.6 MiB (23.6 MiB with WALs) Incremental size : 23.6 MiB (-0.00%) Timeline : 1 Begin WAL : 000000010000000000000009 End WAL : 000000010000000000000009 WAL number : 1 WAL compression ratio: 99.90% Begin time : 2022-06-07 19:37:46.705044+00:00 End time : 2022-06-07 19:37:47.295758+00:00 Copy time : less than one second Estimated throughput : 40.6 MiB/s Begin Offset : 40 End Offset : 0 Begin LSN : 0/9000028 End LSN : 0/A000000 WAL information: No of files : 0 Disk usage : 0 B Last available : 000000010000000000000009 Catalog information: Retention Policy : not enforced Previous Backup : 20220607T193735 Next Backup : - (this is the latest base backup) |