Multi-master, Active/active ClusterUsing Synchronous Replication
Galera Replication Plugin
Clients
WSREP APIWSREP APIWSREP API
MySQL MySQL MySQL
Galera is MySQL
● Replicates the InnoDB storage engine– all accumulated knowledge about InnoDB is applicable
– query tuning, server parameters, buffer sizes, all apply
● Compatible with existing MySQL clients and tools– XtraBackup
Galera Flavors
MySQL Community Edition + Galera →
Percona Server + Galera →
MariaDB + Galera →
● All use the same replication technology● All are fully open-source● All have excellent support
Galera is Flexible
● Can be single-master or multi-master– no need to redesign single-master applications to take advantage
– yet all nodes are equal when processing transactions
● Scales from one to one dozen nodes– multiple data centers and multiple nodes per data center
● Works with legacy MySQL replication– can be a master or a replica in standard asynchronous replication
– data can be shipped out to warehouses, backup, etc.
Galera in OpenStack
● Can be used as a back-end database for:– Keystone
– Glance
– Neutron
– Cinder
– Nova
● Keystone and Glance databases can be shared across regions
Galera in OpenStack
● Used by major companies:– MercadoLibre
– Time Warner Cable
– and more
● Used by multiple OpenStack vendors:– Mirantis, RedHat, etc.
What More Can Be Done?
● Additional benefits that Galera can provide to clouds– Geo-distribution
– Galera Cluster as a service to your user
Geo-distribution
node2
node1
Galera WAN Replication
● Galera works across and between continents– minimal latency penalty / number of messages exchanged
● No or minimal slave lag● Optimizations reduce cross-datacenter traffic
– updates are sent only once per datacenter
– new nodes get initial database from close neighbor
● Encryption with compression● Detection and automatic eviction of unreliable nodes
Geo-distribution And Scaling
node1
node4
node2
node3
Use Cases for Geo-distribution
● A global, single view for global data– Replicas are consistent, with minimal or no lag
● Increased data locality– Read queries can be answered by a local node
● Increased redundancy– break out from the availability zone silos
Galera-As-A-Service
● Benefits for both administrators and users– provides clear path to scale-out for users
– replacing traditional MySQL replication
Benefits to Administrators
● Simplified fail-over– no need to execute complex master promotion operations
● Easy cluster scale-out– new nodes are synchronized automatically
● Galera-aware monitoring tools are available– existing MySQL monitoring works too
● Various backup mechanisms– Xtrabackup
– A dedicated node for backup purposes
Benefits to End Users and Applications
● No need for read-write splitting– Instead of attempting to separate reads and writes, applications can
concentrate on proper transactional behavior
● Redundancy and scalability are built in– you can even start with a 1-node cluster and build it up from there
– MariaDB 10.1 contains Galera in the box
Benefits to End Users and Applications
● No need to think of in terms of masters, primaries, secondaries, etc.– the cluster can be viewed as one single entity
– a “symbolic” master can be designated, but not required
● Fail-over is trivial– no complicated procedure to promote a new master
Deployment and Automation
● Juju Charm– https://jujucharms.com/u/codership/galera-cluster/
● ClusterControl by SeveralNines● Ansible, Chef, etc. scripts● Tesora is working on Trove support
Juju Charmphilip@host-91-221-67-96:~/juju$ cat galera.yamlgalera-cluster: root-password: my-root-password sst-password: my-sst-password
philip@host-91-221-67-96:~/juju$ juju deploy --config galera.yaml \cs:~codership/galera-clusterAdded charm "cs:~codership/trusty/galera-cluster-4" to the environment.
philip@host-91-221-67-96:~/juju$ juju statusenvironment: amazonmachines: "0": agent-state: started agent-version: 1.22.3 dns-name: 54.91.110.84 instance-id: i-73516e8e instance-state: running series: trusty hardware: arch=amd64 cpu-cores=1 cpu-power=100 mem=1740M root-disk=8192M availability-zone=us-east-1a state-server-member-status: has-vote "1": agent-state: pending instance-id: i-f2db1d0d series: trusty hardware: arch=amd64 cpu-cores=1 cpu-power=100 mem=1740M root-disk=8192M availability-zone=us-east-1bservices: galera-cluster: charm: cs:~codership/trusty/galera-cluster-4 exposed: false relations: cluster: - galera-cluster units: galera-cluster/0: agent-state: allocating machine: "1"
philip@host-91-221-67-96:~$ juju status galera-clusterenvironment: amazonmachines: "1": agent-state: started agent-version: 1.22.3 dns-name: 54.162.183.83 instance-id: i-f2db1d0d instance-state: running series: trusty hardware: arch=amd64 cpu-cores=1 cpu-power=100 mem=1740M root-disk=8192M availability-zone=us-east-1bservices: galera-cluster: charm: cs:~codership/trusty/galera-cluster-4 exposed: false relations: cluster: - galera-cluster units: galera-cluster/0: agent-state: started agent-version: 1.22.3 machine: "1" public-address: 54.162.183.83
$ juju add-unit galera-cluster
$ juju status --format short galera-cluster
- galera-cluster/0: 54.162.183.83 (started)- galera-cluster/1: 54.147.2.106 (started)
$ juju ssh galera-cluster/0 mysql -uroot -pmy-root-password
mysql> show status like '%wsrep_cluster_size%';+--------------------+-------+| Variable_name | Value |+--------------------+-------+| wsrep_cluster_size | 2 |+--------------------+-------+1 row in set (0.00 sec)
$ juju expose galera-cluster
What is new in Galera 4.x
● Streaming Replication– large transactions are no longer a bottleneck
– distributed locking of hot rows across the cluster
– SELECT FOR UPDATE support will be possible
● Non-blocking DDL– DDL will lock tables like it does on single-node MySQL
● Better handling of failures due to inconsistency– option to shut down the cluster or continue
Top Related