SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
GaleraGalera
Master-MasterMaster-Master
ReplicationReplication
Marian HackMan Marinov <mm@1h.com>
What is the BinaryLog?
UPDATE t1 SET count=100 WHERE id=100UPDATE t1 SET count=100 WHERE id=100
CLIENTCLIENT
What is the BinaryLog?
UPDATE t1 SET count=100 WHERE id=100UPDATE t1 SET count=100 WHERE id=100
CLIENTCLIENT
What is the BinaryLog?
UPDATE t1 SET count=100 WHERE id=100UPDATE t1 SET count=100 WHERE id=100
CLIENTCLIENT
SUCCESS
What is the BinaryLog?
UPDATE t1 SET count=100 WHERE id=100UPDATE t1 SET count=100 WHERE id=100
CLIENTCLIENT
SUCCESS
Types of Replication
● STATEMENT
● ROW
● MIXED
● Master-Slave
● Master-Master
Types of Replication
● STATEMENT
UPDATE t1 SET count=100 WHERE id=100;UPDATE t1 SET count=100 WHERE id=100;
INSERT INTO t1 VALUES (102, 1);INSERT INTO t1 VALUES (102, 1);
Types of Replication
● ROW
table t1 change:table t1 change:
ROW id=100 count=100ROW id=100 count=100
table t1 change:table t1 change:
add row with id=102, count=1add row with id=102, count=1
Types of Replication
● MIXED
UPDATE t1 SET count=100 WHERE id=100;UPDATE t1 SET count=100 WHERE id=100;
table t1 change:table t1 change:
ROW id=100 count=100ROW id=100 count=100
INSERT INTO t1 VALUES (102, 1);INSERT INTO t1 VALUES (102, 1);
table t1 change:table t1 change:
add row with id=102, count=1add row with id=102, count=1
What is Galera
●
Write set replication - WSREPWrite set replication - WSREP
●
Global Transaction ID - GTIDGlobal Transaction ID - GTID
What is Galera
●
Write set replication - WSREPWrite set replication - WSREP
UPDATE t1 SET count=100 WHERE id=100;UPDATE t1 SET count=100 WHERE id=100;
INSERT INTO t1 VALUES (102, 1);INSERT INTO t1 VALUES (102, 1);
Write setWrite set
What is Galera
●
Write set replication - WSREPWrite set replication - WSREP
UPDATE t1 SET count=100 WHERE id=100;UPDATE t1 SET count=100 WHERE id=100;
INSERT INTO t1 VALUES (102, 1);INSERT INTO t1 VALUES (102, 1);
Write setWrite set
GTID: 318e70bb-4ba2-4707-aa5f-20cf44c3d367GTID: 318e70bb-4ba2-4707-aa5f-20cf44c3d367
What is Galera
●
Write set replication - WSREPWrite set replication - WSREP
UPDATE t1 SET count=100 WHERE id=100;UPDATE t1 SET count=100 WHERE id=100;
INSERT INTO t1 VALUES (102, 1);INSERT INTO t1 VALUES (102, 1);
Write setWrite set
GTID: 318e70bb-4ba2-4707-aa5f-20cf44c3d367GTID: 318e70bb-4ba2-4707-aa5f-20cf44c3d367
Certification based replication???Certification based replication???
● WSREP XXX-XXX
– certificate that it can proceed
– check based on table's primary key
How is it implemented?
How is it implemented?
How is it implemented?
● WSREP plugin
– backing up data
● logs and files
– conns between nodes
– generating GTIDs
– certification of WSETs
WSREP
How is it implemented?
Node states
● State Snapshot Transfer (SST)
– Logical - mysqldump
– Physical
● rsync/rsync_wan
● xtrabackup
wsrep_sst_method=xtrabackupv2
● Incremental State Transfer (IST)
5a76ef62-30ec-11e1-0800-dba504cf2aab:197222
5a76ef62-30ec-11e1-0800-dba504cf2aab:201913
– Write-set cache (GCache)
Requirements
● binlog_format=ROW
● Storage engine InnoDB/XtraDB
● All tables should have a primary key
Setup
/etc/yum.repos.d/galera.repo
[galera]
name = Galera
baseurl =
http://releases.galeracluster.com/centos/6/x86_64
gpgkey = http://releases.galeracluster.com/GPG-
KEY-galeracluster.com
gpgcheck = 1
Setup
yum install 
Percona-XtraDB-Cluster-server 
Percona-XtraDB-Cluster-client 
Percona-XtraDB-Cluster-galera-3.x86_64 
galera 
socat 
pv 
pigz 
nc
Setup
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
binlog_format=ROW
bind-address=0.0.0.0
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=0
innodb_buffer_pool_size=122M
Setup
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_provider_options="gcache.size=300M;gcache.p
age_size=300M"
wsrep_cluster_name="example_cluster"
wsrep_cluster_address="gcomm://10.19.1.8,10.19.1.9"
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth="root:ensurethehighest"
Setup
[sst]
progress=/var/log/mysql/sst.log
streamfmt=xbstream
transferfmt=socat
encrypt=2
encrypt-algo=AES256
tkey=/etc/mysql/key.pem
tcert=/etc/mysql/cert.pem
compressor="pigz -6"
decompressor="pigz -d"
First start
# mysql_install_db
# service mysql start --wsrep-new-cluster
Adding new node
● Add GRANTs for the new machine
– GRANT ALL ON *.* TO 'root'@'10.19.1.10' IDENTIFIED BY 'ensurethehighest';
● Copy the my.cnf from another node
● Fix the node_name and node_address
● Add the IP of the local node to cluster_address
● Start MySQL on the new node
● After the sync is done and the new node is in the cluster
– update the cluster_address in the configuration of the other nodes
– update the cluster_address in the running mysql instances:
mysql> set global wsrep_cluster_address =
'gcomm://10.19.1.8,10.19.1.9,10.19.1.10';
Arbitrator
# chkconfig garb on
# cat /etc/sysconfig/garb
GALERA_NODES="10.19.1.8:4567
10.19.1.9:4567 10.19.1.10:4567"
GALERA_GROUP="gp_cluster"
# /etc/init.d/garb restart
QUESTIONS???QUESTIONS???
Marian HackMan Marinov <mm@1h.com>

