SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
Architectures
haute disponibilité
   avec MySQL

    Architectures haute disponibilité avec MySQL MySQL
           Architectures haute disponibilité avec
       Olivier Olivier DASINI - http://dasini.net/blog
               DASINI - http://dasini.net/blog
                   Forum PHP 2008 2008
                         Forum PHP
Votre conférencier




Olivier DASINI
Consultant / Formateur certifié MySQL
Responsable du pôle bases de données d'ANASKA Alter Way
olivier.dasini@anaska.com


http://dasini.net/blog/



               Architectures haute disponibilité avec MySQL
                  Olivier DASINI - http://dasini.net/blog
                             Forum PHP 2008
Au menu...


●   Introduction à la haute disponibilité
●   MySQL replication
●   MySQL cluster
●   Shared disk clustering
●   Questions / Réponses




                 Architectures haute disponibilité avec MySQL
                    Olivier DASINI - http://dasini.net/blog
                               Forum PHP 2008
Introduction à la haute disponibilité


●   Définition
    –   Disponibilité = uptime/(uptime+downtime)
         –   90% => 36,5 jours/an || 99,9999% => 31 sec/an
●   Quel but
    –   Minimiser le downtime
         –   Redondance logicielle et/ou matérielle
●   Les termes
         –   Synchrone / Asynchrone
         –   Réplication / Cluster
         –   Shared disk / Shared nothing
                     Architectures haute disponibilité avec MySQL
                        Olivier DASINI - http://dasini.net/blog
                                   Forum PHP 2008
MySQL Replication




MySQL Replication




  Architectures haute disponibilité avec MySQL
     Olivier DASINI - http://dasini.net/blog
                Forum PHP 2008
MySQL Replication

                  Vue d’ensemble de la réplication

                                                                                                                                                             D   ELETE
                                                 UPDA
                                                     TE                                                                                              INSERT,

Client de mise à jour                                                                                                            Maître
                                                                                                                                                                                  Client de mise à jour
                                                                  UPDATE
                                  Log                             INSERT
                                  binaire                         DELETE
                                                             TE
                                                          LE
                                                                  UPD




                                                        DE
                                                    T
                                                 ER                                                                 UPD
                                                                     ATE




                                             S                                           UP                            ATE
                                          IN
                  Esclave             E
                                                                                            D   AT                         INSE
                                                                                                                                RT D                              Esclave
                                                                         INS




                                    AT                                                            E
                                                                                                      IN                             E   LET
                                  PD                                                                    SE                                  E
                                                                             ERT




                              U                                                                              RT
                                                                                                                  DE
                                                                                 D




                                                                                                                     LE
                                                                              ELE




                                                                                                                        TE
                                                  Esclave                                                                         Esclave
                                                                                  TE




                                                                                                                                                                            SE
              T
              C




                                                                                                                                                                            LE
          LE




                        SEL




                                                                                                                                                             CT
         SE




                                                                                                                                                                             CT
                                                                                                                                                             LE
                            ECT




                                                                                                                                                                                      Clients de lecture



                                                                                                                                                           SE
                                                                                                                                           SE
                                                                                SELECT




                                                                                                                             T




                                                                                                                                            LE
                                                                                                                             C
                                                                                                                       LE




                                                                                                                                                CT
                                                                                                                    SE




                                                           Architectures haute disponibilité avec MySQL
                                                              Olivier DASINI - http://dasini.net/blog
                                                                         Forum PHP 2008
MySQL Replication


●   Log binaire
●   Row based / Statement based
●   SET binlog_format = row | statement | mixed




                  Architectures haute disponibilité avec MySQL
                     Olivier DASINI - http://dasini.net/blog
                                Forum PHP 2008
MySQL Replication


        Détail de la réplication


 Application W



Serveur MySQL                                    Serveur MySQL
    Maître                                           esclave
                        SQL thread

                                             relaylog       .info
          binlog

                                IO thread




             Architectures haute disponibilité avec MySQL
                Olivier DASINI - http://dasini.net/blog
                           Forum PHP 2008
MySQL Replication


●   IO thread
       –   Récupère les informations du log binaire du
            maître et les copie dans le relay log
