SlideShare una empresa de Scribd logo
1 de 59
1
Dans les coulisses d’une
infrastructure hautement disponible
PG Day France – 19 Juin 2019
2
Auteur
• Julien Riou
• DBA depuis 2012
• Tech lead dans l’équipe databases à OVH depuis 2015
• pgterminate @ github
PG Day France – 19 Juin 2019Auteur
3
Sommaire
• Contexte
• Haute disponibilité
• Sauvegardes et restaurations
• Business intelligence
• Mises à jour
• La suite
PG Day France – 19 Juin 2019Sommaire
4PG Day France – 19 Juin 2019Contexte
5
Produits
Cloud
Serveurs dédiés
VPS
Public cloud
Private cloud
Stockage
Web hosting
Noms de domaine
Hébergement web et sites
Solutions E-mail
SSL / CDN
Office & Solutions Microsoft
Platform
Kubernetes
Logs & Metrics Data Platforms
Databases
Big data
AI & Machine Learning
Télécom
Offres Internet
Téléphonie
SMS / Fax
Bureau virtuel
OverTheBox
PG Day France – 19 Juin 2019Contexte
6
Périmètre
Bases internes
60 3000 700 400
Clusters Applications Utilisateurs Bases de
données
PG Day France – 19 Juin 2019Contexte
7
Réagir vite
PG Day France – 19 Juin 2019Haute disponibilité
8
En cas de panne
• Monitoring
• Développeurs
• Support
• Twitter
PG Day France – 19 Juin 2019Haute disponibilité
9
Cluster type
• MySQL
• PostgreSQL
PG Day France – 19 Juin 2019Haute disponibilité
10
Promotion automatique
• Patroni
– Zalando
– Opensource
– Python
PG Day France – 19 Juin 2019Haute disponibilité
11
Promotion
Election de leader
Passage en mode sécurité
API
Répartition de charge
Gestion dynamique de la
configuration
Réplication
Gestion automatique
Reprise après panne
PG Day France – 19 Juin 2019Haute disponibilité
12
Promotion
PG Day France – 19 Juin 2019Haute disponibilité
13
Promotion
PG Day France – 19 Juin 2019Haute disponibilité
14
Promotion
PG Day France – 19 Juin 2019Haute disponibilité
15
Automatiser les opérations
PG Day France – 19 Juin 2019Haute disponibilité
16
Réplication
PG Day France – 19 Juin 2019Haute disponibilité
17
Réplication
PG Day France – 19 Juin 2019Haute disponibilité
18
Réplication
PG Day France – 19 Juin 2019Haute disponibilité
19
Réplication
PG Day France – 19 Juin 2019Haute disponibilité
20
Réplication
PG Day France – 19 Juin 2019Haute disponibilité
21
Rediriger le trafic
PG Day France – 19 Juin 2019Haute disponibilité
22
Répartition de charge
• HAProxy
• Patroni API
• confd
PG Day France – 19 Juin 2019Haute disponibilité
23
HAProxy
• Mode TCP
• Probes HTTPS
• 2 pools de connexion (= 2 ports)
– Lectures et écritures
– Lectures seules
• Fichier d’état
– server-state-base /var/lib/haproxy/state
– socat ${sock} - <<< "show servers state ${backend}" > /var/lib/haproxy/state/${backend}
PG Day France – 19 Juin 2019Haute disponibilité
24
Patroni API
$ curl -i -X OPTIONS https://localhost:443/primary
HTTP/1.0 200 OK
$ curl -i -X OPTIONS https://localhost:443/replica
HTTP/1.0 503 Service Unavailable
PG Day France – 19 Juin 2019Haute disponibilité
25
confd
Découvre les
nodes01 Crée la
configuration
HAProxy
02 Vérifie la
configuration
HAProxy
03 Reload le service
HAProxy04
PG Day France – 19 Juin 2019Haute disponibilité
26
Répartition de charge
$ haproxyctl show health
# pxname svname status weight
stats FRONTEND OPEN
stats BACKEND UP 0
read-write FRONTEND OPEN
read-write node3 DOWN 10
read-write node1 DOWN 10
read-write node2 UP 10
read-write BACKEND UP 10
read-only FRONTEND OPEN
read-only node3 DOWN 10
read-only node1 UP 10
read-only node2 DOWN 10
read-only BACKEND UP 10
PG Day France – 19 Juin 2019Haute disponibilité
27
Répartition de charge
$ haproxyctl show health
# pxname svname status weight
stats FRONTEND OPEN
stats BACKEND UP 0
read-write FRONTEND OPEN
read-write node3 DOWN 10
read-write node1 DOWN 10
read-write node2 UP 10
read-write BACKEND UP 10
read-only FRONTEND OPEN
read-only node3 DOWN 10
read-only node1 UP 10
read-only node2 DOWN 10
read-only BACKEND UP 10
PG Day France – 19 Juin 2019Haute disponibilité
28
Répartition de charge
$ haproxyctl show health
# pxname svname status weight
stats FRONTEND OPEN
stats BACKEND UP 0
read-write FRONTEND OPEN
read-write node3 DOWN 10
read-write node1 DOWN 10
read-write node2 UP 10
read-write BACKEND UP 10
read-only FRONTEND OPEN
read-only node3 DOWN 10
read-only node1 UP 10
read-only node2 DOWN 10
read-only BACKEND UP 10
PG Day France – 19 Juin 2019Haute disponibilité
29
Répartition de charge
$ haproxyctl show health
# pxname svname status weight
stats FRONTEND OPEN
stats BACKEND UP 0
read-write FRONTEND OPEN
read-write node3 DOWN 10
read-write node1 DOWN 10
read-write node2 UP 10
read-write BACKEND UP 10
read-only FRONTEND OPEN
read-only node3 DOWN 10
read-only node1 UP 10
read-only node2 DOWN 10
read-only BACKEND UP 10
PG Day France – 19 Juin 2019Haute disponibilité
30
Répartition de charge
$ haproxyctl show health
# pxname svname status weight
stats FRONTEND OPEN
stats BACKEND UP 0
read-write FRONTEND OPEN
read-write node3 DOWN 10
read-write node1 DOWN 10
read-write node2 UP 10
read-write BACKEND UP 10
read-only FRONTEND OPEN
read-only node3 DOWN 10
read-only node1 UP 10
read-only node2 DOWN 10
read-only BACKEND UP 10
PG Day France – 19 Juin 2019Haute disponibilité
31
Répartition de charge
$ haproxyctl show backends
stats BACKEND UP 0
read-write BACKEND UP 10
read-only BACKEND UP 10
PG Day France – 19 Juin 2019Haute disponibilité
32
IP virtuelle
• keepalived/vrrp
• iputils-arping
• notify_master /usr/bin/arping -U -c 4 $IP
PG Day France – 19 Juin 2019Haute disponibilité
33PG Day France – 19 Juin 2019Haute disponibilité
34
Promotion automatique
Crédits : https://github.com/googlei18n/noto-emoji/blob/master/svg/emoji_u1f60c.svg
PG Day France – 19 Juin 2019Haute disponibilité
35
Promotion automatique
• Proxy non transparent
– pg_hba.conf
– Logs
• Protocole PROXY
• application_name
PG Day France – 19 Juin 2019Haute disponibilité
36
(Re)Trouver ses données
PG Day France – 19 Juin 2019Sauvegardes et restaurations
37
Sauvegardes et restaurations
• Accident logique
– DROP <objet> (DATABASE, ROLE, TABLE, …)
• Accident physique (panne hardware)
• Sauvegardes impactante (I/O, locks)
• Compatibilité avec le reste de l’infrastructure
• Pas de sauvegarde sans test de restauration
PG Day France – 19 Juin 2019Sauvegardes et restaurations
38
Sauvegardes et restaurations
PG Day France – 19 Juin 2019Sauvegardes et restaurations
39
Faciliter l’analyse
PG Day France – 19 Juin 2019Business intelligence
40
Business intelligence
• OLTP vs OLAP
– OLTP (On-line Transaction Processing)
– OLAP (On-line Analytical Processing)
• Les deux charges ne vont pas ensemble
• Comment ne pas bloquer le système operationel ?
PG Day France – 19 Juin 2019Business intelligence
41
Business intelligence
PG Day France – 19 Juin 2019Business intelligence
42
Avoir un système à jour
PG Day France – 19 Juin 2019Mises à jour
43
Mises à jour mineures
• clustershell
$ clush -bw @patroni
$ clush -bw @patroni&@cluster:69
$ clush –bw node1,node2,node3
Enter 'quit' to leave this interactive mode
Working with nodes: node[1-3]
clush> psql -c 'show server_version;'
---------------
node[1-3] (3)
---------------
server_version
----------------
9.6.11
(1 row)
PG Day France – 19 Juin 2019Mises à jour
44
Mises à jour mineures
• clustershell
$ clush –f 1 –bw node1,node2,node3
Enter 'quit' to leave this interactive mode
Working with nodes: node[1-3]
clush> apt-get upgrade -y
PG Day France – 19 Juin 2019Mises à jour
45
Mises à jour mineures
• clustershell
$ clush –bw node1,node2,node3
Enter 'quit' to leave this interactive mode
Working with nodes: node[1-3]
clush> psql -c 'show server_version;'
---------------
node[1-3] (3)
---------------
server_version
----------------
9.6.12
(1 row)
PG Day France – 19 Juin 2019Mises à jour
46
2015
PostgreSQL 9.2
Debian Wheezy
Migration applicative
pg_dump 2017
PostgreSQL 9.4
Debian Jessie
Logical Decoding
Mises à jour majeures
pg_upgrade
PG Day France – 19 Juin 2019Mises à jour
47
2017
PostgreSQL 9.4
Debian Jessie
Standalone
pglogical
pg_dump
pg_upgrade
2019
PostgreSQL 9.6
Debian Stretch
Patroni
Mises à jour majeures
PG Day France – 19 Juin 2019Mises à jour
48
pglogical
• deadlocks
ERROR: deadlock detected at character 237
DETAIL: Process 16477 waits for AccessShareLock on relation 17241 of database 17032;
blocked by process 17333.
Process 17333 waits for AccessExclusiveLock on relation 4920800 of database
17032; blocked by process 16477.
Process 16477: <application query>
Process 17333: SELECT pglogical.replication_set_add_all_tables('default',
ARRAY['public']);
HINT: See server log for query details.
STATEMENT: <application query>
PG Day France – 19 Juin 2019Mises à jour
49
pglogical
• Charset
• Non supporté (doc)
ERROR: encoding conversion for binary datum not supported yet
DETAIL: expected_encoding UTF8 must be unset or match server_encoding SQL_ASCII
CONTEXT: slot "pgl_<slotname>", output plugin "pglogical_output", in the startup
callback
LOG: could not receive data from client: Connection reset by peer
4.13 Database encoding differences
PGLogical does not support replication between databases with different encoding. We recommend using UTF-8 encoding in all
replicated databases.
PG Day France – 19 Juin 2019Mises à jour
50
pglogical
• Séquences
ERROR: duplicate key value violates unique constraint "table_pkey"
PG Day France – 19 Juin 2019Mises à jour
51
pg_upgrade
• Hardlinks (-k)
• Statistiques
$ vacuumdb --all --analyze-in-stages -j 10
PG Day France – 19 Juin 2019Mises à jour
52
pg_upgrade
PG Day France – 19 Juin 2019Mises à jour
53
Conclusion
PG Day France – 19 Juin 2019Conclusion
54
Conclusion
Meilleure stabilitéMeilleure disponibilité
Moins d’administrationMoins d’alertes
PG Day France – 19 Juin 2019Conclusion
55
Réversibilité
Haute disponibilité
Élasticité
Performance
Managed
Eat your own food
Bases de données externes
PG Day France – 19 Juin 2019Conclusion
56
Ensuite ?
PG Day France – 19 Juin 2019La suite
57
La suite
• Mise à jour vers PostgreSQL 12
• Mise à jour vers Debian 10
• Migration de MySQL vers PostgreSQL
• Automatisation, automatisation, automatisation !
PG Day France – 19 Juin 2019La suite
58
On recrute
• Opensource Database Engineers
• Site Reliability Engineers (Private Cloud, Openstack, DNS, Deploy, Observability)
• Software Engineers (containers, baremetal, web hosting)
• Backend Developpers (Python, Go)
• Et plus !
PG Day France – 19 Juin 2019La suite
59
Questions
PG Day France – 19 Juin 2019

