Galera Cluster Documentation Releases 3.X and 4.X Codership Oy
Total Page:16
File Type:pdf, Size:1020Kb
Galera Cluster Documentation Releases 3.x and 4.x Codership Oy Sep 02, 2021 CONTENTS 1 Overview of Galera Cluster 3 2 Technical Description 7 2.1 Database Replication...........................................9 2.2 Certification-Based Replication..................................... 12 2.3 Replication API............................................. 14 2.4 Isolation Levels.............................................. 17 2.5 State Transfers.............................................. 19 2.6 Flow Control............................................... 22 2.7 Node Failure & Recovery........................................ 26 2.8 Quorum Components........................................... 28 2.9 Streaming Replication.......................................... 33 3 Installing Galera Cluster 37 3.1 Galera Cluster for MySQL—Binary Installation............................ 39 3.2 Galera Cluster for MySQL - Source Installation............................. 44 3.3 MariaDB Galera Cluster - Binary Installation.............................. 48 3.4 MariaDB Galera Cluster - Source Installation.............................. 51 3.5 Percona XtraDB Cluster - Binary Installation.............................. 55 3.6 Percona XtraDB Cluster - Source Installation.............................. 57 4 Galera Cluster Administration 63 4.1 Node Provisioning............................................ 66 4.2 State Snapshot Transfers......................................... 68 4.2.1 Logical State Snapshot..................................... 69 4.2.2 Physical State Snapshot..................................... 72 4.3 Scriptable State Snapshot Transfers................................... 74 4.4 Galera System Tables.......................................... 78 4.5 Schema Upgrades............................................ 81 4.6 Upgrading Galera Cluster........................................ 83 4.7 Recovering Primary Component..................................... 88 4.8 Resetting the Quorum.......................................... 90 4.9 Managing Flow Control......................................... 94 4.10 Auto-Eviction.............................................. 97 4.11 Using Streaming Replication....................................... 101 4.12 Galera Arbitrator............................................. 103 4.13 Backing Up Cluster Data......................................... 106 5 Deployment 109 5.1 Cluster Deployment Variants....................................... 110 i 5.2 Load Balancing.............................................. 116 5.2.1 HAProxy............................................ 117 5.2.2 Pen Load Balancer....................................... 119 5.2.3 Galera Load Balancer...................................... 121 5.3 Container Deployments......................................... 124 5.3.1 Using Docker.......................................... 125 5.3.2 Using Jails........................................... 129 6 Cluster Monitoring 135 6.1 Using Status Variables.......................................... 136 6.2 Database Server Logs.......................................... 142 6.3 The Galera Manager........................................... 144 6.3.1 Installing Galera Manager................................... 147 6.3.2 AWS Ports with Galera Manager................................ 154 6.3.3 Galera Manager End-User License Agreement (EULA).................... 158 6.3.4 Galera Manager Daemon (gmd)................................ 160 6.3.5 Deploying a Cluster in Galera Manager............................ 165 6.3.6 Adding Nodes with Galera Manager.............................. 173 6.3.7 Adding Users to Galera Manager................................ 180 6.3.8 Loading Initial Data....................................... 183 6.3.9 Monitoring a Cluster with Galera Manager........................... 189 6.3.10 Upgrading Galera Manager (gmd)............................... 197 6.4 Notification Command.......................................... 199 6.5 Notification Script Example....................................... 201 7 Security 205 7.1 Firewall Settings............................................. 206 7.1.1 Firewall Configuration with iptables ............................ 207 7.1.2 Firewall Configuration with FirewallD............................. 209 7.1.3 Firewall Configuration with PF................................. 211 7.2 SSL Settings............................................... 213 7.2.1 SSL Certificates......................................... 213 7.2.2 SSL Configuration....................................... 216 7.2.3 SSL for State Snapshot Transfers................................ 219 7.3 SELinux Configuration.......................................... 223 8 Reference 227 8.1 MySQL wsrep Options.......................................... 229 8.2 Galera Functions............................................. 258 8.3 Galera Parameters............................................ 261 8.3.1 Setting Galera Parameters in MySQL............................. 293 8.4 Galera Status Variables.......................................... 293 8.5 XtraBackup Parameters......................................... 319 8.6 Galera Load Balancer Parameters.................................... 326 8.7 Versioning Information.......................................... 336 8.8 Legal Notice............................................... 337 8.9 Glossary................................................. 338 Index 341 ii Galera Cluster Documentation, Releases 3.x and 4.x The Library • Documentation (page 1) • Knowledge Base • Training • Training Courses • Tutorial Articles • Training Videos • FAQ • search • Home • Docs (page 1) •KB • Training • FAQ This is the Codership Documentation. It documents the latest version of Galera Cluster, as well as related Galera tools, such as the Galera Arbitrator. It also includes, at times, information on features available in upcoming versions of Galera Cluster that haven’t been released yet. For such text, the new version number is noted. Installation & Configuration Database Replication (page 9) State Transfers (page 19) Replication API (page 14) Flow Control (page 22) Installing Galera Cluster (page 37) Node Failure & Recovery (page 26) Certification-Based Replication (page 12) Quorum Components (page 28) Isolation Levels (page 17) Streaming Replication (page 33) Administration Node Provisioning (page 66) Recovering Primary Component (page 88) State Snapshot Transfers (page 68) Resetting the Quorum (page 90) Scriptable State Snapshot Transfers (page 74) Managing Flow Control (page 94) Galera System Tables (page 78) Auto-Eviction (page 97) Schema Upgrades (page 81) Using Streaming Replication (page 101) Upgrading Galera Cluster (page 83) Backing Up Cluster Data (page 106) crash-recovery Deployment Load Balancing (page 116) Cluster Deployment Variants (page 110) Container Deployments (page 124) Galera Arbitrator (page 103) ldap-plugin pam-plugin CONTENTS 1 Galera Cluster Documentation, Releases 3.x and 4.x Monitoring Using Status Variables (page 136) Database Server Logs (page 142) The Galera Manager (page 144) Security (page 205) Notification Command (page 199) audit-log-plugin Reference MySQL wsrep Options (page 229) Galera Load Balancer Parameters (page 326) Galera Functions (page 258) XtraBackup Parameters (page 319) Galera Parameters (page 261) Galera System Tables (page 78) Galera Status Variables (page 293) Versioning Information (page 336) mariadb-options Miscellaneous Glossary (page 338) Legal Notice (page 337) genindex ../whats-new For resolving problems you might have with the software, you can also check our Knowledge Base. There you will find troubleshooting and best practices articles. You can also post questions on the Codership Forum. The community, as well as our staff monitor and respond to posts made there. If you need more immediate and personalized assistance, you can get a Support contract with us at Codership. For a quote on the cost of support, write us at [email protected] or use our on-line form to send us a message. The Library • Documentation (page 1) • Knowledge Base • Training • Training Courses • Tutorial Articles • Training Videos • FAQ • search • Home • Docs (page 1) •KB • Training • FAQ 2 CONTENTS CHAPTER ONE OVERVIEW OF GALERA CLUSTER Galera Cluster is a synchronous multi-master database cluster, based on synchronous replication and MySQL and InnoDB. When Galera Cluster is in use, database reads and writes can be directed to any node. Any individual node can be lost without interruption in operations and without using complex failover procedures. At a high level, Galera Cluster consists of a database server (i.e., MySQL or MariaDB) that uses the Galera Replication Plugin to manage replication. To be more specific, the MySQL replication plugin API has been extended to provide all the information and hooks required for true multi-master, synchronous replication. This extended API is called the Write-Set Replication API, or wsrep API. Through the wsrep API, Galera Cluster provides certification-based replication. A transaction for replication, the write-set not only contains the database rows to replicate, but also includes information on all of the locks that were held by the database during the transaction. Each node then certifies the replicated write-set against other write-sets in the applier queue. The write-set is then applied—if there are no conflicting locks. At this point, the transaction is considered committed, after which each node continues to apply it to the tablespace. This approach is also