●   SQL thread
       –   Joue les requêtes du relay log sur l'esclave




                   Architectures haute disponibilité avec MySQL
                      Olivier DASINI - http://dasini.net/blog
                                 Forum PHP 2008
MySQL Replication
               Configuration du maître


●   Activer log binaire
●   Définir server-id
●   Utilisateur avec droit REPLICATION SLAVE
●   Faire une sauvegarde synchronisée avec les
    logs binaires
        –   mysqldump --master-data




                   Architectures haute disponibilité avec MySQL
                      Olivier DASINI - http://dasini.net/blog
                                 Forum PHP 2008
MySQL Replication
             Configuration de l'esclave


●   Définir server-id
●   Restaurer la sauvegarde
●   CHANGE MASTER TO
      MASTER_HOST='adresse_maitre',
      MASTER_USER='utilisateur_replication',
      MASTER_PORT= port,
      MASTER_LOG_FILE='log_binaire_maitre',
      MASTER_LOG_POS=position_ds_log_binaire_maitre;
●   SLAVE START;



                 Architectures haute disponibilité avec MySQL
                    Olivier DASINI - http://dasini.net/blog
                               Forum PHP 2008
MySQL Replication - Avantages


●   Simplicité
●   Natif dans MySQL
●   Stable
●   Possibilité d'utiliser SSL
●   Possibilité de mélanger différents moteurs




                 Architectures haute disponibilité avec MySQL
                    Olivier DASINI - http://dasini.net/blog
                               Forum PHP 2008
MySQL Replication - Inconvénients


●   Asynchrone
●   Pas de basculement automatique
●   Pas « scalable » en écriture
●   Le maître est le goulot d'étranglement
●   Le maître est SPOF
●   Load balancing non géré par MySQL




                 Architectures haute disponibilité avec MySQL
                    Olivier DASINI - http://dasini.net/blog
                               Forum PHP 2008
MySQL Replication - Avancée


●   Réplication circulaire
●   Changement de structure online
●   Mise à jour online
●   Mélanger différents moteurs de stockage
●   Différents réglages serveur
        –   delay_key_write (MyISAM)
        –   innodb_flush_log_at_trx_commit (InnoDB)
        –   sync_binlog (log binaire)
●   Différentes structures d'index

                     Architectures haute disponibilité avec MySQL
                        Olivier DASINI - http://dasini.net/blog
                                   Forum PHP 2008
MySQL Cluster




 MySQL Cluster




  Architectures haute disponibilité avec MySQL
     Olivier DASINI - http://dasini.net/blog
                Forum PHP 2008
MySQL Cluster




  Architectures haute disponibilité avec MySQL
     Olivier DASINI - http://dasini.net/blog
                Forum PHP 2008
MySQL Cluster – Les nœuds



●   Noeuds sql
        –   Serveur MySQL(en général) avec ndbcluster activé
        –   Autres: ndb_restore...
        –   Reçoivent les requêtes et renvoient les résultats à l'application
●   Noeuds de données
        –   Processus ndbd
        –   Stockage des données et index
●   Noeuds de gestion
        –   Processus ndb_mgmd
        –   Configuration (config.ini)
        –   Gestion (arrêt, redémarrage des nœuds, sauvegarde...)

                          Architectures haute disponibilité avec MySQL
                             Olivier DASINI - http://dasini.net/blog
                                        Forum PHP 2008
MySQL Cluster




●   Partitionnement
●   Réplication synchrone
●   Transactions
●   Shared nothing
●   No SPOF




                   Architectures haute disponibilité avec MySQL
                      Olivier DASINI - http://dasini.net/blog
                                 Forum PHP 2008
MySQL Cluster – Configuration



●   MySQL Cluster (avec le moteur ndb cluster SE ou CGE)
●   Créer le fichier de configuration (config.ini)
●   Démarrer le noeud de gestion
●   Démarrer les noeuds de données
●   Démarrer les noeuds sql




                       Architectures haute disponibilité avec MySQL
                          Olivier DASINI - http://dasini.net/blog
                                     Forum PHP 2008
MySQL Cluster – config.ini

[ndbd default]

NoOfReplicas= 2

DataDir= /var/lib/mysql-cluster

[ndb_mgmd]

Hostname= adresse_serveur_gestion

