SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
PGBACKREST
POSTGRESQL USER GROUP TOULOUSE MEETUP
2018-06-05
Jean-Christophe Arnu
Loxodata
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
QUI
Jean-Christophe Arnu
Consultant PostgreSQL
@jcarnu
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
LOXODATA
Entreprise disposant de 3 piliers d'expertises
PostgreSQL DevOps Cloud
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
LOXODATA
Une large palette de services
Architecture Conseil Formation
Administration Audit Support
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
PGBACKREST
Comment fonctionne PostgreSQL
Principe de fonctionnement de pgBackRest
Mise en place prélimiaire
Utilisation
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ECRITURE DES DONNÉES
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ECRITURE DES DONNÉES
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ECRITURE DES DONNÉES
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ECRITURE DES DONNÉES
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ECRITURE DES DONNÉES
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ECRITURE DES DONNÉES
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ECRITURE DES DONNÉES
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ECRITURE DES DONNÉES
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ARCHIVES
WAL segment: 16Mo, nom 24HEX = 8HEX(timeline)+8HEX(LOG)+8HEX(PHY)
000000010000000A0000005A
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
BACKUP PHYSIQUE
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
SAUVEGARDE SUR SERVEUR
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
OÙ INTERVIENT PGBACKREST ?
Peut prendre un « instantané de vos données » (cluster wide)
Récupére les journaux complets pour les placer « en lieu sûr »
Fournit un catalogue et des actions sur les backups
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
Gestion en ux, parallélisme et asynchronise
Compression en parallèle (multicore) sur serveur de base
Les archives sauvegardées (et restaurées) en parallèle et asynchrones, une
seule fois
Support des tablespaces et de liens
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
Opérations locales ou distantes
S'appuie fortement sur SSH
Accès à PostgreSQL localement (en utilisant SSH)
Support de Amazon S3
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
Backups
Complet
Différentiels (ref = dernier complet)
Incrémentaux (ref = dernier complet ou diff)
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
Gestion intelligente des rétentions
Pour les backups complets et différentiels
Pour les archives (tous les backups ou le dernier)
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
Intégrité, sécurité (et performance), chiffrement
Checksums sur tous les chiers du backup
Les backups sont au même format que dans un cluster
Véri cation des checksums/page si actif sur cluster
Chiffrement des backups possible
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
Restauration
Delta, seuls les chiers dont le checksum a changé sont restaurées, le tout
de façon parallèle
Remapping des tablespaces possible
Restauration parallèles et asynchrones
Restauration des archives manquantes uniquement (cksum)
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
INSTALLATION AVEC DEBIAN
Récupération des paquets du PGDG :
Installation
Installer sur le serveur DB et sur le serveur de backup.
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" 
> /etc/apt/sources.list.d/pgdg.list
apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt-get update
apt install pgbackrest
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
CONFIGURATION DE PGBACKREST
Le chier /etc/pgbackrest.conf sous Debian.
Principe de stanza
Con guration principale
[dbdemo]
# Identique au data_directory de postgresql.conf
pg1-path=/var/lib/postgresql/10/main
[global]
# Existe déjà sous Debian
repo1-path=/var/lib/pgbackrest
# Rétention 2 full, + 1 diff
repo1-retention-diff=1
repo1-retention-full=2
start-fast=y
[global:archive-push]
# global:command => spécifique à la commande
# stanza:command existe également
compress-level=3
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
CONFIGURATION DE PGBACKREST
Chiffrement
Parallélisme (lscpu)
[global]
...
# Chiffrement
repo1-cipher-pass=DemoMeetupToulouse20180605!
repo1-cipher-type=aes-256-cbc
...
[global]
...
# Parallélisme
process-max=2
..
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
CONFIGURATION DE POSTGRESQL
Editer le chier postgresql.conf
...
Redémarrer PostgreSQL
archive_mode = on
wal_level = archive # options hot_standby ou logical
max_wal_sender = 3
archive_command = 'pgbackrest --stanza=dbdemo archive-push %p'
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
PRÉPARER LE REPOSITORY
pgbackrest --stanza=dbdemo --log-level-console=info stanza-create
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
PREMIER BACKUP
VÉRIFICATION DU BACKUP
pgbackrest --log-level-console=info --stanza=dbdemo backup
pgbackrest --log-level-console=info --stanza=dbdemo info
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
DEMO BACKUP LOCAL
jc@vega:~/dev/loxodata/presentation/demos/pgbackrest_meetup$ vagrant ssh db2
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue May 29 08:29:52 2018 from 10.0.2.2
vagrant@pgdb-2:~$ sudo su - postgres
postgres@pgdb-2:~$ vim /etc/postgresql
00:20
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
CAS D'USAGE : SERVEUR DE SAUVEGARDE
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ECHANGE DES CLÉS SSH
Génération des clés : sur le serveur de backup et les hôtes DB
Placer les clés publiques dans .ssh/authorized_keys
Tester les connexions dans les deux sens
ssh-keygen -t rsa -n 4096
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
SERVEUR DE REPOSITORY (SSH)
Con guration de la base
Con guration sur le serveur
[dbdemo]
pg1-path=/var/log/postgresql/10/main
[global]
repo1-host=backuphost
repo1-host-user=postgres
[dbdemo]
pg1-host=serveurmeetup
pg1-host-user=postgres
pg1-path=/var/lib/postgresql/10/main
[global]
repo1-path=/var/lib/pgbackrest
# Chiffrement
repo1-cipher-pass=DemoMeetupToulouse20180605!
repo1-cipher-type=aes-256-cbc
# Parallelisme
process-max=2
# Rétention
repo1-retention-diff=1
repo1-retention-full=2
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
DEMO BACKUP DISTANT
jc@vega:~/dev/loxodata/presentation/demos/pgbackrest_meetup$ vagrant ssh db1
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon May 28 10:05:43 2018 from 10.0.2.2
vagrant@pgdb-1:~$ sudo su - postgres
postgres@pgdb-1:~$ vim /et
00:12
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
UTILISATION
On peut restaurer jusqu'à un certain point dans le temps :
Préciser le backup à utiliser :
utiliser info pour identi er le backup à appliquer
et --set
Action de n de restauration lors du lancement pgbackrest restore :
L'option --type permet de dé nir la nature des objectifs de restauration
(temps, xid, nom, ...)
--type=time --target="2018-06-05 19:30:00.1234567+00" restore
pgbackrest info
--type=time "--target="2018-06-05 19:30:00.1234567+00" --set=<nomduset> restore
--target-action={promote,pause,shutdown}
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
DEMO DE RESTAURATION
jc@vega:~/dev/loxodata/presentation/demos/pgbackrest_meetup$ vagrant ssh db1
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue May 29 09:48:48 2018 from 10.0.2.2
vagrant@pgdb-1:~$ sudo su - postgres
00:05
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
UTILISATION
Désactiver ou activer pgbackrest (global ou stanza):
Récupérer les archives (hot-standby et SR), chier recovery.conf généré
automatiquement
exemple de chier recovery.conf:
stop
ou
start
archive-get
standby_mode = 'on'
restore_command = 'pgbackrest --stanza=dbdemo archive-get %f "%p"'
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
HOT STANDBY
pgbackrest sait gérer la restauration en mode standby (génération du
recovery.conf)
pgbackrest.conf la stanza doit comprendre :
Peut être multiple :
Rajoute archive-get automatiquement
Gère automatiquement les recovery_target (time, name)
On peut exiger qu'il n'y ait pas d'écriture de recovery.conf :
recovery-options=stanby_mode=on
recovery-options=stanby_mode=on
primary_conninfo=db=test user=replicatonr host=dbdemomeetup
--type=preserve
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
CONCLUSION
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
pgBackRest
un outil simple
able
performant
versatile
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
ET AUSSI!
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
Rendre les femmes de PostgreSQL plus visibles
 @PostgresWomen
 
 