Más contenido relacionado

Similar a Dans les coulisses d'une infrastructure hautement disponible.

Ensemble complet-eon
Ensemble complet-eonEnsemble complet-eon
Ensemble complet-eonhayet nasri
 
BDX_IO - API Green Score in action.pdf
BDX_IO - API Green Score in action.pdfBDX_IO - API Green Score in action.pdf
BDX_IO - API Green Score in action.pdfJean-Rémy Revy
 
Presentation de nagios mohamed bouhamed
Presentation de nagios mohamed bouhamedPresentation de nagios mohamed bouhamed
Presentation de nagios mohamed bouhamedTECOS
 
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
 
Le poste de travail Libre
Le poste de travail LibreLe poste de travail Libre
Le poste de travail LibreLINAGORA
 
La Duck Conf - "Edge computing : le déploiement continu se fait une virée en ...
La Duck Conf - "Edge computing : le déploiement continu se fait une virée en ...La Duck Conf - "Edge computing : le déploiement continu se fait une virée en ...
La Duck Conf - "Edge computing : le déploiement continu se fait une virée en ...OCTO Technology
 
F5 ltm administering big ip v11
F5 ltm administering big ip v11F5 ltm administering big ip v11
F5 ltm administering big ip v11Amine Haddanou
 
S35 developper en node.js versus php
S35   developper en node.js versus phpS35   developper en node.js versus php
S35 developper en node.js versus phpGautier DUMAS
 
