24
Multi-master, Active/active Cluster Using Synchronous Replication

Do more with Galera Cluster in your OpenStack cloud

Embed Size (px)

Citation preview

Page 1: Do more with Galera Cluster in your OpenStack cloud

Multi-master, Active/active ClusterUsing Synchronous Replication

Page 2: Do more with Galera Cluster in your OpenStack cloud

Galera Replication Plugin

Clients

WSREP APIWSREP APIWSREP API

MySQL MySQL MySQL

Page 3: Do more with Galera Cluster in your OpenStack cloud

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

Page 4: Do more with Galera Cluster in your OpenStack cloud

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

Page 5: Do more with Galera Cluster in your OpenStack cloud

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.

Page 6: Do more with Galera Cluster in your OpenStack cloud

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

Page 7: Do more with Galera Cluster in your OpenStack cloud

Galera in OpenStack

● Used by major companies:– MercadoLibre

– Time Warner Cable

– and more

● Used by multiple OpenStack vendors:– Mirantis, RedHat, etc.

Page 8: Do more with Galera Cluster in your OpenStack cloud

What More Can Be Done?

● Additional benefits that Galera can provide to clouds– Geo-distribution

– Galera Cluster as a service to your user

Page 9: Do more with Galera Cluster in your OpenStack cloud

Geo-distribution

node2

node1

Page 10: Do more with Galera Cluster in your OpenStack cloud

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

Page 11: Do more with Galera Cluster in your OpenStack cloud

Geo-distribution And Scaling

node1

node4

node2

node3

Page 12: Do more with Galera Cluster in your OpenStack cloud

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

Page 13: Do more with Galera Cluster in your OpenStack cloud

Galera-As-A-Service

● Benefits for both administrators and users– provides clear path to scale-out for users

– replacing traditional MySQL replication

Page 14: Do more with Galera Cluster in your OpenStack cloud

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

Page 15: Do more with Galera Cluster in your OpenStack cloud

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

Page 16: Do more with Galera Cluster in your OpenStack cloud

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

Page 17: Do more with Galera Cluster in your OpenStack cloud

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

Page 18: Do more with Galera Cluster in your OpenStack cloud

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.

Page 19: Do more with Galera Cluster in your OpenStack cloud

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"

Page 20: Do more with Galera Cluster in your OpenStack cloud

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

Page 21: Do more with Galera Cluster in your OpenStack cloud

$ 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

Page 22: Do more with Galera Cluster in your OpenStack cloud
Page 23: Do more with Galera Cluster in your OpenStack cloud

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

Page 24: Do more with Galera Cluster in your OpenStack cloud

Thank you

Questions?

[email protected]