DataDir= /var/lib/mysql-cluster

[ndbd]

HostName= adresse_noeud_donnée_1

[ndbd]

HostName= adresse_noeud_donnée_2

[mysqld]

HostName= adresse_noeud_sql_1

[mysqld]




                             Architectures haute disponibilité avec MySQL
                                Olivier DASINI - http://dasini.net/blog
                                           Forum PHP 2008
MySQL Cluster – Avantages



●   Haute disponibilité
        –   Basculement automatique
        –   Sauvegarde à chaud
        –   Mise à jour à chaud
        –   Ajout de nœud sql à chaud
●   Faible coût
●   « Scalable » lecture & écriture
●   Shared Nothing
●   No SPOF

                   Architectures haute disponibilité avec MySQL
                      Olivier DASINI - http://dasini.net/blog
                                 Forum PHP 2008
MySQL Cluster – Inconvénients


●   Requêtes complexes
        –   Performances moindres avec plusieurs sous-requêtes,
              jointures...
●   Systèmes d'exploitation
        –   Pas de support MS Windows
●   MySQL 5.0.x
        –   Données & index nécessairement en RAM
●   MySQL 5.1.x
        –   Index nécessairement en RAM
●   Spécificités du moteur NDB
        –   Pas de fulltext, intégrité référentielle...
                     Architectures haute disponibilité avec MySQL
                        Olivier DASINI - http://dasini.net/blog
                                   Forum PHP 2008
Shared Disk Clustering




Shared Disk Clustering




     Architectures haute disponibilité avec MySQL
        Olivier DASINI - http://dasini.net/blog
                   Forum PHP 2008
Shared Disk Clustering




   Architectures haute disponibilité avec MySQL
      Olivier DASINI - http://dasini.net/blog
                 Forum PHP 2008
Shared Disk Clustering


●   Plusieurs machines partagent un même espace de
    stockage
        –   SAN (storage area network)
●   Connexion haut débit vers le système de stockage
        –   Fibre channel, iSCSI, ...
●   Un système est nécessaire pour vérifier l'état des
    noeuds et gérer le basculement
        –   Heartbeat, Linux HA,...




                    Architectures haute disponibilité avec MySQL
                       Olivier DASINI - http://dasini.net/blog
                                  Forum PHP 2008
Shared Disk Clustering Active-Passive



●   Un nœud est accessible (actif)
●   L'autre en attente (passif)
●   Le basculement est géré par un programme externe
●   Vérification des tables avant démarrage du passif
        –   MyISAM: myisamchk, --myisam-recover




                   Architectures haute disponibilité avec MySQL
                      Olivier DASINI - http://dasini.net/blog
                                 Forum PHP 2008
Shared Disk Clustering Active-Active



●   Tous les nœuds sont actif en même temps
●   Quelques limitations avec MySQL
        –   Seulement les tables MyISAM
        –   Problèmes liés aux caches(requêtes, index,...)
        –   ...




                     Architectures haute disponibilité avec MySQL
                        Olivier DASINI - http://dasini.net/blog
                                   Forum PHP 2008
Shared Disk Clustering – Avantages



●   Haute disponibilité
●   Assurance que les données sont les mêmes quelque
    soit le serveur
●   Supporte de grands volumes de données




                  Architectures haute disponibilité avec MySQL
                     Olivier DASINI - http://dasini.net/blog
                                Forum PHP 2008
Shared Disk Clustering – Inconvénients



●   Coût
●   SPOF
           –   Le système de stockage (en théorie)




                      Architectures haute disponibilité avec MySQL
                         Olivier DASINI - http://dasini.net/blog
                                    Forum PHP 2008
Questions ?




Architectures haute disponibilité avec MySQL
   Olivier DASINI - http://dasini.net/blog
              Forum PHP 2008

Weitere ähnliche Inhalte

Andere mochten auch

MySQL Day Paris 2016 - MySQL Enterprise Edition
MySQL Day Paris 2016 - MySQL Enterprise EditionMySQL Day Paris 2016 - MySQL Enterprise Edition
MySQL Day Paris 2016 - MySQL Enterprise EditionOlivier DASINI
 