29/06/17 Matinale Python
29/06/17 Matinale Python29/06/17 Matinale Python
29/06/17 Matinale PythonSoft Computing
 
Contractualisation agile : Saison 2 (atm)
Contractualisation agile :  Saison 2 (atm)Contractualisation agile :  Saison 2 (atm)
Contractualisation agile : Saison 2 (atm)Michel Lejeune
 
Presentation nabil.mgueraman version-f.pptx [enregistrement automatique]
Presentation nabil.mgueraman version-f.pptx [enregistrement automatique]Presentation nabil.mgueraman version-f.pptx [enregistrement automatique]
Presentation nabil.mgueraman version-f.pptx [enregistrement automatique]nabil15
 
Meilleures pratiques bgp
Meilleures pratiques bgpMeilleures pratiques bgp
Meilleures pratiques bgpAymen Bouzid
 
1 pourquoi le big data aujourdhui
1 pourquoi le big data aujourdhui1 pourquoi le big data aujourdhui
1 pourquoi le big data aujourdhuiRomain Jouin
 

Similar a Dans les coulisses d'une infrastructure hautement disponible. (20)

Ensemble complet-eon
Ensemble complet-eonEnsemble complet-eon
Ensemble complet-eon
 
BDX_IO - API Green Score in action.pdf
BDX_IO - API Green Score in action.pdfBDX_IO - API Green Score in action.pdf
BDX_IO - API Green Score in action.pdf
 
Drupal dans l'internet des objets
Drupal dans l'internet des objetsDrupal dans l'internet des objets
Drupal dans l'internet des objets
 