https://www.facebook.com/PostgresWomen/
https://www.postgresql.org/list/pgsql-women/
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
All we need is love!
: last friday of July
: 256th day of the year
: rst friday of July
Sysadmin appreciation day
Day of the Programmer
DBA appreciation day
 LOXODATA
pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
QUESTIONS ?
C'est ni !
Nous recrutons !
recrutement@loxodata.com
MERCI ! :-)
Logo pgBackRest créé par Alexander Skowalsky

Contenu connexe

Tendances

Troubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationTroubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationAlexey Lesovsky
 
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsCommand Prompt., Inc
 
Logical replication with pglogical
Logical replication with pglogicalLogical replication with pglogical
Logical replication with pglogicalUmair Shahid
 
MySQL Buffer Management
MySQL Buffer ManagementMySQL Buffer Management
MySQL Buffer ManagementMIJIN AN
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
Monitoring IO performance with iostat and pt-diskstats
Monitoring IO performance with iostat and pt-diskstatsMonitoring IO performance with iostat and pt-diskstats
Monitoring IO performance with iostat and pt-diskstatsBen Mildren
 
Common issues with Apache Kafka® Producer
Common issues with Apache Kafka® ProducerCommon issues with Apache Kafka® Producer
Common issues with Apache Kafka® Producerconfluent
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBrendan Gregg
 
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRestPGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRestPGDay.Amsterdam
 
