diff --git a/HowtoPostgreSQL.md b/HowtoPostgreSQL.md index ce04ee96..c739e5be 100644 --- a/HowtoPostgreSQL.md +++ b/HowtoPostgreSQL.md @@ -829,14 +829,41 @@ pgbouncer=# show help; ### barman -[barman](http://www.pgbarman.org/) est un outil pour gérer les sauvegardes et les restaurations +[barman](http://www.pgbarman.org/) est un outil pour gérer les sauvegardes et les restaurations de données en se basant sur les log de transactions (WAL) de PostgreSQL. +Barman s'installe généralement sur le serveur de sauvegarde : ~~~ # apt install barman barman-cli ~~~ -Voir [la documentation Barman](http://docs.pgbarman.org/release/2.3/). +Pour chaque serveur PostgreSQL à sauvegarder, on créé un fichier dans '/etc/barman.d/' : +~~~ +[foo] +description = "foo.example.net 9.6/main PostgreSQL instance" + +ssh_command = ssh postgres@foo.example.net +conninfo = host=foo.example.net user=barman dbname=postgres + +backup_method = rsync +reuse_backup = link + +archiver = on + +last_backup_maximum_age = 1 DAY +~~~ + +Il faut ensuite autoriser barman à se connecter en SSH et PostgreSQL sur la machine à sauvegarder. + +Dans la configuration de PostgreSQL, rajouter les directives suivantes : + +~~~ +wal_level = 'replica' # ou plus haut +archive_mode = on +archive_command = 'rsync -a %p barman@foo.example.com:foo/incoming/%f' +~~~ + +Voir [la documentation Barman](http://docs.pgbarman.org/release/2.3/). ### pgbadger