Presentation de nagios mohamed bouhamed
Presentation de nagios mohamed bouhamedPresentation de nagios mohamed bouhamed
Presentation de nagios mohamed bouhamed
 
Gestion des LOGS savec syslog+loganalyzer
Gestion des LOGS savec syslog+loganalyzerGestion des LOGS savec syslog+loganalyzer
Gestion des LOGS savec syslog+loganalyzer
 
Le poste de travail Libre
Le poste de travail LibreLe poste de travail Libre
Le poste de travail Libre
 
La Duck Conf - "Edge computing : le déploiement continu se fait une virée en ...
La Duck Conf - "Edge computing : le déploiement continu se fait une virée en ...La Duck Conf - "Edge computing : le déploiement continu se fait une virée en ...
La Duck Conf - "Edge computing : le déploiement continu se fait une virée en ...
 
F5 ltm administering big ip v11
F5 ltm administering big ip v11F5 ltm administering big ip v11
F5 ltm administering big ip v11
 
S35 developper en node.js versus php
S35   developper en node.js versus phpS35   developper en node.js versus php
S35 developper en node.js versus php
 
29/06/17 Matinale Python
29/06/17 Matinale Python29/06/17 Matinale Python
29/06/17 Matinale Python
 
201903 breizhcamp - rex minio
201903   breizhcamp - rex minio201903   breizhcamp - rex minio
201903 breizhcamp - rex minio
 
Supervision
SupervisionSupervision
Supervision
 
See i pv6
See i pv6See i pv6
See i pv6
 
Contractualisation agile : Saison 2 (atm)
Contractualisation agile :  Saison 2 (atm)Contractualisation agile :  Saison 2 (atm)
Contractualisation agile : Saison 2 (atm)
 
Presentation nabil.mgueraman version-f.pptx [enregistrement automatique]
Presentation nabil.mgueraman version-f.pptx [enregistrement automatique]Presentation nabil.mgueraman version-f.pptx [enregistrement automatique]
Presentation nabil.mgueraman version-f.pptx [enregistrement automatique]
 
Propostion un Iaas
Propostion un IaasPropostion un Iaas
Propostion un Iaas
 
Cyceo solution virtualisation
Cyceo solution virtualisationCyceo solution virtualisation
Cyceo solution virtualisation
 
projet sur le vpn presentation
projet sur le vpn presentationprojet sur le vpn presentation
projet sur le vpn presentation
 
Meilleures pratiques bgp
Meilleures pratiques bgpMeilleures pratiques bgp
Meilleures pratiques bgp
 
1 pourquoi le big data aujourdhui
1 pourquoi le big data aujourdhui1 pourquoi le big data aujourdhui
1 pourquoi le big data aujourdhui
 

Más de OVHcloud

OVHcloud Startup Program : Découvrir l'écosystème au service des startups
OVHcloud Startup Program : Découvrir l'écosystème au service des startups OVHcloud Startup Program : Découvrir l'écosystème au service des startups
OVHcloud Startup Program : Découvrir l'écosystème au service des startups OVHcloud
 
Fine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsFine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsOVHcloud
 
How can you successfully migrate to hosted private cloud 2020
How can you successfully migrate to hosted private cloud 2020How can you successfully migrate to hosted private cloud 2020
How can you successfully migrate to hosted private cloud 2020OVHcloud
 
OVHcloud Partner Webinar - Data Processing
OVHcloud Partner Webinar - Data ProcessingOVHcloud Partner Webinar - Data Processing
OVHcloud Partner Webinar - Data ProcessingOVHcloud
 
OVHcloud Tech Talks S01E09 - OVHcloud Data Processing : Le nouveau service po...
OVHcloud Tech Talks S01E09 - OVHcloud Data Processing : Le nouveau service po...OVHcloud Tech Talks S01E09 - OVHcloud Data Processing : Le nouveau service po...
OVHcloud Tech Talks S01E09 - OVHcloud Data Processing : Le nouveau service po...OVHcloud
 
Webinar - VPS New Range
Webinar - VPS New RangeWebinar - VPS New Range
Webinar - VPS New RangeOVHcloud
 
OVHcloud Tech Talks S01E08 - GAIA-X pour les techs : OVHcloud & Scaleway vous...
OVHcloud Tech Talks S01E08 - GAIA-X pour les techs : OVHcloud & Scaleway vous...OVHcloud Tech Talks S01E08 - GAIA-X pour les techs : OVHcloud & Scaleway vous...
OVHcloud Tech Talks S01E08 - GAIA-X pour les techs : OVHcloud & Scaleway vous...OVHcloud
 
Webinar - Enterprise Cloud Databases
Webinar - Enterprise Cloud DatabasesWebinar - Enterprise Cloud Databases
Webinar - Enterprise Cloud DatabasesOVHcloud
 
OVHcloud Tech Talks S01E07 – Introduction à l’intelligence artificielle pour ...
OVHcloud Tech Talks S01E07 – Introduction à l’intelligence artificielle pour ...OVHcloud Tech Talks S01E07 – Introduction à l’intelligence artificielle pour ...
OVHcloud Tech Talks S01E07 – Introduction à l’intelligence artificielle pour ...OVHcloud
 
