Why MySQL High Availability Matters

42

Transcript of Why MySQL High Availability Matters

Page 1: Why MySQL High Availability Matters
Page 2: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

WhyMySQLHighAvailabilityMaFersMaFLordMySQLProductManager@maFalord

Page 3: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

SafeHarborStatementThefollowingisintendedtooutlineourgeneralproductdirecNon.ItisintendedforinformaNonpurposesonly,andmaynotbeincorporatedintoanycontract.Itisnotacommitmenttodeliveranymaterial,code,orfuncNonality,andshouldnotberelieduponinmakingpurchasingdecisions.Thedevelopment,release,andNmingofanyfeaturesorfuncNonalitydescribedforOracle’sproductsremainsatthesolediscreNonofOracle.

3

Page 4: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

ProgramAgenda

4

HighAvailabilityExplained

NaNveMySQLHighAvailability

HighlyAvailableMySQLReferenceArchitectures

What’sComingNextforMySQLHAandScale?

1

2

3

4

Page 5: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

ProgramAgenda

5

HighAvailabilityExplained

NaNveMySQLHighAvailability

HighlyAvailableMySQLReferenceArchitectures

What’sComingNextforMySQLHAandScale?

1

2

3

4

Page 6: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

HighAvailability:TermsandConcepts• Availability

– OutageanddownNme– MeanTimeBetweenFailures(MTBF)– MeanTimeToRecover(MTTR)– ServiceLevelAgreement(SLA)– TheNine’sScale:5nines=5minsdownNmeperyear

• Capacity/Performance• Redundancy•  FaultTolerance• DisasterTolerance/Recovery

6

Page 7: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

HighAvailability:ConsideraNons•  SLArequirements

– WhatisneededtosupportyourbusinessobjecNves

• OperaNonalcapabiliNes– Willyouhavetheworkforcetoimplementandmaintainit

•  Serviceagility– Canitgrowandchangeasyourcompanydoes

•  Timetomarket– Canyougotomarketquickly

• Budgetaryconstraints– CostofdownNmeversuscostofHAimplementaNon

7

WhatToUse?

Page 8: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

HighAvailability:Factors•  Environment

– Redundantserversindifferentdatacentersandgeographicalareaswillprotectyouagainstregionalissues—powergridfailures,hurricanes,earthquakes,etc.

• Hardware– Eachpartofyourhardwarestack—networking,storage,servers—shouldberedundant

•  Sogware– Everylayerofthesogwarestackneedstobeduplicatedanddistributedacrossseparatehardwareandenvironments

• Data– Datalossandinconsistency/corrupNonmustbepreventedbyhavingmulNplecopiesofeachpieceofdata,withconsistencychecksandguaranteesforeachchange

8

Page 9: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

HighAvailability:DesignFactors• Reliability,Availability,andServiceability(RAS)

– Reliability•  Qualityhardwareandsogwarecomponentsthatyoucanmanageandtrust

– Availability• MulNplecopiesofeachdatumreplicatedtoseparatehardware• MulNplecopiesofeachpieceofthehardwareandsogwarestack• MulNplephysicallocaNons

– Separatepowergrids– Enoughphysicaldistancetosurvivedisasterssuchasfloods,earthquakes,andpowergridoutages

•  Resiliency– AutomaNontotransparentlydealwithanypotenNalfailureintheinfrastructure,hardware,sogware

– Serviceability•  Ensurethatyoucanmonitor,diagnose,maintain,andrepairitall

9

Page 10: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

HighAvailability:AcceptablePerformance• Performanceoutsideofacceptableboundsisunavailability

– DetermineyouracceptableapplicaNonresponseNmes– Ensurethatyoucanmeasureimpactfromeachlayerofstack– Determinefailureversusload

•  Scaleup/outorfailover

• BuildelasNcityintoeachlayer– QuicklyandeasilyscaleupanddowntohandlechangingloadandtrafficpaFerns

10

Page 11: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

HighAvailability:TheCausesofDownNme

11

40%

40%

20%

Sogware/ApplicaNon HumanError Hardware*Source:GartnerGroup1998survey

AstudybytheGartnerGroupprojectedthatthrough2015,80%ofdownNmewillbeduetopeopleandprocessissues