Case Study: MySQL migration from latin1 to UTF-8
Case Study: MySQL migration from latin1 to UTF-8Case Study: MySQL migration from latin1 to UTF-8
Case Study: MySQL migration from latin1 to UTF-8Olivier DASINI
 
MySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMorgan Tocker
 
MySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB ClustersMySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB ClustersMatt Lord
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB ClusterMySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB ClusterOlivier DASINI
 
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud ServiceMySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud ServiceOlivier DASINI
 
MySQL Day Paris 2016 - State Of The Dolphin
MySQL Day Paris 2016 - State Of The DolphinMySQL Day Paris 2016 - State Of The Dolphin
MySQL Day Paris 2016 - State Of The DolphinOlivier DASINI
 
Migration d’annuaires propriétaires vers OpenLDAP : retours d’expérience et b...
Migration d’annuaires propriétaires vers OpenLDAP : retours d’expérience et b...Migration d’annuaires propriétaires vers OpenLDAP : retours d’expérience et b...
Migration d’annuaires propriétaires vers OpenLDAP : retours d’expérience et b...Clément OUDOT
 
JSS2013 : Haute disponibilité
JSS2013 : Haute disponibilitéJSS2013 : Haute disponibilité
JSS2013 : Haute disponibilitéChristophe Laporte
 
Haute Disponibilité et Tolérance de Panne
Haute Disponibilité et Tolérance de PanneHaute Disponibilité et Tolérance de Panne
Haute Disponibilité et Tolérance de PanneElior Boukhobza
 
Bases de données réparties
Bases de données répartiesBases de données réparties
Bases de données répartiesAbdelouahed Abdou
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentationVimlendu Kumar
 
Projet de fin d'études Plateforme de E-Insurance
Projet de fin d'études Plateforme de E-InsuranceProjet de fin d'études Plateforme de E-Insurance
Projet de fin d'études Plateforme de E-InsuranceYadh Krandel
 
Réplication des bases de données
Réplication des bases de donnéesRéplication des bases de données
Réplication des bases de donnéessie92
 
Administration Base de données Oracle
Administration Base de données OracleAdministration Base de données Oracle
Administration Base de données OracleAndrianaivo Lovatiana
 
MySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsMySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsJean-François Gagné
 

Andere mochten auch (20)

MySQL Day Paris 2016 - MySQL Enterprise Edition
MySQL Day Paris 2016 - MySQL Enterprise EditionMySQL Day Paris 2016 - MySQL Enterprise Edition
MySQL Day Paris 2016 - MySQL Enterprise Edition
 
Case Study: MySQL migration from latin1 to UTF-8
Case Study: MySQL migration from latin1 to UTF-8Case Study: MySQL migration from latin1 to UTF-8
Case Study: MySQL migration from latin1 to UTF-8
 
MySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMySQL Cloud Service Deep Dive
MySQL Cloud Service Deep Dive
 
MySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB ClustersMySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB Clusters
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB ClusterMySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
 
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud ServiceMySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
 
MySQL Day Paris 2016 - State Of The Dolphin
MySQL Day Paris 2016 - State Of The DolphinMySQL Day Paris 2016 - State Of The Dolphin
MySQL Day Paris 2016 - State Of The Dolphin
 
Haute disponibilité jss2012
Haute disponibilité jss2012Haute disponibilité jss2012
Haute disponibilité jss2012
 
Migration d’annuaires propriétaires vers OpenLDAP : retours d’expérience et b...
Migration d’annuaires propriétaires vers OpenLDAP : retours d’expérience et b...Migration d’annuaires propriétaires vers OpenLDAP : retours d’expérience et b...
Migration d’annuaires propriétaires vers OpenLDAP : retours d’expérience et b...
 
JSS2013 : Haute disponibilité
JSS2013 : Haute disponibilitéJSS2013 : Haute disponibilité
JSS2013 : Haute disponibilité
 
Haute Disponibilité et Tolérance de Panne
Haute Disponibilité et Tolérance de PanneHaute Disponibilité et Tolérance de Panne
Haute Disponibilité et Tolérance de Panne
 
Bases de données réparties
Bases de données répartiesBases de données réparties
Bases de données réparties
 