OVHcloud Tech Talks Fr S01E06 – BeeGFS, un filesystem orienté performance, ma...
OVHcloud Tech Talks Fr S01E06 – BeeGFS, un filesystem orienté performance, ma...OVHcloud Tech Talks Fr S01E06 – BeeGFS, un filesystem orienté performance, ma...
OVHcloud Tech Talks Fr S01E06 – BeeGFS, un filesystem orienté performance, ma...OVHcloud
 
OVHcloud Tech Talks Fr S01E05 – L’opérateur Harbor, une nécessité pour certai...
OVHcloud Tech Talks Fr S01E05 – L’opérateur Harbor, une nécessité pour certai...OVHcloud Tech Talks Fr S01E05 – L’opérateur Harbor, une nécessité pour certai...
OVHcloud Tech Talks Fr S01E05 – L’opérateur Harbor, une nécessité pour certai...OVHcloud
 
OVHcloud Tech-Talk S01E04 - La télémétrie au service de l'agilité
OVHcloud Tech-Talk S01E04 - La télémétrie au service de l'agilitéOVHcloud Tech-Talk S01E04 - La télémétrie au service de l'agilité
OVHcloud Tech-Talk S01E04 - La télémétrie au service de l'agilitéOVHcloud
 
OVHcloud TechTalks - ML serving
OVHcloud TechTalks - ML servingOVHcloud TechTalks - ML serving
OVHcloud TechTalks - ML servingOVHcloud
 
Logs @ OVHcloud
Logs @ OVHcloudLogs @ OVHcloud
Logs @ OVHcloudOVHcloud
 
Les APIs OpenStack
Les APIs OpenStackLes APIs OpenStack
Les APIs OpenStackOVHcloud
 
1 sysadmin vs 250 clusters de stockage
1 sysadmin vs 250 clusters de stockage1 sysadmin vs 250 clusters de stockage
1 sysadmin vs 250 clusters de stockageOVHcloud
 
Migrer 3 millions de sites sans maitriser leur code source ? Impossible mais ...
Migrer 3 millions de sites sans maitriser leur code source ? Impossible mais ...Migrer 3 millions de sites sans maitriser leur code source ? Impossible mais ...
Migrer 3 millions de sites sans maitriser leur code source ? Impossible mais ...OVHcloud
 
Industrialize Machine Learning
Industrialize Machine Learning Industrialize Machine Learning
Industrialize Machine Learning OVHcloud
 
OVHcloud – Enterprise Cloud Databases
OVHcloud – Enterprise Cloud DatabasesOVHcloud – Enterprise Cloud Databases
OVHcloud – Enterprise Cloud DatabasesOVHcloud
 
OVHcloud Hosted Private Cloud Platform Network use cases with VMware NSX
OVHcloud Hosted Private Cloud Platform Network use cases with VMware NSXOVHcloud Hosted Private Cloud Platform Network use cases with VMware NSX
OVHcloud Hosted Private Cloud Platform Network use cases with VMware NSXOVHcloud
 

Más de OVHcloud (20)

OVHcloud Startup Program : Découvrir l'écosystème au service des startups
OVHcloud Startup Program : Découvrir l'écosystème au service des startups OVHcloud Startup Program : Découvrir l'écosystème au service des startups
OVHcloud Startup Program : Découvrir l'écosystème au service des startups
 
Fine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsFine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP models
 
How can you successfully migrate to hosted private cloud 2020
How can you successfully migrate to hosted private cloud 2020How can you successfully migrate to hosted private cloud 2020
How can you successfully migrate to hosted private cloud 2020
 
OVHcloud Partner Webinar - Data Processing
OVHcloud Partner Webinar - Data ProcessingOVHcloud Partner Webinar - Data Processing
OVHcloud Partner Webinar - Data Processing
 
OVHcloud Tech Talks S01E09 - OVHcloud Data Processing : Le nouveau service po...
OVHcloud Tech Talks S01E09 - OVHcloud Data Processing : Le nouveau service po...OVHcloud Tech Talks S01E09 - OVHcloud Data Processing : Le nouveau service po...
OVHcloud Tech Talks S01E09 - OVHcloud Data Processing : Le nouveau service po...
 
Webinar - VPS New Range
Webinar - VPS New RangeWebinar - VPS New Range
Webinar - VPS New Range
 
OVHcloud Tech Talks S01E08 - GAIA-X pour les techs : OVHcloud & Scaleway vous...
OVHcloud Tech Talks S01E08 - GAIA-X pour les techs : OVHcloud & Scaleway vous...OVHcloud Tech Talks S01E08 - GAIA-X pour les techs : OVHcloud & Scaleway vous...
OVHcloud Tech Talks S01E08 - GAIA-X pour les techs : OVHcloud & Scaleway vous...
 
Webinar - Enterprise Cloud Databases
Webinar - Enterprise Cloud DatabasesWebinar - Enterprise Cloud Databases
Webinar - Enterprise Cloud Databases
 
OVHcloud Tech Talks S01E07 – Introduction à l’intelligence artificielle pour ...
OVHcloud Tech Talks S01E07 – Introduction à l’intelligence artificielle pour ...OVHcloud Tech Talks S01E07 – Introduction à l’intelligence artificielle pour ...
OVHcloud Tech Talks S01E07 – Introduction à l’intelligence artificielle pour ...
 