Contenu connexe

En vedette

En vedette (9)

Codership's galera cluster installation and quickstart webinar march 2016
Codership's galera cluster installation and quickstart webinar march 2016Codership's galera cluster installation and quickstart webinar march 2016
Codership's galera cluster installation and quickstart webinar march 2016
 
How to understand Galera Cluster - 2013
How to understand Galera Cluster - 2013How to understand Galera Cluster - 2013
How to understand Galera Cluster - 2013
 
Galera explained 3
Galera explained 3Galera explained 3
Galera explained 3
 
Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to Galera
 
Introduction to Galera Cluster
Introduction to Galera ClusterIntroduction to Galera Cluster
Introduction to Galera Cluster
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 
Galera Cluster: Synchronous Multi-Master Replication for MySQL HA
Galera Cluster: Synchronous Multi-Master Replication for MySQL HAGalera Cluster: Synchronous Multi-Master Replication for MySQL HA
Galera Cluster: Synchronous Multi-Master Replication for MySQL HA
 
Zero Downtime Schema Changes - Galera Cluster - Best Practices
Zero Downtime Schema Changes - Galera Cluster - Best PracticesZero Downtime Schema Changes - Galera Cluster - Best Practices
Zero Downtime Schema Changes - Galera Cluster - Best Practices
 
Galera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction Slides
 

Similaire à Galera replication

解决Ora 14098分区交换索引不匹配错误
解决Ora 14098分区交换索引不匹配错误解决Ora 14098分区交换索引不匹配错误
解决Ora 14098分区交换索引不匹配错误
maclean liu
 

Similaire à Galera replication (10)

Changing your huge table's data types in production
Changing your huge table's data types in productionChanging your huge table's data types in production
Changing your huge table's data types in production
 
OpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersOpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer Disasters
 