Page 12: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

HighAvailability:TheBusinessCostofDownNme• CalculateacostperminuteofdownNme

– Averagerevenuegeneratedper-minuteoverayear– CostofnotmeeNnganycustomerSLAs– FactorincoststhatarehardertoquanNfy1.  Revenue2.  ReputaNon3.  CustomersenNment4.  Stockprice5.  Service’ssuccess6.  Company’sveryexistence

12

THIS iswhyHAma;ers!

Page 13: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

HighAvailability:DatabaseNeeds• Managementinfrastructure

– Monitoringofstatus,health,performance•  FaciliNesforservicechanges,servicetransiNons

•  FailuredetecNonandhandling– IdenNfyandhandlefailures

•  ElasNcity– Scaleuptoensureacceptableperformanceisalwaysmaintained

• Consistencyguarantees– ConflictdetecNonandhandling;datalossprotecNon/prevenNon

• Onlinemaintenance

13

Page 14: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

• RecoveryTimeObjecNve– MaximumlengthofdownNmebeforethereisbreakin“businessconNnuity”

• RecoveryPointObjecNve– PointinNmetowhichdatamustberecoveredwhenserviceisre-established

Tier 1 •  Mission-critical services

Tier 2 •  Business-critical services

Tier 3 •  Task-critical services

Tier 4 •  Non-critical services

14

HighAvailability:DoesTheApplicaNonRequireIt?

Page 15: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLMaster/SlaveReplicaEon

Master/SlavewithAutomatedFailover

DRBD

OSorVMvendoracEve/passivesoluEons

MySQLGroupReplicaEon

HighAvailability:CommonMySQLSoluNons

9 9 . 9 9 9 %

15

ConEnuousAvailability

Page 16: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

ProgramAgenda

16

HighAvailabilityExplained

NaNveMySQLHighAvailability

HighlyAvailableMySQLReferenceArchitectures

What’sComingNextforMySQLHAandScale?

1

2

3

4

Page 17: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

C

B

A

C

B

ACRASH

C

B

A

NowBisthenewmaster

UhOh! It’sOK!

Amajorbuildingblockforhighavailability

WhatisReplicaNonUsedFor?

17

Page 18: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

GroupReplicaEon

18

AppServerswithMySQLRouter

MySQLGroupReplicaNon

“HighAvailabilitybecomesacorefirstclassfeatureofMySQL!”

Page 19: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLGroupReplicaNon:WhatIsIt?• GroupReplicaNonlibrary

– ImplementaNonofReplicatedDatabaseStateMachinetheory• MySQLGCSisbasedonPaxos(variantofMencius)

– ProvidesvirtuallysynchronousreplicaNonforMySQL5.7+– SupportedonallMySQLpla>orms

•  Linux,Windows,Solaris,OSX,FreeBSD“Mul?-masterupdateanywherereplica?onpluginforMySQLwithbuilt-inconflictdetec1onandresolu1on,automa1cdistributedrecovery,andgroupmembership.”

19

AppServerswithMySQLRouter

MySQLGroupReplicaNon

Page 20: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

•  AhighlyavailabledistributedMySQLdatabaseservice– Clusteringeliminatessinglepointsoffailure(SPOF)

•  Allowsforonlinemaintenance– Removestheneedformanuallyhandlingserverfail-over– Providesdistributedfaulttoleranceandself-healing– EnablesAcNve/AcNveupdateanywheresetups– AutomatesreconfiguraNon(adding/removingnodes,crashes,failures)– Makesiteasytoscaleup/downbasedondemand– AutomaNcallyensuresdataconsistency

•  Detectsandhandlesconflicts•  Preventsdataloss•  PreventsdatacorrupNon

20

MySQLGroupReplicaNon:WhatDoesItProvide?

Page 21: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLGroupReplicaNon:UseCases•  ElasEcReplicaEon

– EnvironmentsthatrequireaveryfluidreplicaNoninfrastructure,wherethenumberofservershastogroworshrinkdynamicallyandwithliFlepainaspossible.

• HighlyAvailableShards– Shardingisapopularapproachtoachievewritescale-out.UserscanuseMySQLGroupReplicaNontoimplementhighlyavailableshardsinafederatedsystem.EachshardcanmapintoaReplicaNonGroup.