OVHcloud Tech Talks Fr S01E06 – BeeGFS, un filesystem orienté performance, ma...
OVHcloud Tech Talks Fr S01E06 – BeeGFS, un filesystem orienté performance, ma...OVHcloud Tech Talks Fr S01E06 – BeeGFS, un filesystem orienté performance, ma...
OVHcloud Tech Talks Fr S01E06 – BeeGFS, un filesystem orienté performance, ma...
 
OVHcloud Tech Talks Fr S01E05 – L’opérateur Harbor, une nécessité pour certai...
OVHcloud Tech Talks Fr S01E05 – L’opérateur Harbor, une nécessité pour certai...OVHcloud Tech Talks Fr S01E05 – L’opérateur Harbor, une nécessité pour certai...
OVHcloud Tech Talks Fr S01E05 – L’opérateur Harbor, une nécessité pour certai...
 
OVHcloud Tech-Talk S01E04 - La télémétrie au service de l'agilité
OVHcloud Tech-Talk S01E04 - La télémétrie au service de l'agilitéOVHcloud Tech-Talk S01E04 - La télémétrie au service de l'agilité
OVHcloud Tech-Talk S01E04 - La télémétrie au service de l'agilité
 
OVHcloud TechTalks - ML serving
OVHcloud TechTalks - ML servingOVHcloud TechTalks - ML serving
OVHcloud TechTalks - ML serving
 
Logs @ OVHcloud
Logs @ OVHcloudLogs @ OVHcloud
Logs @ OVHcloud
 
Les APIs OpenStack
Les APIs OpenStackLes APIs OpenStack
Les APIs OpenStack
 
1 sysadmin vs 250 clusters de stockage
1 sysadmin vs 250 clusters de stockage1 sysadmin vs 250 clusters de stockage
1 sysadmin vs 250 clusters de stockage
 
Migrer 3 millions de sites sans maitriser leur code source ? Impossible mais ...
Migrer 3 millions de sites sans maitriser leur code source ? Impossible mais ...Migrer 3 millions de sites sans maitriser leur code source ? Impossible mais ...
Migrer 3 millions de sites sans maitriser leur code source ? Impossible mais ...
 
Industrialize Machine Learning
Industrialize Machine Learning Industrialize Machine Learning
Industrialize Machine Learning
 
OVHcloud – Enterprise Cloud Databases
OVHcloud – Enterprise Cloud DatabasesOVHcloud – Enterprise Cloud Databases
OVHcloud – Enterprise Cloud Databases
 
OVHcloud Hosted Private Cloud Platform Network use cases with VMware NSX
OVHcloud Hosted Private Cloud Platform Network use cases with VMware NSXOVHcloud Hosted Private Cloud Platform Network use cases with VMware NSX
OVHcloud Hosted Private Cloud Platform Network use cases with VMware NSX
 