PostgreSQL Deep Internal
PostgreSQL Deep InternalPostgreSQL Deep Internal
PostgreSQL Deep InternalEXEM
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationCommand Prompt., Inc
 
Optimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache SparkOptimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache SparkDatabricks
 
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...Databricks
 
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdfDeep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdfAltinity Ltd
 
pgpool-II demonstration
pgpool-II demonstrationpgpool-II demonstration
pgpool-II demonstrationelliando dias
 
Postgresql database administration volume 1
Postgresql database administration volume 1Postgresql database administration volume 1
Postgresql database administration volume 1Federico Campoli
 
HDFS Trunncate: Evolving Beyond Write-Once Semantics
HDFS Trunncate: Evolving Beyond Write-Once SemanticsHDFS Trunncate: Evolving Beyond Write-Once Semantics
HDFS Trunncate: Evolving Beyond Write-Once SemanticsDataWorks Summit
 
A Deep Dive into Kafka Controller
A Deep Dive into Kafka ControllerA Deep Dive into Kafka Controller
A Deep Dive into Kafka Controllerconfluent
 

Tendances (20)

Troubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationTroubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming Replication
 
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
 
Logical replication with pglogical
Logical replication with pglogicalLogical replication with pglogical
Logical replication with pglogical
 
MySQL Buffer Management
MySQL Buffer ManagementMySQL Buffer Management
MySQL Buffer Management
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Monitoring IO performance with iostat and pt-diskstats
Monitoring IO performance with iostat and pt-diskstatsMonitoring IO performance with iostat and pt-diskstats
Monitoring IO performance with iostat and pt-diskstats
 
Common issues with Apache Kafka® Producer
Common issues with Apache Kafka® ProducerCommon issues with Apache Kafka® Producer
Common issues with Apache Kafka® Producer
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame Graphs
 
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRestPGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
 
PostgreSQL Deep Internal
PostgreSQL Deep InternalPostgreSQL Deep Internal
PostgreSQL Deep Internal
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Optimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache SparkOptimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache Spark
 
Backup and-recovery2
Backup and-recovery2Backup and-recovery2
Backup and-recovery2
 
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
 
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdfDeep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
 
Docker Forensics
Docker ForensicsDocker Forensics
Docker Forensics
 
pgpool-II demonstration
pgpool-II demonstrationpgpool-II demonstration
pgpool-II demonstration
 
Postgresql database administration volume 1
Postgresql database administration volume 1Postgresql database administration volume 1
Postgresql database administration volume 1
 
HDFS Trunncate: Evolving Beyond Write-Once Semantics
HDFS Trunncate: Evolving Beyond Write-Once SemanticsHDFS Trunncate: Evolving Beyond Write-Once Semantics
HDFS Trunncate: Evolving Beyond Write-Once Semantics
 
A Deep Dive into Kafka Controller
A Deep Dive into Kafka ControllerA Deep Dive into Kafka Controller
A Deep Dive into Kafka Controller
 

Similaire à Pgbackrest meetup

PostgreSQL sous linux
PostgreSQL sous linuxPostgreSQL sous linux
PostgreSQL sous linuxKhalid ALLILI
 
PostgreSQL sous linux
PostgreSQL sous linuxPostgreSQL sous linux
PostgreSQL sous linuxKhalid ALLILI
 
Hi-Media Couchbase meetup Paris Nb #1
Hi-Media Couchbase meetup Paris Nb #1Hi-Media Couchbase meetup Paris Nb #1
Hi-Media Couchbase meetup Paris Nb #1Mickaël Le Baillif
 
Spark Streaming
Spark StreamingSpark Streaming
Spark StreamingPALO IT
 
Python application packaging @ MeilleursAgents
Python application packaging @ MeilleursAgentsPython application packaging @ MeilleursAgents
Python application packaging @ MeilleursAgentsNicolas Mussat
 
SQL Debug avec Django @ PyConFr 2015
SQL Debug avec Django @ PyConFr 2015SQL Debug avec Django @ PyConFr 2015
SQL Debug avec Django @ PyConFr 2015Rodolphe Quiédeville
 
