SlideShare a Scribd company logo
1 of 30
Migrating to XtraDB Cluster
Jay Janssen, MySQL Consulting Lead
Percona Live University, Toronto
March 22nd, 2013
Overview of Xtradb Cluster
• Percona Server 5.5 + Galera Codership sync repl
addon
• “Cluster of MySQL nodes”
– Have all the data, all the time
– Readable and writeable
• Established cluster:
– Synchronizes new nodes
– Handles node failures
– Handles Node resync
– Split brain protection (quorum)
Company Confidential December 2010
-2-
• Standard MySQL replication
– into or out of the cluster
• Write scalable to a point
– all writes still hit all nodes
• LAN/WAN architectures
– write latency ~1 RTT
• MyISAM experimental
– big list of caveats
– designed and built for Innodb
XtraDB Cluster FAQ
Company Confidential December 2010
-3-
• Is it production worthy?
– Several production users of Galera/PXC
– You should really evaluate your workload to see if it’s a
good fit for Galera/PXC
• What are the limitations of using Galera?
– http://www.codership.com/wiki/doku.php?id=limitations
What you really want to know
Company Confidential December 2010
-4-
CONFIGURING XTRADB CLUSTER
Company Confidential December 2010
-5-
• Configured via wsrep_provider_options
• Can be a separate network from mysqld
• Default cluster replication port is 4567 (tcp)
– Supports multicast
– Supports SSL
• Starting node needs to know one cluster node ip
– you can list all the nodes you know and it will find one
that is a member of the cluster
Cluster Replication Config
Company Confidential December 2010
-6-
• Outside of galera replication (gcomm)
• SST
– full state transfers
– Donor picked from running cluster, gives full backup to
joiner node
– Might be blocking (various methods allowed)
– default tcp 4444
• IST
– incremental state transfers
– default wsrep port + 1 (tcp 4568)
Other intra-cluster communication
Company Confidential December 2010
-7-
• [mysqld]
– wsrep_provider = /usr/lib64/libgalera_smm.so
– wsrep_cluster_name - Identify the cluster
– wsrep_cluster_address - Where to find the cluster
– srep_node_address - tell Galera what IP to use for
replication/SST/IST
– wsrep_sst_method - How to synchronize nodes
– binlog_format = ROW
– innodb_autoinc_lock_mode=2
– innodb_locks_unsafe_for_binlog=1 - performance
Essential Galera settings
Company Confidential December 2010
-8-
• [mysqld]
– wsrep_node_name - Identify this node
– wsrep_provider_options - cluster comm opts
• wsrep_provider_options="gcache.size=<gcache size>"
• http://www.codership.com/wiki/doku.php?id=galera_parameters
– wsrep_node_incoming_address=<node mysql IP>
– wsrep_slave_threads - apply writesets in parallel
• http://www.codership.com/wiki/doku.php?id=mysql_
options_0.8
Other Galera Settings
Company Confidential December 2010
-9-
1. [mysqld]
2. datadir=/var/lib/mysql
3. binlog_format=ROW
5. wsrep_cluster_name=trimethylxanthine
6. wsrep_cluster_address=gcomm://192.168.70.2,192.168.70.3,192.168.70.4
8. # Only use this before the cluster is formed
9. # wsrep_cluster_address=gcomm://
11. wsrep_node_name=percona1
12. wsrep_node_address=192.168.70.2
13. wsrep_provider=/usr/lib64/libgalera_smm.so
15. wsrep_sst_method=xtrabackup
16. wsrep_sst_auth=backupuser:password
18. wsrep_slave_threads=2
20. innodb_locks_unsafe_for_binlog=1
21. innodb_autoinc_lock_mode=2
23. innodb_buffer_pool_size=128M
24. innodb_log_file_size=64M
Example configuration
Company Confidential December 2010
-10-
CONVERTING STANDALONE
MYSQL TO XTRADB CLUSTER
Company Confidential December 2010
-11-
• Migrating a single server:
– stop MySQL
– replace the packages
– add essential Galera settings
– start MySQL
• A stateless, peerless node will form its own cluster
– if an empty cluster address is given (gcomm://)
• That node is the baseline data for the cluster
• Easiest from Percona Server 5.5
Method 1 - Single Node
Company Confidential December 2010
-12-
• All at once (with downtime):
– Stop all writes, stop all nodes
after replication is synchronized
– skip-slave-start / RESET SLAVE
– Start first node - initial cluster
– Start the others with
wsrep_sst_mode=skip
• The slaves will join the cluster,
skipping SST
• Change wsrep_sst_method !=
skip
Method 2 - Blanket changeover
Company Confidential December 2010
-13-
Method 2 - Blanket changeover
Company Confidential December 2010
-14-
• No downtime
– Form new cluster from one slave
– Node replicates from old master
• log-slave-updates on this node
– Test like any other slave
– Move more slave nodes to
cluster
– Cut writes over to the cluster
– Absorb master into cluster.
• Non-skip SST
OPERATIONAL CONSIDERATIONS
Company Confidential December 2010
-15-
• SHOW GLOBAL STATUS like ‘wsrep%’;
• Cluster integrity - same across all nodes
– wsrep_cluster_conf_id - configuration version
– wsrep_cluster_size - number of active nodes
– wsrep_cluster_status - should be Primary
• Node Status
– wsrep_ready - indicator that the node is healthy
– wsrep_local_state_comment - status message
– wsrep_flow_control_paused/sent - replication lag feedback
– wsrep_local_send_q_avg - possible network bottleneck
• http://www.codership.com/wiki/doku.php?id=monitoring
Monitoring
Company Confidential December 2010
-16-
Realtime Wsrep status
Company Confidential December 2010
-17-
Maintenance
Company Confidential December 2010
-18-
• Rolling package updates
• Schema changes
– potential for blocking the whole cluster
– Galera supports a rolling schema upgrade feature
• http://www.codership.com/wiki/doku.php?id=rolling_schema
_upgrade
• Isolates DDL to individual cluster nodes
• Won’t work if replication events become incompatible
– pt-online-schema-change
• Prefer IST over SST
– be sure you know when IST will and won’t work!
Architecture
Company Confidential December 2010
-19-
• How many nodes should I have?
– >= 3 nodes for quorum purposes
• 50% is not a quorum
– garbd - Galera Arbitrator Daemon
• Contributes as a voting node for
quorum
• Does not store data, but does
replicate
• What gear should I get?
– Writes as fast as your slowest node
– Standard MySQL + Innodb choices
– garbd could be on a cloud server
APPLICATION WORKLOADS
Company Confidential December 2010
-20-
How (Virtually) Synchronous Writes Work
Company Confidential December 2010
-21-
• Source node - pessimistic locking
– Innodb transaction locking
• Cluster repl - optimistic locking
– Before source returns commit:
• replicates to all nodes, GTID chosen
• source certifies
– PASS: source applies
– FAIL: source deadlock error (LCF)
– Other nodes
• receive, certify, apply (or drop)
• Certification deterministic on all nodes
– Apply can abort open trxs (BFA)
• First commit wins!
Why does the Application care?
Company Confidential December 2010
-22-
• Workload dependent!
• Write to all nodes simultaneously and evenly:
– Increase of deadlock errors on data hot spots
• Can be avoided by
– Writing to only one node at a time
• all pessimistic locking happens on one node
– Data subsets written only on a single node
• e.g., different databases, tables, rows, etc.
• different nodes can handle writes for different datasets
• pessimistic locking for that subset only on one node
Workloads that work best with Galera
Company Confidential December 2010
-23-
• Multi-node writing
– Low Data hotspots
– Auto-increment-offset/increment is ok
• Galera sets automatically by default
• Small transactions
– Expose serialization points in replication and certification
• Tables
– With PKs
– Innodb
– Avoid triggers, FKs, etc. -- supported, but problematic
APPLICATION  CLUSTER HA
Company Confidential December 2010
-24-
Application to Cluster Connects
Company Confidential December 2010
-25-
• For writes:
– Best practice: (any) single node
• For Reads:
– All nodes load-balanced
• Can be hashed to hit hot caches
• Geo-affinity for WAN setups
– Replication lag still possible, but minimal. Avoidable with
wsrep_causal_reads (session|global).
• Be sure to monitor that nodes are functioning
members of the cluster!
Load balancing and Node status
Company Confidential December 2010
-26-
• Health check:
– TCP 3306
– SHOW GLOBAL STATUS
• wsrep_ready = ON
• wsrep_local_state_comment !~ m/
Donor/?
• /usr/bin/clustercheck
• Maintain a separate rotations:
– Reads
• RR or Least Connected all available
– Writes
• Single node with backups on failure
Load Balancing Technologies
Company Confidential December 2010
-27-
• glbd - Galera Load Balancer
– similar to Pen, can utilize multiple cores
– http://www.codership.com/products/galera-loadbalancer
• HAProxy
– httpchk to monitor node status
– http://www.percona.com/doc/percona-xtradb-
cluster/haproxy.html
• Watch out for a lot of TIME_WAIT conns!
HAProxy Sample config
Company Confidential December 2010
-28-
1. # Random Reads connection (any node)
2. listen all *:3306
3. server db1 10.2.46.120:3306 check port 9200
4. server db2 10.2.46.121:3306 check port 9200
5. server db3 10.2.46.122:3306 check port 9200
7. # Writer connection (first available node)
8. listen writes *:4306
9. server db1 10.2.46.120:3306 track all/db1
10. server db2 10.2.46.121:3306 track all/db2 backup
11. server db3 10.2.46.122:3306 track all/db3 backup
Resources
Company Confidential December 2010
-29-
• XtraDB Cluster homepage and documentation:
– http://www.percona.com/software/percona-xtradbcluster/
• Galera Documentation:
– http://www.codership.com/wiki/doku.php
• PXC tutorial (self-guided or at a conference):
– https://github.com/jayjanssen/percona-xtradb-cluster-
tutorial
• http://www.mysqlperformanceblog.com/category/
xtradb-cluster/
THANK YOU
Jay Janssen
@jayjanssen
http://www.percona.com/software/percona-xtradb-cluster
Company Confidential December 2010
-30-

More Related Content

What's hot

Apache Cassandra multi-datacenter essentials
Apache Cassandra multi-datacenter essentialsApache Cassandra multi-datacenter essentials
Apache Cassandra multi-datacenter essentialsJulien Anguenot
 
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike SteenbergenMeet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergendistributed matters
 
Introduction to XtraDB Cluster
Introduction to XtraDB ClusterIntroduction to XtraDB Cluster
Introduction to XtraDB Clusteryoku0825
 
Percona XtraDB Cluster
Percona XtraDB ClusterPercona XtraDB Cluster
Percona XtraDB ClusterKenny Gryp
 
Galera explained 3
Galera explained 3Galera explained 3
Galera explained 3Marco Tusa
 
Pacemaker+DRBD
Pacemaker+DRBDPacemaker+DRBD
Pacemaker+DRBDDan Frincu
 
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte DataProblems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte DataJignesh Shah
 
Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?Frederic Descamps
 
合并到 XtraDB 存储引擎集群
合并到 XtraDB 存储引擎集群合并到 XtraDB 存储引擎集群
合并到 XtraDB 存储引擎集群YUCHENG HU
 
Percona XtraDB Cluster SF Meetup
Percona XtraDB Cluster SF MeetupPercona XtraDB Cluster SF Meetup
Percona XtraDB Cluster SF MeetupVadim Tkachenko
 
Cassandra EU 2012 - Storage Internals by Nicolas Favre-Felix
Cassandra EU 2012 - Storage Internals by Nicolas Favre-FelixCassandra EU 2012 - Storage Internals by Nicolas Favre-Felix
Cassandra EU 2012 - Storage Internals by Nicolas Favre-FelixAcunu
 
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Corporation
 
Maria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityOSSCube
 
Best practices for MySQL High Availability
Best practices for MySQL High AvailabilityBest practices for MySQL High Availability
Best practices for MySQL High AvailabilityColin Charles
 
Spil Storage Platform (Erlang) @ EUG-NL
Spil Storage Platform (Erlang) @ EUG-NLSpil Storage Platform (Erlang) @ EUG-NL
Spil Storage Platform (Erlang) @ EUG-NLThijs Terlouw
 
NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015Ivan Glushkov
 

What's hot (20)

Apache Cassandra multi-datacenter essentials
Apache Cassandra multi-datacenter essentialsApache Cassandra multi-datacenter essentials
Apache Cassandra multi-datacenter essentials
 
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike SteenbergenMeet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
 
PostgreSQL on Solaris
PostgreSQL on SolarisPostgreSQL on Solaris
PostgreSQL on Solaris
 
Introduction to XtraDB Cluster
Introduction to XtraDB ClusterIntroduction to XtraDB Cluster
Introduction to XtraDB Cluster
 
Percona XtraDB Cluster
Percona XtraDB ClusterPercona XtraDB Cluster
Percona XtraDB Cluster
 
Galera explained 3
Galera explained 3Galera explained 3
Galera explained 3
 
MySQL Sandbox 3
MySQL Sandbox 3MySQL Sandbox 3
MySQL Sandbox 3
 
Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wan
 
Pacemaker+DRBD
Pacemaker+DRBDPacemaker+DRBD
Pacemaker+DRBD
 
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte DataProblems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
 
Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?
 
合并到 XtraDB 存储引擎集群
合并到 XtraDB 存储引擎集群合并到 XtraDB 存储引擎集群
合并到 XtraDB 存储引擎集群
 
Percona XtraDB Cluster SF Meetup
Percona XtraDB Cluster SF MeetupPercona XtraDB Cluster SF Meetup
Percona XtraDB Cluster SF Meetup
 
How to understand Galera Cluster - 2013
How to understand Galera Cluster - 2013How to understand Galera Cluster - 2013
How to understand Galera Cluster - 2013
 
Cassandra EU 2012 - Storage Internals by Nicolas Favre-Felix
Cassandra EU 2012 - Storage Internals by Nicolas Favre-FelixCassandra EU 2012 - Storage Internals by Nicolas Favre-Felix
Cassandra EU 2012 - Storage Internals by Nicolas Favre-Felix
 
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly Available
 
Maria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High Availability
 
Best practices for MySQL High Availability
Best practices for MySQL High AvailabilityBest practices for MySQL High Availability
Best practices for MySQL High Availability
 
Spil Storage Platform (Erlang) @ EUG-NL
Spil Storage Platform (Erlang) @ EUG-NLSpil Storage Platform (Erlang) @ EUG-NL
Spil Storage Platform (Erlang) @ EUG-NL
 
NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015
 

Similar to Migrating to XtraDB Cluster

Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanSakari Keskitalo
 
Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanSakari Keskitalo
 
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-DeviceSUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-DeviceSUSE
 
Apache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutApache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutSander Temme
 
Cassandra
CassandraCassandra
Cassandraexsuns
 
SQL Server Clustering for Dummies
SQL Server Clustering for DummiesSQL Server Clustering for Dummies
SQL Server Clustering for DummiesMark Broadbent
 
Optimizing RocksDB for Open-Channel SSDs
Optimizing RocksDB for Open-Channel SSDsOptimizing RocksDB for Open-Channel SSDs
Optimizing RocksDB for Open-Channel SSDsJavier González
 
The Proto-Burst Buffer: Experience with the flash-based file system on SDSC's...
The Proto-Burst Buffer: Experience with the flash-based file system on SDSC's...The Proto-Burst Buffer: Experience with the flash-based file system on SDSC's...
The Proto-Burst Buffer: Experience with the flash-based file system on SDSC's...Glenn K. Lockwood
 
Buytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerBuytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerkuchinskaya
 
MySQL HA with Pacemaker
MySQL HA with  PacemakerMySQL HA with  Pacemaker
MySQL HA with PacemakerKris Buytaert
 
What no one tells you about writing a streaming app
What no one tells you about writing a streaming appWhat no one tells you about writing a streaming app
What no one tells you about writing a streaming apphadooparchbook
 
What No One Tells You About Writing a Streaming App: Spark Summit East talk b...
What No One Tells You About Writing a Streaming App: Spark Summit East talk b...What No One Tells You About Writing a Streaming App: Spark Summit East talk b...
What No One Tells You About Writing a Streaming App: Spark Summit East talk b...Spark Summit
 
Using Galera Cluster to Power Geo-distributed Applications on the WAN
Using Galera Cluster to Power Geo-distributed Applications on the WANUsing Galera Cluster to Power Geo-distributed Applications on the WAN
Using Galera Cluster to Power Geo-distributed Applications on the WANphilip_stoev
 
Benchmarking Solr Performance at Scale
Benchmarking Solr Performance at ScaleBenchmarking Solr Performance at Scale
Benchmarking Solr Performance at Scalethelabdude
 
MySQL Performance - Best practices
MySQL Performance - Best practices MySQL Performance - Best practices
MySQL Performance - Best practices Ted Wennmark
 
What's new in Jewel and Beyond
What's new in Jewel and BeyondWhat's new in Jewel and Beyond
What's new in Jewel and BeyondSage Weil
 
Bulk Loading into Cassandra
Bulk Loading into CassandraBulk Loading into Cassandra
Bulk Loading into CassandraBrian Hess
 

Similar to Migrating to XtraDB Cluster (20)

Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wan
 
Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wan
 
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-DeviceSUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
 
Apache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutApache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling Out
 
Cassandra
CassandraCassandra
Cassandra
 
SQL Server Clustering for Dummies
SQL Server Clustering for DummiesSQL Server Clustering for Dummies
SQL Server Clustering for Dummies
 
Optimizing RocksDB for Open-Channel SSDs
Optimizing RocksDB for Open-Channel SSDsOptimizing RocksDB for Open-Channel SSDs
Optimizing RocksDB for Open-Channel SSDs
 
Galera webinar migration to galera cluster from my sql async replication
Galera webinar migration to galera cluster from my sql async replicationGalera webinar migration to galera cluster from my sql async replication
Galera webinar migration to galera cluster from my sql async replication
 
The Proto-Burst Buffer: Experience with the flash-based file system on SDSC's...
The Proto-Burst Buffer: Experience with the flash-based file system on SDSC's...The Proto-Burst Buffer: Experience with the flash-based file system on SDSC's...
The Proto-Burst Buffer: Experience with the flash-based file system on SDSC's...
 
Buytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerBuytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemaker
 
Galera Cluster Best Practices for DBA's and DevOps Part 1
Galera Cluster Best Practices for DBA's and DevOps Part 1Galera Cluster Best Practices for DBA's and DevOps Part 1
Galera Cluster Best Practices for DBA's and DevOps Part 1
 
MySQL HA with Pacemaker
MySQL HA with  PacemakerMySQL HA with  Pacemaker
MySQL HA with Pacemaker
 
What no one tells you about writing a streaming app
What no one tells you about writing a streaming appWhat no one tells you about writing a streaming app
What no one tells you about writing a streaming app
 
What No One Tells You About Writing a Streaming App: Spark Summit East talk b...
What No One Tells You About Writing a Streaming App: Spark Summit East talk b...What No One Tells You About Writing a Streaming App: Spark Summit East talk b...
What No One Tells You About Writing a Streaming App: Spark Summit East talk b...
 
Using Galera Cluster to Power Geo-distributed Applications on the WAN
Using Galera Cluster to Power Geo-distributed Applications on the WANUsing Galera Cluster to Power Geo-distributed Applications on the WAN
Using Galera Cluster to Power Geo-distributed Applications on the WAN
 
Benchmarking Solr Performance at Scale
Benchmarking Solr Performance at ScaleBenchmarking Solr Performance at Scale
Benchmarking Solr Performance at Scale
 
MySQL Performance - Best practices
MySQL Performance - Best practices MySQL Performance - Best practices
MySQL Performance - Best practices
 
What's new in Jewel and Beyond
What's new in Jewel and BeyondWhat's new in Jewel and Beyond
What's new in Jewel and Beyond
 
Bulk Loading into Cassandra
Bulk Loading into CassandraBulk Loading into Cassandra
Bulk Loading into Cassandra
 
BigData Developers MeetUp
BigData Developers MeetUpBigData Developers MeetUp
BigData Developers MeetUp
 

Recently uploaded

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 

Recently uploaded (20)

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

Migrating to XtraDB Cluster

  • 1. Migrating to XtraDB Cluster Jay Janssen, MySQL Consulting Lead Percona Live University, Toronto March 22nd, 2013
  • 2. Overview of Xtradb Cluster • Percona Server 5.5 + Galera Codership sync repl addon • “Cluster of MySQL nodes” – Have all the data, all the time – Readable and writeable • Established cluster: – Synchronizes new nodes – Handles node failures – Handles Node resync – Split brain protection (quorum) Company Confidential December 2010 -2-
  • 3. • Standard MySQL replication – into or out of the cluster • Write scalable to a point – all writes still hit all nodes • LAN/WAN architectures – write latency ~1 RTT • MyISAM experimental – big list of caveats – designed and built for Innodb XtraDB Cluster FAQ Company Confidential December 2010 -3-
  • 4. • Is it production worthy? – Several production users of Galera/PXC – You should really evaluate your workload to see if it’s a good fit for Galera/PXC • What are the limitations of using Galera? – http://www.codership.com/wiki/doku.php?id=limitations What you really want to know Company Confidential December 2010 -4-
  • 5. CONFIGURING XTRADB CLUSTER Company Confidential December 2010 -5-
  • 6. • Configured via wsrep_provider_options • Can be a separate network from mysqld • Default cluster replication port is 4567 (tcp) – Supports multicast – Supports SSL • Starting node needs to know one cluster node ip – you can list all the nodes you know and it will find one that is a member of the cluster Cluster Replication Config Company Confidential December 2010 -6-
  • 7. • Outside of galera replication (gcomm) • SST – full state transfers – Donor picked from running cluster, gives full backup to joiner node – Might be blocking (various methods allowed) – default tcp 4444 • IST – incremental state transfers – default wsrep port + 1 (tcp 4568) Other intra-cluster communication Company Confidential December 2010 -7-
  • 8. • [mysqld] – wsrep_provider = /usr/lib64/libgalera_smm.so – wsrep_cluster_name - Identify the cluster – wsrep_cluster_address - Where to find the cluster – srep_node_address - tell Galera what IP to use for replication/SST/IST – wsrep_sst_method - How to synchronize nodes – binlog_format = ROW – innodb_autoinc_lock_mode=2 – innodb_locks_unsafe_for_binlog=1 - performance Essential Galera settings Company Confidential December 2010 -8-
  • 9. • [mysqld] – wsrep_node_name - Identify this node – wsrep_provider_options - cluster comm opts • wsrep_provider_options="gcache.size=<gcache size>" • http://www.codership.com/wiki/doku.php?id=galera_parameters – wsrep_node_incoming_address=<node mysql IP> – wsrep_slave_threads - apply writesets in parallel • http://www.codership.com/wiki/doku.php?id=mysql_ options_0.8 Other Galera Settings Company Confidential December 2010 -9-
  • 10. 1. [mysqld] 2. datadir=/var/lib/mysql 3. binlog_format=ROW 5. wsrep_cluster_name=trimethylxanthine 6. wsrep_cluster_address=gcomm://192.168.70.2,192.168.70.3,192.168.70.4 8. # Only use this before the cluster is formed 9. # wsrep_cluster_address=gcomm:// 11. wsrep_node_name=percona1 12. wsrep_node_address=192.168.70.2 13. wsrep_provider=/usr/lib64/libgalera_smm.so 15. wsrep_sst_method=xtrabackup 16. wsrep_sst_auth=backupuser:password 18. wsrep_slave_threads=2 20. innodb_locks_unsafe_for_binlog=1 21. innodb_autoinc_lock_mode=2 23. innodb_buffer_pool_size=128M 24. innodb_log_file_size=64M Example configuration Company Confidential December 2010 -10-
  • 11. CONVERTING STANDALONE MYSQL TO XTRADB CLUSTER Company Confidential December 2010 -11-
  • 12. • Migrating a single server: – stop MySQL – replace the packages – add essential Galera settings – start MySQL • A stateless, peerless node will form its own cluster – if an empty cluster address is given (gcomm://) • That node is the baseline data for the cluster • Easiest from Percona Server 5.5 Method 1 - Single Node Company Confidential December 2010 -12-
  • 13. • All at once (with downtime): – Stop all writes, stop all nodes after replication is synchronized – skip-slave-start / RESET SLAVE – Start first node - initial cluster – Start the others with wsrep_sst_mode=skip • The slaves will join the cluster, skipping SST • Change wsrep_sst_method != skip Method 2 - Blanket changeover Company Confidential December 2010 -13-
  • 14. Method 2 - Blanket changeover Company Confidential December 2010 -14- • No downtime – Form new cluster from one slave – Node replicates from old master • log-slave-updates on this node – Test like any other slave – Move more slave nodes to cluster – Cut writes over to the cluster – Absorb master into cluster. • Non-skip SST
  • 16. • SHOW GLOBAL STATUS like ‘wsrep%’; • Cluster integrity - same across all nodes – wsrep_cluster_conf_id - configuration version – wsrep_cluster_size - number of active nodes – wsrep_cluster_status - should be Primary • Node Status – wsrep_ready - indicator that the node is healthy – wsrep_local_state_comment - status message – wsrep_flow_control_paused/sent - replication lag feedback – wsrep_local_send_q_avg - possible network bottleneck • http://www.codership.com/wiki/doku.php?id=monitoring Monitoring Company Confidential December 2010 -16-
  • 17. Realtime Wsrep status Company Confidential December 2010 -17-
  • 18. Maintenance Company Confidential December 2010 -18- • Rolling package updates • Schema changes – potential for blocking the whole cluster – Galera supports a rolling schema upgrade feature • http://www.codership.com/wiki/doku.php?id=rolling_schema _upgrade • Isolates DDL to individual cluster nodes • Won’t work if replication events become incompatible – pt-online-schema-change • Prefer IST over SST – be sure you know when IST will and won’t work!
  • 19. Architecture Company Confidential December 2010 -19- • How many nodes should I have? – >= 3 nodes for quorum purposes • 50% is not a quorum – garbd - Galera Arbitrator Daemon • Contributes as a voting node for quorum • Does not store data, but does replicate • What gear should I get? – Writes as fast as your slowest node – Standard MySQL + Innodb choices – garbd could be on a cloud server
  • 21. How (Virtually) Synchronous Writes Work Company Confidential December 2010 -21- • Source node - pessimistic locking – Innodb transaction locking • Cluster repl - optimistic locking – Before source returns commit: • replicates to all nodes, GTID chosen • source certifies – PASS: source applies – FAIL: source deadlock error (LCF) – Other nodes • receive, certify, apply (or drop) • Certification deterministic on all nodes – Apply can abort open trxs (BFA) • First commit wins!
  • 22. Why does the Application care? Company Confidential December 2010 -22- • Workload dependent! • Write to all nodes simultaneously and evenly: – Increase of deadlock errors on data hot spots • Can be avoided by – Writing to only one node at a time • all pessimistic locking happens on one node – Data subsets written only on a single node • e.g., different databases, tables, rows, etc. • different nodes can handle writes for different datasets • pessimistic locking for that subset only on one node
  • 23. Workloads that work best with Galera Company Confidential December 2010 -23- • Multi-node writing – Low Data hotspots – Auto-increment-offset/increment is ok • Galera sets automatically by default • Small transactions – Expose serialization points in replication and certification • Tables – With PKs – Innodb – Avoid triggers, FKs, etc. -- supported, but problematic
  • 24. APPLICATION  CLUSTER HA Company Confidential December 2010 -24-
  • 25. Application to Cluster Connects Company Confidential December 2010 -25- • For writes: – Best practice: (any) single node • For Reads: – All nodes load-balanced • Can be hashed to hit hot caches • Geo-affinity for WAN setups – Replication lag still possible, but minimal. Avoidable with wsrep_causal_reads (session|global). • Be sure to monitor that nodes are functioning members of the cluster!
  • 26. Load balancing and Node status Company Confidential December 2010 -26- • Health check: – TCP 3306 – SHOW GLOBAL STATUS • wsrep_ready = ON • wsrep_local_state_comment !~ m/ Donor/? • /usr/bin/clustercheck • Maintain a separate rotations: – Reads • RR or Least Connected all available – Writes • Single node with backups on failure
  • 27. Load Balancing Technologies Company Confidential December 2010 -27- • glbd - Galera Load Balancer – similar to Pen, can utilize multiple cores – http://www.codership.com/products/galera-loadbalancer • HAProxy – httpchk to monitor node status – http://www.percona.com/doc/percona-xtradb- cluster/haproxy.html • Watch out for a lot of TIME_WAIT conns!
  • 28. HAProxy Sample config Company Confidential December 2010 -28- 1. # Random Reads connection (any node) 2. listen all *:3306 3. server db1 10.2.46.120:3306 check port 9200 4. server db2 10.2.46.121:3306 check port 9200 5. server db3 10.2.46.122:3306 check port 9200 7. # Writer connection (first available node) 8. listen writes *:4306 9. server db1 10.2.46.120:3306 track all/db1 10. server db2 10.2.46.121:3306 track all/db2 backup 11. server db3 10.2.46.122:3306 track all/db3 backup
  • 29. Resources Company Confidential December 2010 -29- • XtraDB Cluster homepage and documentation: – http://www.percona.com/software/percona-xtradbcluster/ • Galera Documentation: – http://www.codership.com/wiki/doku.php • PXC tutorial (self-guided or at a conference): – https://github.com/jayjanssen/percona-xtradb-cluster- tutorial • http://www.mysqlperformanceblog.com/category/ xtradb-cluster/