Dans les coulisses d'une infrastructure hautement disponible.

  • 1. 1 Dans les coulisses d’une infrastructure hautement disponible PG Day France – 19 Juin 2019
  • 2. 2 Auteur • Julien Riou • DBA depuis 2012 • Tech lead dans l’équipe databases à OVH depuis 2015 • pgterminate @ github PG Day France – 19 Juin 2019Auteur
  • 3. 3 Sommaire • Contexte • Haute disponibilité • Sauvegardes et restaurations • Business intelligence • Mises à jour • La suite PG Day France – 19 Juin 2019Sommaire
  • 4. 4PG Day France – 19 Juin 2019Contexte
  • 5. 5 Produits Cloud Serveurs dédiés VPS Public cloud Private cloud Stockage Web hosting Noms de domaine Hébergement web et sites Solutions E-mail SSL / CDN Office & Solutions Microsoft Platform Kubernetes Logs & Metrics Data Platforms Databases Big data AI & Machine Learning Télécom Offres Internet Téléphonie SMS / Fax Bureau virtuel OverTheBox PG Day France – 19 Juin 2019Contexte
  • 6. 6 Périmètre Bases internes 60 3000 700 400 Clusters Applications Utilisateurs Bases de données PG Day France – 19 Juin 2019Contexte
  • 7. 7 Réagir vite PG Day France – 19 Juin 2019Haute disponibilité
  • 8. 8 En cas de panne • Monitoring • Développeurs • Support • Twitter PG Day France – 19 Juin 2019Haute disponibilité
  • 9. 9 Cluster type • MySQL • PostgreSQL PG Day France – 19 Juin 2019Haute disponibilité
  • 10. 10 Promotion automatique • Patroni – Zalando – Opensource – Python PG Day France – 19 Juin 2019Haute disponibilité
  • 11. 11 Promotion Election de leader Passage en mode sécurité API Répartition de charge Gestion dynamique de la configuration Réplication Gestion automatique Reprise après panne PG Day France – 19 Juin 2019Haute disponibilité
  • 12. 12 Promotion PG Day France – 19 Juin 2019Haute disponibilité
  • 13. 13 Promotion PG Day France – 19 Juin 2019Haute disponibilité
  • 14. 14 Promotion PG Day France – 19 Juin 2019Haute disponibilité
  • 15. 15 Automatiser les opérations PG Day France – 19 Juin 2019Haute disponibilité
  • 16. 16 Réplication PG Day France – 19 Juin 2019Haute disponibilité
  • 17. 17 Réplication PG Day France – 19 Juin 2019Haute disponibilité
  • 18. 18 Réplication PG Day France – 19 Juin 2019Haute disponibilité
  • 19. 19 Réplication PG Day France – 19 Juin 2019Haute disponibilité
  • 20. 20 Réplication PG Day France – 19 Juin 2019Haute disponibilité
  • 21. 21 Rediriger le trafic PG Day France – 19 Juin 2019Haute disponibilité
  • 22. 22 Répartition de charge • HAProxy • Patroni API • confd PG Day France – 19 Juin 2019Haute disponibilité
  • 23. 23 HAProxy • Mode TCP • Probes HTTPS • 2 pools de connexion (= 2 ports) – Lectures et écritures – Lectures seules • Fichier d’état – server-state-base /var/lib/haproxy/state – socat ${sock} - <<< "show servers state ${backend}" > /var/lib/haproxy/state/${backend} PG Day France – 19 Juin 2019Haute disponibilité
  • 24. 24 Patroni API $ curl -i -X OPTIONS https://localhost:443/primary HTTP/1.0 200 OK $ curl -i -X OPTIONS https://localhost:443/replica HTTP/1.0 503 Service Unavailable PG Day France – 19 Juin 2019Haute disponibilité
  • 25. 25 confd Découvre les nodes01 Crée la configuration HAProxy 02 Vérifie la configuration HAProxy 03 Reload le service HAProxy04 PG Day France – 19 Juin 2019Haute disponibilité
  • 26. 26 Répartition de charge $ haproxyctl show health # pxname svname status weight stats FRONTEND OPEN stats BACKEND UP 0 read-write FRONTEND OPEN read-write node3 DOWN 10 read-write node1 DOWN 10 read-write node2 UP 10 read-write BACKEND UP 10 read-only FRONTEND OPEN read-only node3 DOWN 10 read-only node1 UP 10 read-only node2 DOWN 10 read-only BACKEND UP 10 PG Day France – 19 Juin 2019Haute disponibilité
  • 27. 27 Répartition de charge $ haproxyctl show health # pxname svname status weight stats FRONTEND OPEN stats BACKEND UP 0 read-write FRONTEND OPEN read-write node3 DOWN 10 read-write node1 DOWN 10 read-write node2 UP 10 read-write BACKEND UP 10 read-only FRONTEND OPEN read-only node3 DOWN 10 read-only node1 UP 10 read-only node2 DOWN 10 read-only BACKEND UP 10 PG Day France – 19 Juin 2019Haute disponibilité
  • 28. 28 Répartition de charge $ haproxyctl show health # pxname svname status weight stats FRONTEND OPEN stats BACKEND UP 0 read-write FRONTEND OPEN read-write node3 DOWN 10 read-write node1 DOWN 10 read-write node2 UP 10 read-write BACKEND UP 10 read-only FRONTEND OPEN read-only node3 DOWN 10 read-only node1 UP 10 read-only node2 DOWN 10 read-only BACKEND UP 10 PG Day France – 19 Juin 2019Haute disponibilité
  • 29. 29 Répartition de charge $ haproxyctl show health # pxname svname status weight stats FRONTEND OPEN stats BACKEND UP 0 read-write FRONTEND OPEN read-write node3 DOWN 10 read-write node1 DOWN 10 read-write node2 UP 10 read-write BACKEND UP 10 read-only FRONTEND OPEN read-only node3 DOWN 10 read-only node1 UP 10 read-only node2 DOWN 10 read-only BACKEND UP 10 PG Day France – 19 Juin 2019Haute disponibilité
  • 30. 30 Répartition de charge $ haproxyctl show health # pxname svname status weight stats FRONTEND OPEN stats BACKEND UP 0 read-write FRONTEND OPEN read-write node3 DOWN 10 read-write node1 DOWN 10 read-write node2 UP 10 read-write BACKEND UP 10 read-only FRONTEND OPEN read-only node3 DOWN 10 read-only node1 UP 10 read-only node2 DOWN 10 read-only BACKEND UP 10 PG Day France – 19 Juin 2019Haute disponibilité
  • 31. 31 Répartition de charge $ haproxyctl show backends stats BACKEND UP 0 read-write BACKEND UP 10 read-only BACKEND UP 10 PG Day France – 19 Juin 2019Haute disponibilité
  • 32. 32 IP virtuelle • keepalived/vrrp • iputils-arping • notify_master /usr/bin/arping -U -c 4 $IP PG Day France – 19 Juin 2019Haute disponibilité
  • 33. 33PG Day France – 19 Juin 2019Haute disponibilité
  • 34. 34 Promotion automatique Crédits : https://github.com/googlei18n/noto-emoji/blob/master/svg/emoji_u1f60c.svg PG Day France – 19 Juin 2019Haute disponibilité
  • 35. 35 Promotion automatique • Proxy non transparent – pg_hba.conf – Logs • Protocole PROXY • application_name PG Day France – 19 Juin 2019Haute disponibilité
  • 36. 36 (Re)Trouver ses données PG Day France – 19 Juin 2019Sauvegardes et restaurations
  • 37. 37 Sauvegardes et restaurations • Accident logique – DROP <objet> (DATABASE, ROLE, TABLE, …) • Accident physique (panne hardware) • Sauvegardes impactante (I/O, locks) • Compatibilité avec le reste de l’infrastructure • Pas de sauvegarde sans test de restauration PG Day France – 19 Juin 2019Sauvegardes et restaurations
  • 38. 38 Sauvegardes et restaurations PG Day France – 19 Juin 2019Sauvegardes et restaurations
  • 39. 39 Faciliter l’analyse PG Day France – 19 Juin 2019Business intelligence
  • 40. 40 Business intelligence • OLTP vs OLAP – OLTP (On-line Transaction Processing) – OLAP (On-line Analytical Processing) • Les deux charges ne vont pas ensemble • Comment ne pas bloquer le système operationel ? PG Day France – 19 Juin 2019Business intelligence
  • 41. 41 Business intelligence PG Day France – 19 Juin 2019Business intelligence
  • 42. 42 Avoir un système à jour PG Day France – 19 Juin 2019Mises à jour
  • 43. 43 Mises à jour mineures • clustershell $ clush -bw @patroni $ clush -bw @patroni&@cluster:69 $ clush –bw node1,node2,node3 Enter 'quit' to leave this interactive mode Working with nodes: node[1-3] clush> psql -c 'show server_version;' --------------- node[1-3] (3) --------------- server_version ---------------- 9.6.11 (1 row) PG Day France – 19 Juin 2019Mises à jour
  • 44. 44 Mises à jour mineures • clustershell $ clush –f 1 –bw node1,node2,node3 Enter 'quit' to leave this interactive mode Working with nodes: node[1-3] clush> apt-get upgrade -y PG Day France – 19 Juin 2019Mises à jour
  • 45. 45 Mises à jour mineures • clustershell $ clush –bw node1,node2,node3 Enter 'quit' to leave this interactive mode Working with nodes: node[1-3] clush> psql -c 'show server_version;' --------------- node[1-3] (3) --------------- server_version ---------------- 9.6.12 (1 row) PG Day France – 19 Juin 2019Mises à jour
  • 46. 46 2015 PostgreSQL 9.2 Debian Wheezy Migration applicative pg_dump 2017 PostgreSQL 9.4 Debian Jessie Logical Decoding Mises à jour majeures pg_upgrade PG Day France – 19 Juin 2019Mises à jour
  • 47. 47 2017 PostgreSQL 9.4 Debian Jessie Standalone pglogical pg_dump pg_upgrade 2019 PostgreSQL 9.6 Debian Stretch Patroni Mises à jour majeures PG Day France – 19 Juin 2019Mises à jour
  • 48. 48 pglogical • deadlocks ERROR: deadlock detected at character 237 DETAIL: Process 16477 waits for AccessShareLock on relation 17241 of database 17032; blocked by process 17333. Process 17333 waits for AccessExclusiveLock on relation 4920800 of database 17032; blocked by process 16477. Process 16477: <application query> Process 17333: SELECT pglogical.replication_set_add_all_tables('default', ARRAY['public']); HINT: See server log for query details. STATEMENT: <application query> PG Day France – 19 Juin 2019Mises à jour
  • 49. 49 pglogical • Charset • Non supporté (doc) ERROR: encoding conversion for binary datum not supported yet DETAIL: expected_encoding UTF8 must be unset or match server_encoding SQL_ASCII CONTEXT: slot "pgl_<slotname>", output plugin "pglogical_output", in the startup callback LOG: could not receive data from client: Connection reset by peer 4.13 Database encoding differences PGLogical does not support replication between databases with different encoding. We recommend using UTF-8 encoding in all replicated databases. PG Day France – 19 Juin 2019Mises à jour
  • 50. 50 pglogical • Séquences ERROR: duplicate key value violates unique constraint "table_pkey" PG Day France – 19 Juin 2019Mises à jour
  • 51. 51 pg_upgrade • Hardlinks (-k) • Statistiques $ vacuumdb --all --analyze-in-stages -j 10 PG Day France – 19 Juin 2019Mises à jour
  • 52. 52 pg_upgrade PG Day France – 19 Juin 2019Mises à jour
  • 53. 53 Conclusion PG Day France – 19 Juin 2019Conclusion
  • 54. 54 Conclusion Meilleure stabilitéMeilleure disponibilité Moins d’administrationMoins d’alertes PG Day France – 19 Juin 2019Conclusion
  • 55. 55 Réversibilité Haute disponibilité Élasticité Performance Managed Eat your own food Bases de données externes PG Day France – 19 Juin 2019Conclusion
  • 56. 56 Ensuite ? PG Day France – 19 Juin 2019La suite
  • 57. 57 La suite • Mise à jour vers PostgreSQL 12 • Mise à jour vers Debian 10 • Migration de MySQL vers PostgreSQL • Automatisation, automatisation, automatisation ! PG Day France – 19 Juin 2019La suite
  • 58. 58 On recrute • Opensource Database Engineers • Site Reliability Engineers (Private Cloud, Openstack, DNS, Deploy, Observability) • Software Engineers (containers, baremetal, web hosting) • Backend Developpers (Python, Go) • Et plus ! PG Day France – 19 Juin 2019La suite
  • 59. 59 Questions PG Day France – 19 Juin 2019