• AlternaEvetoMaster-SlaveReplicaEon– ItmaybethatasinglemasterservermakesitasinglepointofcontenNon.WriNngtoanenNregroupmayprovemorescalableundercertaincircumstances.

21

Page 22: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLGroupReplicaNon:WhatSetsItApart?

•  BuiltbytheMySQLEngineeringTeam– NaNvelyintegratedintoServer:InnoDB,ReplicaNon,GTIDs,PerformanceSchema,SYS– Built-in,noneedforseparatedownloads– Availableonallplaxorms[Linux,Windows,Solaris,FreeBSD,etc]

•  BeFerperformancethansimilarofferings– MySQLGCShasopNmizednetworkprotocolthatreducestheimpactonlatency

•  Easiermonitoring– SimplePerformanceSchematablesforgroupandnodestatus/stats– NaNvesupportforGroupReplicaNoncomingtoMySQLEnterpriseMonitor

• ModernfullstackMySQLHAbeingbuiltaroundit– NaNveend-to-endeasytouseshardedInnoDBclusters

22

Page 23: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLGroupReplicaNon:Architecture

NodeTypesR:Trafficrouters/proxies:mysqlrouter,haproxy,sqlproxy,...M:mysqldnodesparNcipaNnginGroupReplicaNon

23

Page 24: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLGroupReplicaNon:Stack•  TheGroupReplicaNonpluginisresponsiblefor

– MaintainingdistributedexecuNoncontext– DetecNngandhandlingconflicts– Handlingdistributedrecovery

•  Detectmembershipchanges•  Donatestateifneeded•  Collectstateifneeded

– ProposingtransacNonstoothermembers– ReceivingandhandlingtransacNonsfromothermembers

– DecidingtheulNmatefateoftransacNons•  commitorrollback

24

GCSAPI

ReplicaEonPlugin

PluginAPI

MySQLServer

Group Comm. System (Corosync) GroupCom.Engine

Page 25: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLGroupReplicaNon:Stack•  TheGroupCommunicaNonSystemAPI:

– AbstractstheunderlyinggroupcommunicaNonsystemimplementaNonfromthepluginitself

– MapstheinterfacetoaspecificgroupcommunicaNonsystemimplementaNon

•  TheGroupCommunicaNonSystemengine:– VariantofPaxosdevelopedatMySQL– Buildingblocktoprovidedistributedagreementbetweenservers

25

GCSAPI

ReplicaEonPlugin

PluginAPI

MySQLServer

Group Comm. System (Corosync) GroupCom.Engine

Page 26: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLGroupReplicaNon:PerformanceComparison

26

Page 27: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLRouter

•  TransparentclientconnecNonrouNng– Loadbalancing– ApplicaNonconnecNonfailover

•  StatelessdesignofferseasyHAclientrouNng– AlocalRouterbecomespartoftheapplicaNonstack”MySQLRouterallowsyoutoeasilymigrateyourstandaloneMySQLinstancestona?velydistributedandhighlyavailableGroupReplica?onclusterswithoutaffec?ngexis?ngapplica?ons!”

27

TransparentAccesstoHADatabasesforMySQLApplicaEons

AppServerswithMySQLRouter

MySQLGroupReplicaNon

Page 28: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

ProgramAgenda

28

HighAvailabilityExplained

NaNveMySQLHighAvailability

HighlyAvailableMySQLReferenceArchitectures

What’sComingNextforMySQLHAandScale?

1

2

3

4

Page 29: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

HardwareandInfrastructureNotes

•  3,5,or7machinespergroup– Isolatemachineresourcesasmuchaspossible– LimitvirtualizaNonlayers– Machinesconfiguredfordedicateddatabaseserverrole

•  RecommendedconfiguraNon– 32-64vCPUswithfastCPUclock(2.5GHz+)– SSDs(fordataandreplicaNonlogs)

– HighqualitynetworkconnecNonbetweeneachmachine•  Lowlatency,highthroughput,reliable•  Limitroutersandhubsasmuchaspossible•  Isolatedanddedicatednetworkwhenpossible

29