Fine-grained Processing of CVS Archives with APFEL
Fine-grained Processing of CVS Archives with APFELFine-grained Processing of CVS Archives with APFEL
Fine-grained Processing of CVS Archives with APFEL
 
解决Ora 14098分区交换索引不匹配错误
解决Ora 14098分区交换索引不匹配错误解决Ora 14098分区交换索引不匹配错误
解决Ora 14098分区交换索引不匹配错误
 
Optimizer Trace Walkthrough
Optimizer Trace WalkthroughOptimizer Trace Walkthrough
Optimizer Trace Walkthrough
 
OSA Con 2022 - Specifics of data analysis in Time Series Databases - Roman Kh...
OSA Con 2022 - Specifics of data analysis in Time Series Databases - Roman Kh...OSA Con 2022 - Specifics of data analysis in Time Series Databases - Roman Kh...
OSA Con 2022 - Specifics of data analysis in Time Series Databases - Roman Kh...
 
An Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL TriggersAn Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL Triggers
 
MySQL 5.6 GTID in a nutshell
MySQL 5.6 GTID in a nutshellMySQL 5.6 GTID in a nutshell
MySQL 5.6 GTID in a nutshell
 
View triggers pg_east_20110325
View triggers pg_east_20110325View triggers pg_east_20110325
View triggers pg_east_20110325
 
Dun ddd
Dun dddDun ddd
Dun ddd
 

Plus de Marian Marinov

Plus de Marian Marinov (20)

Dev.bg DevOps March 2024 Monitoring & Logging
Dev.bg DevOps March 2024 Monitoring & LoggingDev.bg DevOps March 2024 Monitoring & Logging
Dev.bg DevOps March 2024 Monitoring & Logging
 
Basic presentation of cryptography mechanisms
Basic presentation of cryptography mechanismsBasic presentation of cryptography mechanisms
Basic presentation of cryptography mechanisms
 
Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?
 
Introduction and replication to DragonflyDB
Introduction and replication to DragonflyDBIntroduction and replication to DragonflyDB
Introduction and replication to DragonflyDB
 
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQMessage Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
 
How to successfully migrate to DevOps .pdf
How to successfully migrate to DevOps .pdfHow to successfully migrate to DevOps .pdf
How to successfully migrate to DevOps .pdf
 
How to survive in the work from home era
How to survive in the work from home eraHow to survive in the work from home era
How to survive in the work from home era
 
Managing sysadmins
Managing sysadminsManaging sysadmins
Managing sysadmins
 
Improve your storage with bcachefs
Improve your storage with bcachefsImprove your storage with bcachefs
Improve your storage with bcachefs
 
Control your service resources with systemd
 Control your service resources with systemd  Control your service resources with systemd
Control your service resources with systemd
 
Comparison of-foss-distributed-storage
Comparison of-foss-distributed-storageComparison of-foss-distributed-storage
Comparison of-foss-distributed-storage
 
Защо и как да обогатяваме знанията си?
Защо и как да обогатяваме знанията си?Защо и как да обогатяваме знанията си?
Защо и как да обогатяваме знанията си?
 
Securing your MySQL server
Securing your MySQL serverSecuring your MySQL server
Securing your MySQL server
 
Sysadmin vs. dev ops
Sysadmin vs. dev opsSysadmin vs. dev ops
Sysadmin vs. dev ops
 
DoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKDoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDK
 
Challenges with high density networks
Challenges with high density networksChallenges with high density networks
Challenges with high density networks
 
SiteGround building automation
SiteGround building automationSiteGround building automation
SiteGround building automation
 
Preventing cpu side channel attacks with kernel tracking
Preventing cpu side channel attacks with kernel trackingPreventing cpu side channel attacks with kernel tracking
Preventing cpu side channel attacks with kernel tracking
 
Managing a lot of servers
Managing a lot of serversManaging a lot of servers
Managing a lot of servers
 
Let's Encrypt failures
Let's Encrypt failuresLet's Encrypt failures
Let's Encrypt failures
 

Dernier

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Dernier (20)

(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 

Galera replication