Oracle Data Guard
Oracle Data GuardOracle Data Guard
Oracle Data Guard
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentation
 
Projet de fin d'études Plateforme de E-Insurance
Projet de fin d'études Plateforme de E-InsuranceProjet de fin d'études Plateforme de E-Insurance
Projet de fin d'études Plateforme de E-Insurance
 
Data Guard Architecture & Setup
Data Guard Architecture & SetupData Guard Architecture & Setup
Data Guard Architecture & Setup
 
Réplication des bases de données
Réplication des bases de donnéesRéplication des bases de données
Réplication des bases de données
 
Oracle Cluster Rac
Oracle Cluster RacOracle Cluster Rac
Oracle Cluster Rac
 
Administration Base de données Oracle
Administration Base de données OracleAdministration Base de données Oracle
Administration Base de données Oracle
 
MySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsMySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitations
 

Mehr von Olivier DASINI

MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...Olivier DASINI
 
MySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsMySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsOlivier DASINI
 
MySQL Performance Best Practices
MySQL Performance Best PracticesMySQL Performance Best Practices
MySQL Performance Best PracticesOlivier DASINI
 
MySQL 8.0.22 - New Features Summary
MySQL 8.0.22 - New Features SummaryMySQL 8.0.22 - New Features Summary
MySQL 8.0.22 - New Features SummaryOlivier DASINI
 
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL Team
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL TeamMySQL Database Service - 100% Developed, Managed and Supported by the MySQL Team
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL TeamOlivier DASINI
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Olivier DASINI
 
MySQL 8.0.21 - New Features Summary
MySQL 8.0.21 - New Features SummaryMySQL 8.0.21 - New Features Summary
MySQL 8.0.21 - New Features SummaryOlivier DASINI
 
MySQL 8.0.19 - New Features Summary
MySQL 8.0.19 - New Features SummaryMySQL 8.0.19 - New Features Summary
MySQL 8.0.19 - New Features SummaryOlivier DASINI
 
MySQL 8.0.18 - New Features Summary
MySQL 8.0.18 - New Features SummaryMySQL 8.0.18 - New Features Summary
MySQL 8.0.18 - New Features SummaryOlivier DASINI
 
MySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features SummaryMySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features SummaryOlivier DASINI
 
MySQL 8.0.16 New Features Summary
MySQL 8.0.16 New Features SummaryMySQL 8.0.16 New Features Summary
MySQL 8.0.16 New Features SummaryOlivier DASINI
 
MySQL Day Paris 2018 - Introduction & The State of the Dolphin
MySQL Day Paris 2018 - Introduction & The State of the DolphinMySQL Day Paris 2018 - Introduction & The State of the Dolphin
MySQL Day Paris 2018 - Introduction & The State of the DolphinOlivier DASINI
 
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirements
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirementsMySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirements
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirementsOlivier DASINI
 
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0Olivier DASINI
 
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...Olivier DASINI
 
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreMySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreOlivier DASINI
 
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?Olivier DASINI
 
MySQL 8.0, what's new ? - Forum PHP 2018
MySQL 8.0, what's new ? - Forum PHP 2018MySQL 8.0, what's new ? - Forum PHP 2018
MySQL 8.0, what's new ? - Forum PHP 2018Olivier DASINI
 
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...Olivier DASINI
 
MySQL 8.0 - What's New ?
MySQL 8.0 - What's New ?MySQL 8.0 - What's New ?
MySQL 8.0 - What's New ?Olivier DASINI
 

Mehr von Olivier DASINI (20)

MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
 
MySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsMySQL Document Store for Modern Applications
MySQL Document Store for Modern Applications
 
MySQL Performance Best Practices
MySQL Performance Best PracticesMySQL Performance Best Practices
MySQL Performance Best Practices
 
MySQL 8.0.22 - New Features Summary
MySQL 8.0.22 - New Features SummaryMySQL 8.0.22 - New Features Summary
MySQL 8.0.22 - New Features Summary
 
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL Team
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL TeamMySQL Database Service - 100% Developed, Managed and Supported by the MySQL Team
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL Team
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0
 
MySQL 8.0.21 - New Features Summary
MySQL 8.0.21 - New Features SummaryMySQL 8.0.21 - New Features Summary
MySQL 8.0.21 - New Features Summary
 