Page 30: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

SharedNothingCluster–SingleDataCenter

30

ApplicaEonServers

MySQLRouterinStack

MySQLDatabaseServiceGroupReplicaEon

Page 31: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

SharedNothingCluster–CrossDataCenter

31

MySQLDatabaseServiceGroupReplicaEon

DataCenter1 DataCenter2

Clients

Page 32: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

GeographicallyRedundantCluster

32

AsyncReplicaEon

AcEveDataCenter BackupDataCenter

Clients

Page 33: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

AcNve/AcNveMulN-DataCenterSetup

33

AsyncReplicaEon

RegionalDataCenter RegionalDataCenter

RegionalClientsRegionalClients

Page 34: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

ProgramAgenda

34

HighAvailabilityExplained

NaNveMySQLHighAvailability

HighlyAvailableMySQLReferenceArchitectures

What’sComingNextforMySQLHAandScale?

1

2

3

4

Page 35: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.| 35

MySQLDocumentStore

RelaNonal&DocumentModels

MySQLHA

Out-Of-BoxHA

ReadScale-Out

AsyncReplicaNon+AutoFailover

WriteScale-Out

Sharding

S1

S2

S3

S4

*DownloadInnoDBClusterPreviewReleasefromlabs.mysql.com

Page 36: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLRouter:2.1• NaNvesupportforInnoDBclusters

– UnderstandsGroupReplicaNon(GR)topology– UNlizesmetadataschemastoredoneachmember

•  BootstrapsitselfandsetsupclientrouNngfortheGRcluster•  AllowsforintelligentclientrouNngintotheGRcluster•  SupportsmulN-masterandsingleprimarymodes

• Coreimprovements– Logging– Monitoring– Performance– Security

36

AppServerswithMySQLRouter

MySQLGroupReplicaNon

MySQLShellSetup,Manage,Orchestrate

labs.mysql.com

Page 37: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLShell

37

AsingleunifiedclientforalladministraEveandoperaEonstasks

AppServerswithMySQLRouter

MySQLGroupReplicaNon

MySQLShellSetup,Manage,Orchestrate

• MulN-Language:JavaScript,Python,andSQL– Naturallyscriptable

•  SupportsbothDocumentandRelaNonalmodels•  ExposesfullDevelopmentandAdminAPI”MySQLShellprovidesthedeveloperandDBAwithasingleintui?ve,flexible,andpowerfullinterfaceforallMySQLrelatedtasks!”

Page 38: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLShell:AdminAPI

• mysql-js>dba.help()•  Theglobalvariable'dba'isusedtoaccesstheMySQLAdminAPI

• PerformDBAoperaNons– ManageMySQLInnoDBclusters

•  Createclusters•  Getclusterinfo•  Start/StopMySQLInstances•  ValidateMySQLinstances•  …

DatabaseAdministraEonInterface

labs.mysql.com

AppServerswithMySQLRouter

MySQLGroupReplicaNon

MySQLShellSetup,Manage,Orchestrate

38

Page 39: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

MySQLEnterpriseMonitor• NaNveholisNcsupportforGroupReplicaNonclusters

– IntelligentmonitoringandalerNng– Topologyviews– Detailedmetricsandgraphs– BestPracNceadvice

• MonitoringofMySQLRouterinstances

39

Page 40: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

OracleCloud:MySQLCloudService• MySQLEnterpriseEdiNon• WebbasedconsoletomanageyourMySQLCloudinstances•  Self-ServiceProvisioning•  ElasNcScalability• MulN-LayeredSecurity• UnifiedCloudManagement• OraclePaaSandIaaSIntegraNon• PremierTechnicalSupportincluded

40

IntegratedHAandDRserviceopEons–uElizing

GroupReplicaEon–comingsoon!

Page 41: Why MySQL High Availability Matters

Copyright©2017,Oracleand/oritsaffiliates.Allrightsreserved.|

AlwaysOn,WithoutFail:MySQLGroupReplicaEonLuisSoares,MySQLReplicaNonTeamLead,Oracle

Tuesday,January17,2017at09:00AMPacificStandardTime

Registernow!

UpcomingWebinar

41

Page 42: Why MySQL High Availability Matters