PostgreSQL pour débutants
PostgreSQL pour débutantsPostgreSQL pour débutants
PostgreSQL pour débutantsLætitia Avrot
 
Présentation CoreOS
Présentation CoreOSPrésentation CoreOS
Présentation CoreOSgcatt
 
Compilation noyau linux depuis les sources
Compilation noyau linux depuis les sourcesCompilation noyau linux depuis les sources
Compilation noyau linux depuis les sourcesThierry Gayet
 
SSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLSSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLHervé Leclerc
 
Java 7 - Fork/Join
Java 7 - Fork/JoinJava 7 - Fork/Join
Java 7 - Fork/JoinZenika
 
optimadata.nl-Comment exécuter Postgres sur Docker partie 3.pdf
optimadata.nl-Comment exécuter Postgres sur Docker partie 3.pdfoptimadata.nl-Comment exécuter Postgres sur Docker partie 3.pdf
optimadata.nl-Comment exécuter Postgres sur Docker partie 3.pdfPascal Ponzoni
 
L'art d'ordonner avec JobScheduler
L'art d'ordonner avec JobSchedulerL'art d'ordonner avec JobScheduler
L'art d'ordonner avec JobSchedulerLook a box
 
Gestion des LOGS savec syslog+loganalyzer
Gestion des LOGS savec syslog+loganalyzerGestion des LOGS savec syslog+loganalyzer
Gestion des LOGS savec syslog+loganalyzerMohamet Lamine DIOP
 

Similaire à Pgbackrest meetup (20)

PostgreSQL sous linux
PostgreSQL sous linuxPostgreSQL sous linux
PostgreSQL sous linux
 
PostgreSQL sous linux
PostgreSQL sous linuxPostgreSQL sous linux
PostgreSQL sous linux
 
Hi-Media Couchbase meetup Paris Nb #1
Hi-Media Couchbase meetup Paris Nb #1Hi-Media Couchbase meetup Paris Nb #1
Hi-Media Couchbase meetup Paris Nb #1
 
iTunes Stats
iTunes StatsiTunes Stats
iTunes Stats
 
Pgbadger
PgbadgerPgbadger
Pgbadger
 
Apache Open SSL
Apache Open SSLApache Open SSL
Apache Open SSL
 
Meetup CMS Rubedo 12 décembre 2013
Meetup CMS Rubedo 12 décembre 2013Meetup CMS Rubedo 12 décembre 2013
Meetup CMS Rubedo 12 décembre 2013
 
Spark Streaming
Spark StreamingSpark Streaming
Spark Streaming
 
Python application packaging @ MeilleursAgents
Python application packaging @ MeilleursAgentsPython application packaging @ MeilleursAgents
Python application packaging @ MeilleursAgents
 
SQL Debug avec Django @ PyConFr 2015
SQL Debug avec Django @ PyConFr 2015SQL Debug avec Django @ PyConFr 2015
SQL Debug avec Django @ PyConFr 2015
 
PostgreSQL pour débutants
PostgreSQL pour débutantsPostgreSQL pour débutants
PostgreSQL pour débutants
 
Présentation CoreOS
Présentation CoreOSPrésentation CoreOS
Présentation CoreOS
 
Hibernate.pdf
Hibernate.pdfHibernate.pdf
Hibernate.pdf
 
Compilation noyau linux depuis les sources
Compilation noyau linux depuis les sourcesCompilation noyau linux depuis les sources
Compilation noyau linux depuis les sources
 
Geneve Monitoring Graylog
Geneve Monitoring GraylogGeneve Monitoring Graylog
Geneve Monitoring Graylog
 
SSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLSSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQL
 
Java 7 - Fork/Join
Java 7 - Fork/JoinJava 7 - Fork/Join
Java 7 - Fork/Join
 
optimadata.nl-Comment exécuter Postgres sur Docker partie 3.pdf
optimadata.nl-Comment exécuter Postgres sur Docker partie 3.pdfoptimadata.nl-Comment exécuter Postgres sur Docker partie 3.pdf
optimadata.nl-Comment exécuter Postgres sur Docker partie 3.pdf
 
L'art d'ordonner avec JobScheduler
L'art d'ordonner avec JobSchedulerL'art d'ordonner avec JobScheduler
L'art d'ordonner avec JobScheduler
 