MySQL 8.0.19 - New Features Summary
MySQL 8.0.19 - New Features SummaryMySQL 8.0.19 - New Features Summary
MySQL 8.0.19 - New Features Summary
 
MySQL 8.0.18 - New Features Summary
MySQL 8.0.18 - New Features SummaryMySQL 8.0.18 - New Features Summary
MySQL 8.0.18 - New Features Summary
 
MySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features SummaryMySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features Summary
 
MySQL 8.0.16 New Features Summary
MySQL 8.0.16 New Features SummaryMySQL 8.0.16 New Features Summary
MySQL 8.0.16 New Features Summary
 
MySQL Day Paris 2018 - Introduction & The State of the Dolphin
MySQL Day Paris 2018 - Introduction & The State of the DolphinMySQL Day Paris 2018 - Introduction & The State of the Dolphin
MySQL Day Paris 2018 - Introduction & The State of the Dolphin
 
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirements
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirementsMySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirements
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirements
 
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
 
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
 
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreMySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document Store
 
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
 
MySQL 8.0, what's new ? - Forum PHP 2018
MySQL 8.0, what's new ? - Forum PHP 2018MySQL 8.0, what's new ? - Forum PHP 2018
MySQL 8.0, what's new ? - Forum PHP 2018
 
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
 
MySQL 8.0 - What's New ?
MySQL 8.0 - What's New ?MySQL 8.0 - What's New ?
MySQL 8.0 - What's New ?
 

Architectures haute disponibilité avec MySQL

  • 1. Architectures haute disponibilité avec MySQL Architectures haute disponibilité avec MySQL MySQL Architectures haute disponibilité avec Olivier Olivier DASINI - http://dasini.net/blog DASINI - http://dasini.net/blog Forum PHP 2008 2008 Forum PHP
  • 2. Votre conférencier Olivier DASINI Consultant / Formateur certifié MySQL Responsable du pôle bases de données d'ANASKA Alter Way olivier.dasini@anaska.com http://dasini.net/blog/ Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 3. Au menu... ● Introduction à la haute disponibilité ● MySQL replication ● MySQL cluster ● Shared disk clustering ● Questions / Réponses Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 4. Introduction à la haute disponibilité ● Définition – Disponibilité = uptime/(uptime+downtime) – 90% => 36,5 jours/an || 99,9999% => 31 sec/an ● Quel but – Minimiser le downtime – Redondance logicielle et/ou matérielle ● Les termes – Synchrone / Asynchrone – Réplication / Cluster – Shared disk / Shared nothing Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 5. MySQL Replication MySQL Replication Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 6. MySQL Replication Vue d’ensemble de la réplication D ELETE UPDA TE INSERT, Client de mise à jour Maître Client de mise à jour UPDATE Log INSERT binaire DELETE TE LE UPD DE T ER UPD ATE S UP ATE IN Esclave E D AT INSE RT D Esclave INS AT E IN E LET PD SE E ERT U RT DE D LE ELE TE Esclave Esclave TE SE T C LE LE SEL CT SE CT LE ECT Clients de lecture SE SE SELECT T LE C LE CT SE Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 7. MySQL Replication ● Log binaire ● Row based / Statement based ● SET binlog_format = row | statement | mixed Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 8. MySQL Replication Détail de la réplication Application W Serveur MySQL Serveur MySQL Maître esclave SQL thread relaylog .info binlog IO thread Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 9. MySQL Replication ● IO thread – Récupère les informations du log binaire du maître et les copie dans le relay log ● SQL thread – Joue les requêtes du relay log sur l'esclave Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 10. MySQL Replication Configuration du maître ● Activer log binaire ● Définir server-id ● Utilisateur avec droit REPLICATION SLAVE ● Faire une sauvegarde synchronisée avec les logs binaires – mysqldump --master-data Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 11. MySQL Replication Configuration de l'esclave ● Définir server-id ● Restaurer la sauvegarde ● CHANGE MASTER TO MASTER_HOST='adresse_maitre', MASTER_USER='utilisateur_replication', MASTER_PORT= port, MASTER_LOG_FILE='log_binaire_maitre', MASTER_LOG_POS=position_ds_log_binaire_maitre; ● SLAVE START; Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 12. MySQL Replication - Avantages ● Simplicité ● Natif dans MySQL ● Stable ● Possibilité d'utiliser SSL ● Possibilité de mélanger différents moteurs Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 13. MySQL Replication - Inconvénients ● Asynchrone ● Pas de basculement automatique ● Pas « scalable » en écriture ● Le maître est le goulot d'étranglement ● Le maître est SPOF ● Load balancing non géré par MySQL Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 14. MySQL Replication - Avancée ● Réplication circulaire ● Changement de structure online ● Mise à jour online ● Mélanger différents moteurs de stockage ● Différents réglages serveur – delay_key_write (MyISAM) – innodb_flush_log_at_trx_commit (InnoDB) – sync_binlog (log binaire) ● Différentes structures d'index Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 15. MySQL Cluster MySQL Cluster Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 16. MySQL Cluster Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 17. MySQL Cluster – Les nœuds ● Noeuds sql – Serveur MySQL(en général) avec ndbcluster activé – Autres: ndb_restore... – Reçoivent les requêtes et renvoient les résultats à l'application ● Noeuds de données – Processus ndbd – Stockage des données et index ● Noeuds de gestion – Processus ndb_mgmd – Configuration (config.ini) – Gestion (arrêt, redémarrage des nœuds, sauvegarde...) Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 18. MySQL Cluster ● Partitionnement ● Réplication synchrone ● Transactions ● Shared nothing ● No SPOF Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 19. MySQL Cluster – Configuration ● MySQL Cluster (avec le moteur ndb cluster SE ou CGE) ● Créer le fichier de configuration (config.ini) ● Démarrer le noeud de gestion ● Démarrer les noeuds de données ● Démarrer les noeuds sql Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 20. MySQL Cluster – config.ini [ndbd default] NoOfReplicas= 2 DataDir= /var/lib/mysql-cluster [ndb_mgmd] Hostname= adresse_serveur_gestion DataDir= /var/lib/mysql-cluster [ndbd] HostName= adresse_noeud_donnée_1 [ndbd] HostName= adresse_noeud_donnée_2 [mysqld] HostName= adresse_noeud_sql_1 [mysqld] Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 21. MySQL Cluster – Avantages ● Haute disponibilité – Basculement automatique – Sauvegarde à chaud – Mise à jour à chaud – Ajout de nœud sql à chaud ● Faible coût ● « Scalable » lecture & écriture ● Shared Nothing ● No SPOF Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 22. MySQL Cluster – Inconvénients ● Requêtes complexes – Performances moindres avec plusieurs sous-requêtes, jointures... ● Systèmes d'exploitation – Pas de support MS Windows ● MySQL 5.0.x – Données & index nécessairement en RAM ● MySQL 5.1.x – Index nécessairement en RAM ● Spécificités du moteur NDB – Pas de fulltext, intégrité référentielle... Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 23. Shared Disk Clustering Shared Disk Clustering Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 24. Shared Disk Clustering Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 25. Shared Disk Clustering ● Plusieurs machines partagent un même espace de stockage – SAN (storage area network) ● Connexion haut débit vers le système de stockage – Fibre channel, iSCSI, ... ● Un système est nécessaire pour vérifier l'état des noeuds et gérer le basculement – Heartbeat, Linux HA,... Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 26. Shared Disk Clustering Active-Passive ● Un nœud est accessible (actif) ● L'autre en attente (passif) ● Le basculement est géré par un programme externe ● Vérification des tables avant démarrage du passif – MyISAM: myisamchk, --myisam-recover Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 27. Shared Disk Clustering Active-Active ● Tous les nœuds sont actif en même temps ● Quelques limitations avec MySQL – Seulement les tables MyISAM – Problèmes liés aux caches(requêtes, index,...) – ... Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 28. Shared Disk Clustering – Avantages ● Haute disponibilité ● Assurance que les données sont les mêmes quelque soit le serveur ● Supporte de grands volumes de données Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 29. Shared Disk Clustering – Inconvénients ● Coût ● SPOF – Le système de stockage (en théorie) Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008
  • 30. Questions ? Architectures haute disponibilité avec MySQL Olivier DASINI - http://dasini.net/blog Forum PHP 2008