Gestion des LOGS savec syslog+loganalyzer
Gestion des LOGS savec syslog+loganalyzerGestion des LOGS savec syslog+loganalyzer
Gestion des LOGS savec syslog+loganalyzer
 

Pgbackrest meetup

  • 1.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com PGBACKREST POSTGRESQL USER GROUP TOULOUSE MEETUP 2018-06-05 Jean-Christophe Arnu Loxodata
  • 2.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com QUI Jean-Christophe Arnu Consultant PostgreSQL @jcarnu
  • 3.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com LOXODATA Entreprise disposant de 3 piliers d'expertises PostgreSQL DevOps Cloud
  • 4.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com LOXODATA Une large palette de services Architecture Conseil Formation Administration Audit Support
  • 5.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com PGBACKREST Comment fonctionne PostgreSQL Principe de fonctionnement de pgBackRest Mise en place prélimiaire Utilisation
  • 6.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ECRITURE DES DONNÉES
  • 7.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ECRITURE DES DONNÉES
  • 8.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ECRITURE DES DONNÉES
  • 9.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ECRITURE DES DONNÉES
  • 10.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ECRITURE DES DONNÉES
  • 11.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ECRITURE DES DONNÉES
  • 12.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ECRITURE DES DONNÉES
  • 13.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ECRITURE DES DONNÉES
  • 14.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ARCHIVES WAL segment: 16Mo, nom 24HEX = 8HEX(timeline)+8HEX(LOG)+8HEX(PHY) 000000010000000A0000005A
  • 15.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com BACKUP PHYSIQUE
  • 16.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com SAUVEGARDE SUR SERVEUR
  • 17.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com OÙ INTERVIENT PGBACKREST ? Peut prendre un « instantané de vos données » (cluster wide) Récupére les journaux complets pour les placer « en lieu sûr » Fournit un catalogue et des actions sur les backups
  • 18.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com Gestion en ux, parallélisme et asynchronise Compression en parallèle (multicore) sur serveur de base Les archives sauvegardées (et restaurées) en parallèle et asynchrones, une seule fois Support des tablespaces et de liens
  • 19.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com Opérations locales ou distantes S'appuie fortement sur SSH Accès à PostgreSQL localement (en utilisant SSH) Support de Amazon S3
  • 20.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com Backups Complet Différentiels (ref = dernier complet) Incrémentaux (ref = dernier complet ou diff)
  • 21.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com Gestion intelligente des rétentions Pour les backups complets et différentiels Pour les archives (tous les backups ou le dernier)
  • 22.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com Intégrité, sécurité (et performance), chiffrement Checksums sur tous les chiers du backup Les backups sont au même format que dans un cluster Véri cation des checksums/page si actif sur cluster Chiffrement des backups possible
  • 23.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com Restauration Delta, seuls les chiers dont le checksum a changé sont restaurées, le tout de façon parallèle Remapping des tablespaces possible Restauration parallèles et asynchrones Restauration des archives manquantes uniquement (cksum)
  • 24.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com INSTALLATION AVEC DEBIAN Récupération des paquets du PGDG : Installation Installer sur le serveur DB et sur le serveur de backup. echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list apt-get install wget ca-certificates wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - apt-get update apt install pgbackrest
  • 25.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com CONFIGURATION DE PGBACKREST Le chier /etc/pgbackrest.conf sous Debian. Principe de stanza Con guration principale [dbdemo] # Identique au data_directory de postgresql.conf pg1-path=/var/lib/postgresql/10/main [global] # Existe déjà sous Debian repo1-path=/var/lib/pgbackrest # Rétention 2 full, + 1 diff repo1-retention-diff=1 repo1-retention-full=2 start-fast=y [global:archive-push] # global:command => spécifique à la commande # stanza:command existe également compress-level=3
  • 26.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com CONFIGURATION DE PGBACKREST Chiffrement Parallélisme (lscpu) [global] ... # Chiffrement repo1-cipher-pass=DemoMeetupToulouse20180605! repo1-cipher-type=aes-256-cbc ... [global] ... # Parallélisme process-max=2 ..
  • 27.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com CONFIGURATION DE POSTGRESQL Editer le chier postgresql.conf ... Redémarrer PostgreSQL archive_mode = on wal_level = archive # options hot_standby ou logical max_wal_sender = 3 archive_command = 'pgbackrest --stanza=dbdemo archive-push %p'
  • 28.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com PRÉPARER LE REPOSITORY pgbackrest --stanza=dbdemo --log-level-console=info stanza-create
  • 29.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com PREMIER BACKUP VÉRIFICATION DU BACKUP pgbackrest --log-level-console=info --stanza=dbdemo backup pgbackrest --log-level-console=info --stanza=dbdemo info
  • 30.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com DEMO BACKUP LOCAL jc@vega:~/dev/loxodata/presentation/demos/pgbackrest_meetup$ vagrant ssh db2 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Tue May 29 08:29:52 2018 from 10.0.2.2 vagrant@pgdb-2:~$ sudo su - postgres postgres@pgdb-2:~$ vim /etc/postgresql 00:20
  • 31.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com CAS D'USAGE : SERVEUR DE SAUVEGARDE
  • 32.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ECHANGE DES CLÉS SSH Génération des clés : sur le serveur de backup et les hôtes DB Placer les clés publiques dans .ssh/authorized_keys Tester les connexions dans les deux sens ssh-keygen -t rsa -n 4096
  • 33.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com SERVEUR DE REPOSITORY (SSH) Con guration de la base Con guration sur le serveur [dbdemo] pg1-path=/var/log/postgresql/10/main [global] repo1-host=backuphost repo1-host-user=postgres [dbdemo] pg1-host=serveurmeetup pg1-host-user=postgres pg1-path=/var/lib/postgresql/10/main [global] repo1-path=/var/lib/pgbackrest # Chiffrement repo1-cipher-pass=DemoMeetupToulouse20180605! repo1-cipher-type=aes-256-cbc # Parallelisme process-max=2 # Rétention repo1-retention-diff=1 repo1-retention-full=2
  • 34.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com DEMO BACKUP DISTANT jc@vega:~/dev/loxodata/presentation/demos/pgbackrest_meetup$ vagrant ssh db1 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Mon May 28 10:05:43 2018 from 10.0.2.2 vagrant@pgdb-1:~$ sudo su - postgres postgres@pgdb-1:~$ vim /et 00:12
  • 35.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com UTILISATION On peut restaurer jusqu'à un certain point dans le temps : Préciser le backup à utiliser : utiliser info pour identi er le backup à appliquer et --set Action de n de restauration lors du lancement pgbackrest restore : L'option --type permet de dé nir la nature des objectifs de restauration (temps, xid, nom, ...) --type=time --target="2018-06-05 19:30:00.1234567+00" restore pgbackrest info --type=time "--target="2018-06-05 19:30:00.1234567+00" --set=<nomduset> restore --target-action={promote,pause,shutdown}
  • 36.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com DEMO DE RESTAURATION jc@vega:~/dev/loxodata/presentation/demos/pgbackrest_meetup$ vagrant ssh db1 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Tue May 29 09:48:48 2018 from 10.0.2.2 vagrant@pgdb-1:~$ sudo su - postgres 00:05
  • 37.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com UTILISATION Désactiver ou activer pgbackrest (global ou stanza): Récupérer les archives (hot-standby et SR), chier recovery.conf généré automatiquement exemple de chier recovery.conf: stop ou start archive-get standby_mode = 'on' restore_command = 'pgbackrest --stanza=dbdemo archive-get %f "%p"'
  • 38.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com HOT STANDBY pgbackrest sait gérer la restauration en mode standby (génération du recovery.conf) pgbackrest.conf la stanza doit comprendre : Peut être multiple : Rajoute archive-get automatiquement Gère automatiquement les recovery_target (time, name) On peut exiger qu'il n'y ait pas d'écriture de recovery.conf : recovery-options=stanby_mode=on recovery-options=stanby_mode=on primary_conninfo=db=test user=replicatonr host=dbdemomeetup --type=preserve
  • 39.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com CONCLUSION
  • 40.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com pgBackRest un outil simple able performant versatile
  • 41.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com ET AUSSI!
  • 42.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com
  • 43.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com Rendre les femmes de PostgreSQL plus visibles  @PostgresWomen     https://www.facebook.com/PostgresWomen/ https://www.postgresql.org/list/pgsql-women/
  • 44.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com All we need is love! : last friday of July : 256th day of the year : rst friday of July Sysadmin appreciation day Day of the Programmer DBA appreciation day
  • 45.  LOXODATA pgBackRest Meetup PostgreSQL Toulouse 2018-06-05 -      -  cc-by-nc@jcarnu jc.arnu@loxodata.com QUESTIONS ? C'est ni ! Nous recrutons ! recrutement@loxodata.com MERCI ! :-) Logo pgBackRest créé par Alexander Skowalsky