69
MySQL for PCF ® Version 2.1 User's Guide © Copyright Pivotal Software Inc, 2013-present

© Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

MySQL for PCF®

Version 2.1

User's Guide

© Copyright Pivotal Software Inc, 2013-present

Page 2: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

23579

13152334364143456064656768

Table of ContentsTable of ContentsMySQL for Pivotal Cloud FoundryOverview of MySQL for PCF v2.1Release NotesOn-Demand Service ArchitectureMySQL for PCF Recommended Usage and LimitationsInstalling and Configuring MySQL for PCFBacking Up and Restoring On-Demand MySQL for PCFControlling Resource UseMonitoring and KPIs for On-Demand MySQL for PCFEvents that Interrupt ServiceUpgrading MySQL for PCFTroubleshooting MySQL for PCFUsing MySQL for PCFCustomizing MySQL for PCFMigrating a Database to MySQL for PCF v2MySQL Environment VariablesTroubleshooting Instances

© Copyright Pivotal Software Inc, 2013-2018 2 2.1

Page 3: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

MySQLforPivotalCloudFoundryThisguidedescribessettingupandusingMySQLforPivotalCloudFoundry(PCF)asanon-demandservice.

AboutMySQLforPCFMySQLforPCFenablesPCFappdeveloperstoprovisionanduseaMySQLdatabasewithasinglecommand.

MySQLforPCFv2introducesanewtypeofservice,anon-demandservice.MySQLforPCFv2offersanalternativetothepre-provisionedservicethatwasinthev1.xseries.

Thistablesummarizesthemaindifferencesbetweenthetwo:

AvailableSince VMsitRunsOn HowVMsareCreated MetricsName

Prefix

On-DemandService

Newforv2

DedicatedVMthatservesasingleserviceinstance

PCFcreateseachVMon-demandwhenappdevelopercreatesserviceinstance

p.mysql (withadot)

Pre-ProvisionedService v1.4

Multi-tenantVMssharedbyappsacrossPCFdeployment

PCFcreatesallVMswhenoperatordeploysorupdatesservice

p-mysql (withadash)

ProductSnapshotThefollowingtableprovidesversionandversion-supportinformationaboutMySQLforPCF.

Element Details

Version v2.1.5

Releasedate May8,2018

Softwarecomponentversion PerconaServerv5.7.20–21

CompatibleOpsManagerversion(s) v1.11.xandv1.12.x

CompatibleElasticRuntimeversion(s) v1.11.xandv1.12.x

IaaSsupport AWS,Azure,GCP,OpenStack,andvSphere

OverviewTheMySQLforPCFproductdeliversdedicatedinstancesondemand,“DatabaseasaService”,toCloudFoundryusers.Wheninstalled,thetiledeploysandmaintainsasingleServiceBrokerthatisresponsibleforCloudFoundryintegration.Theserviceisconfiguredwithsanedefaults,followingtheprincipleofleastsurpriseforageneral-userelationaldatabaseservice.

FormoreinformationaboutMySQLforPCFv2.1,seeMinorOverview.

MySQLforPCFandOtherPCFServicesSomePCFservicesofferon-demandserviceplans.Theseplansletdevelopersprovisionserviceinstanceswhentheywant.

Thesecontrastwiththemorecommonpre-provisionedserviceplans,whichrequireoperatorstoprovisiontheserviceinstancesduringinstallationandconfigurationthroughtheservicetileUI.

ThefollowingPCFservicesofferon-demandserviceplans:

MySQLforPCFv2.0andlater

Note:ThisdocumentsMySQLforPCFv2.1,anon-demandservicethatcreatesdedicated,single-tenantserviceinstancesdynamically.Fortheolder,pre-provisionedservice,seethev1.10documentation orselectv1.10fromthedropdownabove.

© Copyright Pivotal Software Inc, 2013-2018 3 2.1

Page 4: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

RabbitMQforPCF

RedisforPCF

PivotalCloudCache(PCC)

Theseservicespackageanddelivertheiron-demandserviceofferingsdifferently.Forexample,someservices,likeRedisforPCF,haveonetile,andyouconfigurethetiledifferentlydependingonwhetheryouwanton-demandserviceplansorpre-provisionedserviceplans.

Forotherservices,likePCC,youinstallonetileforon-demandserviceplansandadifferenttileforpre-provisionedserviceplans.

ThefollowingtablelistsandcontraststhedifferentwaysthatPCFservicespackageon-demandandpre-provisionedserviceofferings.

PCFservicetile Standaloneproductrelatedtotheservice Versionssupportingondemand Versionssupportingpre-provisioned

RabbitMQforPCF PivotalRabbitMQ v1.8andlater Allversions

RedisforPCF Redis v1.8andlater Allversions

MySQLforPCF MySQLv2.x(basedonPerconaServer)

v1.x(basedonMariaDBandGalera)

PCC PivotalGemFire Allversions NA

GemFireforPCF PivotalGemFire NA Allversions

FeedbackPleaseprovideanybugs,featurerequests,orquestionstothePivotalCloudFoundryFeedbacklist.

© Copyright Pivotal Software Inc, 2013-2018 4 2.1

Page 5: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

OverviewofMySQLforPCFv2.1ThistopicdescribesthesignificantnewfeaturesinMySQLforPCFv2.1.ThistopicalsopresentsachecklistthatyoucanusetodecideifMySQLforPCFisreadytomeetyourbusinessrequirements.

IntroductionMySQLforPCFv2introducestheOn-DemandService,whichprovidesdedicatedinstancesofMySQLthatAppDeveloperscanprovisionon-demandfromthecommandline.TheMySQLforPCFOn-DemandserviceisdesignedtoimprovetheflexibilityinhowandwheninstancesareprovisionedandallowsformoreefficientandseamlessresourceuseforbothOperatorandAppDeveloper.Additionally,bothOperatorandAppDevelopercanconfigureessentialMySQLsettings.MySQLforPCFv2canbeinstalledalongsidetheearlierMySQLforPCFv1.xtiles.

MySQLforPCF’sOn-DemandServiceleveragestheon-demandservicebroker .

OnDemandServicePlanDescriptionsPCFMySQLoffersfiveon-demandplansasthe p.mysql servicewithinthePCFMySQLtile.Theplanscanbeconfiguredinanywaythatyouseefit.However,plansshouldbeconfiguredsuchthattheyincreaseinsize.

Foreachserviceplan,theoperatorcanconfigurethePlanname,Plandescription,ServerVMtypeandServerDisktype,orchoosetodisabletheplancompletely.

Operatorscanupdatecertainplansettingsaftertheplanshavebeencreated.IftheOperatorupdatestheVMsizeordisksizethesesettingswillbeimplementedinallinstancesalreadycreated.OperatorsshouldnotdownsizetheVMsordisksizeasthiscancausedatalossinpre-existinginstances.

Enterprise-ReadyChecklistReviewthefollowingtabletodetermineifMySQLforPCFv2hasthefeaturesneededtosupportyourenterprise.

PlansandInstances MoreInformation

On-Demand,Dedicated-VMplans

MySQLforPCFprovidesOn-DemandVMplans Architecture

Customizable

plansFortheOn-DemandPlan,theoperatorcancustomizetheVM,disksize,andavailabilityzone. Configuring

InstallationandUpgrades MoreInformation

ProductupgradesMySQLforPCFcanbeupgradedwithinthev2.xtileseries.Additionally,itcanbeinstalledalongsidetheMySQLforPCFv1.Xtilestoenableeasymanualmigrations

UpgradingMySQLforPCF

DeploymentSmokeTests

MySQLforPCFinstallationandupgraderunsapostdeploymentBOSHerrandthatvalidatesbasicMySQLoperations

MaintenanceandBackups MoreInformation

OperationalMonitoringandLogging

MySQLforPCFv2providesmetricsformonitoringOn-Demandplanusageandquotas,aswellasMySQLsystemmetrics.Additionally,MySQLforPCFprovidessyslogredirectiontoexternallogingestors.

MonitoringMySQLforPCF

BackupandRestore

MySQLforPCFv2includesautomaticbackupsonaconfigurablescheduletoavarietyofdestinations,aswellasasimplerestoreprocess.

ManualBackupandRestoreofMySQLforPCF

ScaleandAvailability MoreInformation

On-DemandPlan MySQLforPCFprovidesupto50on-demandinstancesacrossallplans

AbilitytoScaleUp/Down

OperatorscanscaleVMsup,butnotdown Configuring

RollingDeployments

MySQLforPCFdoesnotsupportrollingdeploymentsbecauseitissinglenode;theserviceisunavailableduringupgrades.

Upgrades

AZSupport AssigningmultipleAZstoMySQLjobsdoesnotguaranteehighavailability.AboutMultipleAZsinMySQLforPCF

© Copyright Pivotal Software Inc, 2013-2018 5 2.1

Page 6: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

Encryption MoreInformation

EncryptedCommunicationinTransit

MySQLforPCFhasbeentestedsuccessfullywiththeBOSHIPsecAdd-onSecuringDatainTransitwiththeIPsecAdd-on

AboutMultipleAZsinMySQLforPCFv2MySQLforPCFv2supportsconfiguringmultipleAZs.However,assigningmultipleAZstoMySQLjobsdoesnotguaranteehighavailability.

On-Demandplanscanbeassignedtoanyoftheconfiguredavailabilityzones.Howevereachinstancestilloperatesasasinglenodewithnoclustering.

© Copyright Pivotal Software Inc, 2013-2018 6 2.1

Page 7: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

ReleaseNotesPivotalrecommendsthatyouupgradetothelatestversionofyourcurrentminorline,thenupgradetothelatestavailableversionofthenewminorline.Forexample,ifyouuseanolderv2.0.xversion,upgradetothelatestv2.0.xversionbeforeupgradingtothelatestv2.1.xversion.

Forproductversionsandupgradepaths,seetheProductCompatibilityMatrix .

v2.1.5ReleaseDate:May8,2018

FixesanissuewhereupdatingaserviceinstancemayhangindefinitelyafterMySQLcrashes.

MySQLuserforcollectingmetricsscopedtoonlyconnectoverlocalhost.

Requiresstemcell3445.42.

v2.1.4ReleaseDate:March15,2018

UpgradesPerconaServerto5.7.20-21.

Requiresstemcell3445.28.

v2.1.3ReleaseDate:February8,2018

Requiresstemcell3445.24.

WhenconfiguringbackupstoanS3-compatibleendpoint,regionisnolongerarequiredproperty.

v2.1.2ReleaseDate:January19,2018

Requiresstemcell3445.23.

Protectsagainstorphaningadiskwhenupdatingaserviceinstancetoaplaninadifferentavailabilityzone(AZ).

v2.1.1ReleaseDate:November15,2017

Requiresstemcell3445.16.

v2.1.0ReleaseDate:October15,2017

Providesanewrestoreutilityoneachserviceinstancetomakerestoringfromabackupartifacteasier.Formoreinformation,seeRestoretheServiceInstance.

Addstheabilitytoenableordisable lower_case_table_names forallMySQLserviceinstancesoronlyspecificserviceinstances.Thishelpswhenmigratingfromlegacysystemsthatneedcaseinsensitivity.Formoreinformatation,seeconfigureMySQL.

ChangesseveralMySQLserverdefaultconfigurationstoprovidebetterconsistencyandexpectedbehaviorwhenmigratingfromtheMySQLforPCFv1series.

© Copyright Pivotal Software Inc, 2013-2018 7 2.1

Page 8: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

Upgradesseveraldependenciesincluding, golang 1.9.0 and xtrabackup 2.4.5 .

TheoriginforallMySQLmetricsisnow p.mysql ratherthan p-mysql tobetterreflecttheservicename.

Requiresstemcell3421.20.

ThisversionofthetilecanonlybeinstalledinanOpsManagerv1.11orlaterenvironment.

Fixesaknownissueinthev2.0serieswheresmoketestsfailedifport80wasblockedforinternaltraffic.Alltrafficfromthesmoke-testserrandnowgoesthroughport443.

© Copyright Pivotal Software Inc, 2013-2018 8 2.1

Page 9: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

On-DemandServiceArchitectureThistopicdescribesthearchitectureforon-demandMySQLforPivotalCloudFoundry(PCF).

Forinformationaboutarchitectureoftheolder,pre-provisionedservice,seetheArchitecture topicforMySQLforPCFv1.9.

BOSH2.0andtheServiceNetworkWhenyoudeployPCF,youmustcreateastaticallydefinednetworktohostthecomponentvirtualmachinesthatconstitutethePCFinfrastructure.

PCFcomponents,liketheCloudControllerandUAA,runonthisinfrastructurenetwork.InPCFv2.0andearlier,on-demandPCFservicesrequirethatyouhostthemonanetworkthatrunsseparatelyfromthisnetwork.

Cloudoperatorspre-provisionserviceinstancesfromOpsManager.Then,foreachservice,OpsManagerallocatesandrecoversstaticIPaddressesfromapre-definedblockofaddresses.

Toenableon-demandservicesinPCFv2.0andearlier,operatorsmustcreateaservicenetworksinOpsManagerDirectorandselecttheServiceNetworkcheckbox.Operatorsthencanselecttheservicenetworktohoston-demandserviceinstanceswhentheyconfigurethetileforthatservice.

DefaultNetworkandServiceNetworkOn-demandPCFservicesrelyontheBOSH2.0abilitytodynamicallydeployVMsinadedicatednetwork.Theon-demandservicebrokerusesthiscapabilitytocreatesingle-tenantserviceinstancesinadedicatedservicenetwork.

On-demandservicesusethedynamically-provisionedservicenetworktohostthesingle-tenantworkerVMsthatrunasserviceinstanceswithindevelopmentspaces.ThisarchitectureletsdevelopersprovisionIaaSresourcesfortheirserviceinstancesatcreationtime,ratherthantheoperatorpre-provisioningafixedquantityofIaaSresourceswhentheydeploytheservicebroker.

Bymakingservicessingle-tenant,whereeachinstancerunsonadedicatedVMratherthansharingVMswithunrelatedprocesses,on-demandserviceseliminatethe“noisyneighbor”problemwhenoneapplicationhogsresourcesonasharedcluster.Single-tenantservicescanalsosupportregulatorycompliancewheresensitivedatamustbecompartmentalizedacrossseparatemachines.

Anon-demandservicesplitsitsoperationsbetweenthedefaultnetworkandtheservicenetwork.Sharedcomponentsoftheservice,suchasexecutivecontrollersanddatabases,runcentrallyonthedefaultnetworkalongwiththeCloudController,UAA,andotherPCFcomponents.Theworkerpooldeployedtospecificspacesrunsontheservicenetwork.

ThediagrambelowshowsworkerVMsinanon-demandserviceinstancerunningonaseparateservicesnetwork,whileothercomponentsrunonthedefaultnetwork.

© Copyright Pivotal Software Inc, 2013-2018 9 2.1

Page 10: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

RequiredNetworkingRulesforOn-DemandServicesPriortodeployinganyservicetilethatusestheon-demandbroker(ODB),theoperatormustrequestthenetworkconnectionsneededtoallowvariouscomponentsofPivotalCloudFoundry(PCF)tocommunicatewithODB.ThespecificsofhowtoopenthoseconnectionsvariesforeachIaaS.

Thefollowingtableshowstheresponsibilitiesofthekeycomponentsinanon-demandarchitecture.

KeyComponents TheirResponsibility

BOSHDirector

CreatesandupdatesserviceinstancesasinstructedbyODB

BOSHAgentBOSHincludesanAgentoneveryVMthatitdeploys.TheAgentlistensforinstructionsfromtheDirectorandcarriesoutthoseinstructions.TheAgentreceivesjobspecificationsfromtheDirectorandusesthemtoassignarole,orJob,totheVM.

BOSHUAA AsanOAuth2provider,BOSHUAAissuestokensforclientstousewhentheyactonbehalfofBOSHusers.

ERT Containstheappsthatareconsumingservices

ODB InstructsBOSHtocreateandupdatedservices,andconnectstoservicestocreatebindings

Deployedserviceinstance

Runsthegivendataservice(forexample,thedeployedRedisforPCFserviceinstancerunstheRedisforPCFdataservice)

Regardlessofthespecificnetworklayout,theoperatormustensurenetworkrulesaresetupsothatconnectionsareopenasdescribedinthetablebelow.

Thiscomponent…

Mustcommunicatewith…

DefaultTCPPort Communicationdirection(s) Notes

ODB

BOSHDirector

BOSHUAA

25555

8443 One-way Thedefaultportsarenotconfigurable.

ODBMySQLserviceinstances

3306 One-wayThisconnectionisforadministrativetasks.Avoidopeninggeneraluse,app-specificportsforthisconnection.

ODB ERT 8443 One-way Thedefaultportisnotconfigurable.

ErrandVMs

ERT

ODB

DeployedServiceInstances

8443

8080

Specifictotheservice.Maybeoneormoreports.

One-way Thedefaultportisnotconfigurable.

BOSHAgentBOSHDirector

4222 Two-way

TheBOSHAgentrunsoneveryVMinthesystem,includingtheBOSHDirectorVM.TheBOSHAgentinitiatestheconnectionwiththeBOSHDirector.Thedefaultportisnotconfigurable.

DeployedappsonERT

Deployedserviceinstances

Specifictotheservice.Maybeoneormoreports.

One-wayThisconnectionisforgeneraluse,app-specifictasks.Avoidopeningadministrativeportsforthisconnection.

ERT ODB 8080 One-wayThisportallowsElasticRuntimetocommunicatewiththeODBcomponent.

MySQLServerDefaultsThissectiondescribesthedefaultsthattheMySQLforPCFtileappliestoitsPerconaServercomponents.Thereareothercomponentsthatcanbecustomizedaswell.

MaxConnections

© Copyright Pivotal Software Inc, 2013-2018 10 2.1

Page 11: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

Allserviceinstancesacceptupto750connections.Systemprocessescounttowardsthislimit.

MaxAllowedPacket:256MB

MySQLforPCFallowsblobsupto256MBinsize.Youcanchangethissizeinasessionvariableifnecessary.

TableDefinitionCache:8192

Formoreinformationaboutupdatingthisvariable,seetheMySQLdocumentation .

ReverseNameResolutionOff

DisablingreverseDNSlookupsimprovesperformance.Toenablereversenameresolution,clearthisoption.AclearedreversenameresolutioncausestheMySQLserverstoperformareverseDNSlookuponeachnewconnection.Typically,MySQLrestrictsaccessbyhostname,butMySQLforPCFusesusercredentials,nothostnames,toauthenticateaccess.Becauseofthis,mostdeploymentsdonotneedreverseDNSlookups.

SkipSymbolicLinks

MySQLforPCFisconfiguredtopreventtheuseofsymlinkstotables.Thisrecommendedsecuritysetting preventsusersfrommanipulatingfilesontheserver’sfilesystem.

MyISAMRecoverOptions:BACKUP,FORCE

ThissettingenablesMySQLforPCFtorecoverfrommostMyISAMproblemswithouthumanintervention.Formoreinformation,seetheMySQLdocumentation .

LogBinTrustFunctionCreators:ON

ThissettingrelaxescertainconstraintsonhowMySQLwritesstoredprocedurestothebinarylog.Formoreinformation,seetheMySQLdocumentation

.

EventScheduler:ON

MySQLforPCFenablestheeventschedulersouserscancreateandutilizeeventsintheirdedicatedserviceinstances.

LowerCaseTableNames:ON

Bydefault,alltablenamesarecasesensitive.ThisoptionmaybemodifiedontheMySQLConfigurationpage.Formoreinformationabouttheuseforlowercasetablenames,seetheMySQLdocumentation .

AuditLog:OFF

TheMySQLauditlogisoffbydefault.WhenenabledontheMySQLMonitoringpage,logsarewrittenasCSVsto /var/vcap/sys/log/mysql/mysql_audit_log aswellasaremotesyslogdrainifitisenabled.

InnoDBBufferPoolSize

Dynamicallyconfiguredtobe50%oftheavailablememoryoneachserviceinstance.

InnoDBLogFileSize:256MB

© Copyright Pivotal Software Inc, 2013-2018 11 2.1

Page 12: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

MySQLforPCFclustersdefaulttoalog-filesizeof256MB.

InnoDBLogBufferSize:32MB

MySQLforPCFdefaultsto32MBtoavoidexcessivediskI/Owhenissuinglargetransactions.

InnoDBAutoIncrementLockMode:2

AutoIncrementuses“interleaved”mode.Thisenablesmultiplestatementstoexecuteatthesametime.Theremaybegapsinauto-incrementingcolumns.

CollationServer:UTF8GeneralCI

MySQLforPCFdefaultsthecollationserverto utf8_general_ci .Youcanoverridethisduringasession.

CharacterSet:UTF8

MySQLforPCFdefaultsallcharactersetsto utf8 .Youcanoverridethisduringasession.

© Copyright Pivotal Software Inc, 2013-2018 12 2.1

Page 13: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

MySQLforPCFRecommendedUsageandLimitations

RecommendedUseCasesMySQLisapowerfulopen-sourcerelationaldatabaseusedbyappssincethemid-90s.DevelopershavereliedonMySQLasafirststeptostoring,processingandsharingdata.Asitsusercommunityhasgrown,MySQLhasbecomearobustsystemcapableofhandlingawidevarietyofusecasesandverysignificantworkloads.Unlikeothertraditionaldatabaseswhichcentralizeandconsolidatedata,MySQLlendsitselftodedicateddeploymentsupportingthe“sharednothing”contextofbuildingappsinthecloud.

ServicePlanRecommendedUsageandLimitations

On-DemandPlansEachon-demandplaninstanceisdeployedtoitsownVMandissuitableforproductionworkloads.

Themaximum-numberofon-demandplaninstancesavailabletodevelopersissetbytheoperatorandenforcedonbothaglobalandper-planlevelquota.Theglobalquotacannotexceed50.

Operatorscanupdatetheplansettings,includingtheVMsizeanddisksizeaftertheplanshavebeencreated.OperatorsshouldnotdownsizetheVMsordisksizeasthiscancausedatalossinpre-existinginstances.

AllplansdeployasingleVMofthespecifiedsizewiththespecifieddisktype.

CannotscaledownthesizeofVMsontheplanoncedeployed(thisprotectsagainstdataloss).

Thedefaultmaximumnumberofconnectionsissetat750.

ResourceUsagePlanningforOn-DemandPlans

Ifthenumberofon-demandinstancesisgreaterthanorequaltotheGlobalQuotasetonthe‘OnDemandServiceSettings’page,nonewinstancescanbeprovisioned.

Tocalculatethemaximumcost/usageforeachplan:

max_plan_resources = plan_quota x plan_resources

Tocalculatethemaximumcostacrossplans,addtogetherthecost/usageforeachplan,whilethequotassumtolessthantheglobalquota.

While (plan_1_quota + plan_2_quota) ≤ global_quota:max_resources = (plan_1_quota x plan_1_resources) + ( plan_2_quota x plan_2_resources)

TocalculatethecurrentIaaScost/usageacrossOn-Demandplans:

1. Currentinstancesprovisionedforallplanscanbefoundbyreferencingthe total_instance metric.

2. Multiplethe total_instance foreachplanbythatplan’sresources.Sumallplansthatareactivetogetyourtotalcurrentusage

current_usage = (plan_1_total_instances x plan_1_resources) + (plan_2_total_instances x plan_2_resources)

AvailabilityUsingMultipleAZsMySQLforPCFv2supportsconfiguringmultipleavailabilityzonesbutthisconfigurationdoesnotprovidehighavailability.

MySQLOn-DemandplansusededicatedVManddisks,whichwillconsumeIaaSresources.OperatorscanlimitresourceusagewithPlanQuotasandaGlobalQuota,butresourceusagewillvarybasedonnumberofOn-Demandinstancesprovisioned.

© Copyright Pivotal Software Inc, 2013-2018 13 2.1

Page 14: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

DowntimeDuringRedeploysRedeployingMySQLforPCFforconfigurationchangesorupgradeswillresultinMySQLbeinginaccessibletoappsforabriefperiodoftime.

MySQLPersistentDiskUtilizationMySQLbackupsaretakenontheVMandtemporarilystoredandencryptedontheVM.Thisresultsinincreaseddiskutilizationwhilebackupsarebeingtaken.Whenenablingbackups,werecommendchoosingpersistentdisksizesthatarethreetimeslargerthanyouintendtobeavailabletoappdevelopersusingtheservice.

Backupsrequiretwotothreetimesasmuchdiskspaceastheserverneeds.Thefirstisfortheactualdata,thesecondisthecopiedbackup,andthethirdisfortheencryptedbackup.

© Copyright Pivotal Software Inc, 2013-2018 14 2.1

Page 15: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

InstallingandConfiguringMySQLforPCFThistopicprovidesinstructionstooperatorsofPivotalCloudFoundry(PCF)abouthowtoinstall,configure,anddeploytheMySQLforPCFv2.1tile.TheMySQLforPCFv2.1serviceletsPCFdeveloperscreateandusetheirownMySQLserviceinstancesondemand.

PrepareYourOpsManagerandPCFInstallationforMySQLforPCFBeforeyoudownloadandinstalltheMySQLforPCFtile,completethefollowingprocedures:

CreateanApplicationSecurityGroupforMySQLforPCF

EnabletheOpsManagerResurrector

CreateanApplicationSecurityGroupforMySQLforPCFToletappsrunningonCloudFoundrycommunicatewiththeMySQLservicenetwork,youmustcreateanApplicationSecurityGroup(ASG).

TheASGallowssmoketeststorunwhenyoufirstinstalltheMySQLforPCFserviceandallowsappstoaccesstheserviceafteritisinstalled.

Theexamplebelowfollowsthisprocedure tocreateanASG.

TocreateanASGforMySQLforPCF,dothefollowing:

1. NavigatetotheOpsManagerInstallationDashboardandclicktheOpsManagerDirectortile.

2. ClickCreateNetworks.

3. FindthenetworkthathasServiceNetworkchecked,andfindtheCIDRthatyoucanuseinyourASGs.

© Copyright Pivotal Software Inc, 2013-2018 15 2.1

Page 16: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

4. UsingtheCIDRthatyoufoundintheabovestep,createaJSONfile mysql-asg.json withtheconfigurationbelow:

[ { "protocol": "tcp", "destination": "CIDR", "ports": "3306" }]

5. UsetheCFCLIandtheJSONfilethatyoucreatedtocreateanASGcalled p.mysql :

$ cf create-security-group p.mysql ./mysql-asg.json

6. BindtheASGtotheappropriatespaceor,togiveallstartedappsaccess,bindtothe default-running ASGset:

$ cf bind-running-security-group p.mysql

EnabletheOpsManagerResurrectorTheOpsManagerResurrector increasestheavailabilityofMySQLforPCFbyrestartingandresumingMySQLserviceinthefollowingways:

ReactstohardwarefailureandnetworkdisruptionsbyrestartingVMsonactive,stablehosts

DetectsoperatingsystemfailuresbycontinuouslymonitoringVMsandrestartingthemasrequired

ContinuouslymonitorstheBOSHAgentrunningoneachserviceinstanceVMandrestartstheVMasrequired

PivotalrecommendsenablingtheOpsManagerResurrectorwheninstallingMySQLforPCF.ToenabletheOpsManagerResurrector,dothefollowing:

1. NavigatetotheOpsManagerInstallationDashboardandclicktheOpsManagerDirectortile.

2. ClickDirectorConfig.

3. SelecttheEnableVMResurrectorPlugincheckbox.

4. ClickSave.

© Copyright Pivotal Software Inc, 2013-2018 16 2.1

Page 17: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

ForgeneralinformationabouttheOpsManagerResurrector,seeUsingOpsManagerResurrector

DownloadandInstalltheTile1. DownloadtheproductfilefromPivotalNetwork .

2. NavigatetotheOpsManagerInstallationDashboardandclickImportaProducttouploadtheproductfile.

3. UndertheImportaProductbutton,click+nexttotheversionnumberofMySQLforPCF.Thisaddsthetiletoyourstagingarea.

4. Clickthenewly-addedMySQLforPCFtiletoopenitsconfigurationpanes.

ConfiguretheTileFollowthestepsbelowtoconfiguretheMySQLforPCFservice.MySQLforPCFv2.1hasfiveserviceplansthatdeploydedicatedMySQLserviceinstancesondemand.

Bydefault,plans1-3areactiveandplans4and5areinactive.Theproceduresbelowdescribehowtochangethesedefaults.

ConfigureAZsandNetworksFollowthestepsbelowtochooseanAvailabilityZone(AZ)toruntheservicebrokerandtoselectnetworks.

1. ClickAssignAZsandNetworks.

2. Configurethefieldsasfollows:

Field Instructions

Important:Inordertore-defineplanslater,youmustleave broker de-registrar checked.

© Copyright Pivotal Software Inc, 2013-2018 17 2.1

Page 18: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

Placesingletonjobsin

SelecttheAZthatyouwanttheMySQLbrokerVMtorunin.Thebrokerrunsasasingletonjob.

Balanceotherjobsin

Ignore;notused.

NetworkSelectasubnetfortheMySQLbroker.ThisistypicallythesamesubnetthatincludestheElasticRuntimecomponentVMs.ThisnetworkisrepresentedbytheDefaultNetworkinthispicture.

ServiceNetwork

Selectthesubnetfortheon-demandserviceinstances,theServicesNetworkinthispicture.IfyouareaddingIPsectoencryptMySQLcommunication,PivotalrecommendsthatyoudeployMySQLtoitsownnetworktoavoidconflictswithservicesthatarenotIPseccompatible.

3. ClickSave.

ConfigureServicePlansMySQLforPCFenablesyoutoconfigureasmanyasfiveserviceplans.Eachserviceplanhasacorrespondingsectioninthetileconfiguration,suchasPlan1,Plan2,andsoon.

Bydefault,thefirstthreeplansareactiveandthefourthandfifthplansareinactive.

PerformthefollowingstepsforeachplanthatyouwanttouseinyourPCFdeployment:

1. Clickthesectionfortheplan.Forexample,Plan1.

2. EnsurethatActiveisselected.

IMPORTANT:YoucannotchangetheregionsornetworksafteryouclickApplyChangesinthefinalstepbelow.

© Copyright Pivotal Software Inc, 2013-2018 18 2.1

Page 19: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

3. Configurethefieldsasfollows:

Field Instructions

ServicePlanAccess

Selectoneofthefollowingoptions:

Enable(Default)—Givesaccesstoallorgs,anddisplaystheserviceplantoalldevelopersintheMarketplace.Disable—Disablesaccesstoallorgs,andhidestheserviceplantoalldevelopersintheMarketplace.Thisdisablescreatingnewserviceinstancesofthisplan.Manual—LetsyoumanuallycontrolserviceaccesswiththecfCLI.Formoreinformation,seeControllingAccesstoServicePlansbyOrg.

PlanName Acceptthedefaultorenteraname.ThisisthenamethatappearsinthePCFMarketplacefordevelopers.

PlanDescription

Acceptthedefaultorenteradescriptiontohelpdevelopersunderstandplanfeatures.PivotalrecommendsaddingVMtypedetailsanddisksizetothisfield.

PlanQuota Enterthemaximumnumberofserviceinstancesthatcanexistatonetime.

MySQLVMType

SelectaVMtype.Theplancreatesserviceinstancesofthissize.

MySQLPersistentDisk

Selectadisksize.ThisdiskstorestheMySQLmessages.

MySQLAvailabilityZone

SelectanAZforthenode.ThisAZshouldbedifferentthantheAZthatthebrokerisin.TheplancreatesallserviceinstanceVMsinthisAZ.Topreventorphaningadisk,onlymigrateserviceinstancestoadifferentplaniftheplanisinthesameAZ.

4. ClickSave.

(Optional)DeactivateServicePlanFollowthestepsbelowtodeactivateaserviceplan:

1. Iftheserviceplanhasexistingserviceinstances,performthefollowingsteps:

a. Clickthesectionfortheplan.Forexample,Plan2.b. UnderServicePlanAccess,selectDisable.c. ClickSave.d. ReturntotheOpsManagerInstallationDashboardandclickApplyChangestoredeploy.e. WhenthePCFdeploymenthasredeployed,usethecfCLIorAppsManagertodeleteallexistingserviceinstancesontheserviceplan.f. ReturntotheMySQLforPCFtileconfiguration.

2. Clickthesectionfortheplan.Forexample,Plan2.

3. ClickInactive.

4. ClickSave.

ConfigureGlobalSettings

Note:Ifyouintendtoenablebackups,chooseapersistentdisktypethatisthreetimesaslargeasyouintendtoprovidetodevelopers.Formoreinformation,seeBackingUpandRestoringOn-DemandMySQL.

WARNING:Ifyouexpectyourdeveloperstoupgradefromoneplantoanother,donotplacetheplansinseparateAZs.Forexample,ifyoucreatePlan1inAZ1andPlan2inAZ2,developersreceiveanerrorandcannotcontinueiftheytrytoupgradefromPlan1toPlan2.ThispreventsthemfromlosingtheirdatabyorphaningtheirdiskinAZ1.

TolearnhowtomanuallymigratethedatafromoneAZtoanother,contactPivotalSupport .

© Copyright Pivotal Software Inc, 2013-2018 19 2.1

Page 20: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

FollowthestepsbelowtodetermineifserviceinstancesareassignedpublicIPaddressesandtosetthetotalnumberofserviceinstancesallowedacrossallplans.

1. ClickSettings.

2. Configurethefieldsasfollows:

Field Instructions

ProvidepublicIPaddressestoallServiceVMs

Selectthischeckbox:

Iftheserviceinstancesneedanexternalbackup,blobstore,orsyslogstorageIfyouhaveconfiguredBOSHtouseanexternalblobstore.

Maximumserviceinstances

Entertheglobalquotaforallon-demandinstancessummedacrosseveryon-demandplan.Forinformationaboutdeterminingglobalquotas,seeServicePlanRecommendedUsageandLimitations.

3. ClickSave.

ConfigureMySQLFollowthestepsbelowtosetMySQLdefaultsandenabledeveloperstocustomizetheirinstances:

1. ClickMysqlConfiguration

2. Configurethefieldsasfollows:

Field Instructions

EnableLowerCaseTableNames

Selectthischeckboxtoset lower_case_table_names to1onallMySQLforPCFinstances.FormoreinformationreadtheMySQLdocumentation .

AllowDevelopersToOverrideLowerCaseTableNames

SelectthischeckboxtoallowdeveloperstooverridethedefaultLowerCaseTableNamesvaluesetabove.Bydefault,allserviceinstanceswillbecreatedwiththevaluebasedon“EnableLowerCaseTableNames”above.CheckingthisboxallowsdeveloperstomodifyitusingthecfCLI.

EnableLocalInfileSelectthischeckboxtoenabledatadownloadingfromtheclient’slocalfilesystem.Formoreinformationaboutlocaldataloadingcapability,seeSecurityIssueswithLOADDATALOCAL intheMySQL5.7ReferenceManual.

ConfigureMonitoringFollowthestepsbelowtoenabledifferenttypesofmonitoringandloggingavailableintheMySQLservice.

© Copyright Pivotal Software Inc, 2013-2018 20 2.1

Page 21: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

1. ClickMonitoring.

2. Configurethefieldsasfollows:

Field Instructions

MetricsPollingInterval

Setthistime,inseconds,todeterminethefrequencythatthemonitorpollsformetrics.AllserviceinstancesemitmetricsaboutthehealthandstatusoftheMySQLserver.

EnableUserStatisticsLogging

SelectthischeckboxtobetterunderstandserveractivityandidentifysourcesofloadonaMySQLserver.Formoreinformationaboutuserstatistics,seeUserStatisticsDocumentation .

EnableServerActivityLogging

SelectthischeckboxtorecordwhoconnectstotheserversandwhatqueriesareprocessedusingthePerconaAuditLogPlugin.Formoreinformation,seethePerconaDocumentation .

EnableRead-OnlyAdminUser

Selectthischeckboxtocreatearead-onlyadminuser, roadmin ,oneachserviceinstance.Thisusercanbeusedforauditingandmonitoringwithoutriskingmutatingorchanginganydata,becausethe roadmin usercannotmakechanges.

Toretrievethecredentialsforthe roadmin user,seeRetrieveAdminandRead-OnlyAdminCredentialsforaServiceInstance.Theread-onlyadminuserisalways roadmin ,butthepasswordvariesbyserviceinstance.

3. ClickSave.

ConfigureSystemLoggingFollowthestepsbelowtoenablesystemloggingfortheMySQLbrokerandserviceinstanceVMs.LogsuseRFC5424format.

1. ClickSyslog.

2. ClickYes.

© Copyright Pivotal Software Inc, 2013-2018 21 2.1

Page 22: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

3. Configurethefieldsasfollows:

Field Instructions

Address Entertheaddressorhostofthesyslogserverforsendinglogs,forexample, logmanager.example.com .

Port Entertheportofthesyslogserverforsendinglogs,forexample, 29279 .

TransportProtocol Selecttheprotocoloverwhichyouwantsystemlogs.PivotalrecommendsusingTCP.

EnableTLS IfyouselectTCP,youcanalsoselecttosendlogsencryptedoverTLS.

PermittedPeer Entereithertheacceptedfingerprint,inSHA1,orthenameoftheremotepeer,forexample, *.example.com

SSLCertificate EntertheSSLCertificate(s)forthesyslogserver.Thisensuresthelogsaretransportedsecurely.

4. ClickSave.

VerifyStemcellVersionandApplyAllChanges1. ClickStemcell.

2. Verifyand,ifnecessary,importanewstemcellversion.Formoreinformation,seeaboutimportingthestemcellforyourIaaS:AWS ,Azure ,GCP ,orvSphere .

3. ClickSave.

4. ReturntotheOpsManagerInstallationDashboardandclickApplyChanges.

IMPORTANT:IfyoursyslogserverisexternaltoPCF,youmightneedtoselectProvidepublicIPaddressestoallServiceVMsontheSettingspage.

© Copyright Pivotal Software Inc, 2013-2018 22 2.1

Page 23: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

BackingUpandRestoringOn-DemandMySQLforPCFThistopicdescribeshowtoconfigureautomatedbackupsforMySQLforPivotalCloudFoundry(PCF),andhowtomanuallyrestoreaMySQLserviceinstancefromabackup.

AboutAutomatedBackupsAutomatedbackupsdothefollowing:

Periodicallycreateanduploadbackupssuitableforrestoringallofthedatabasesusedbytheserviceinstance.

Operatewithoutlockingappsoutofthedatabase;nodowntime.

Includeametadatafilethatcontainsthecriticaldetailsofthebackup,includingthecalendartimeofthebackup.

EncryptbackupswithintheMySQLforPCFVM;unencrypteddataisnevertransportedoutsidetheMySQLforPCFdeployment.

BackupFilesandMetadataWhenMySQLforPCFrunsabackup,ituploadstwofileswithUnixepoch-timestampedfilenamesoftheform mysql-backup-TIMESTAMP :

Theencrypteddatabackupfile mysql-backup-TIMESTAMP.tar.gpg

Ametadatafile mysql-backup-TIMESTAMP.txt

Themetadatafilecontainsinformationaboutthebackupandlookslikethis:

ibbackup_version = 2.4.5end_time = 2017-04-24 21:00:03lock_time = 0binlog_pos =incremental = Nencrypted = Nserver_version = 5.7.16-10-logstart_time = 2017-04-24 21:00:00tool_command = --user=admin --password=... --stream=tar tmp/innodb_from_lsn = 0innodb_to_lsn = 2491844format = tarcompact = Nname =tool_name = innobackupexpartial = Ncompressed = Nuuid = fd13cf26-2930-11e7-871e-42010a000807tool_version = 2.4.5

Withinthisfile,themostimportantitemsarethe start_time andthe server_version entries.

ThebackupprocessdoesnotinterruptMySQLservice,butbackupsonlyreflecttransactionsthatcompletedbeforetheir start_time .

EnablingAutomatedBackupsYoucanconfigureMySQLforPCFtoautomaticallybackupitsdatabasestoexternalstorage.

Howandwhere—Therearefouroptionsforhowautomatedbackupstransferbackupdataandwherethedatasavesto:

Option1:BackupwithSCP—MySQLforPCFrunsanSCPcommandthatsecure-copiesbackupstoaVMorphysicalmachineoperatingoutsideofPCF.SCPstandsforsecurecopyprotocol,andoffersawaytosecurelytransfertilesbetweentwohosts.TheoperatorprovisionsthebackupmachineseparatelyfromtheirPCFinstallation.Thisisthefastestoption.Option2:BackuptoCephorS3—MySQLforPCFrunsanAmazonS3 clientthatsavesbackupstoanS3bucket,aCeph storagecluster,oranotherS3-compatibleendpointcertifiedbyPivotal.

Note:Althoughboth compressed and encrypted showas N inthisfile,thebackupuploadedbyMySQLforPCFisbothcompressedandencrypted.Thisisaknownissue.

© Copyright Pivotal Software Inc, 2013-2018 23 2.1

Page 24: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

Option3:BackuptoGCS—MySQLforPCFrunsanGCS SDKthatsavesbackupstoanGoogleCloudStoragebucket.Option4:BackuptoAzureStorage—MySQLforPCFrunsanAzure SDKthatsavesbackupstoanAzurestorageaccount.

When—Backupsfollowaschedulethatyouspecifywithacron expression.

Whatisbackedup—EachMySQLinstancebacksupitsentireMySQLdatadirectory,consistenttoaspecificpointintime.

Toenableandconfigureautomatedbackups,followtheproceduresbelowaccordingtotheoptionyouchooseforexternalstorage.

Option1:BackUpwithSCPSCPenablestheoperatortouseanydesiredstoragesolutiononthedestinationVM.

TobackupyourdatabaseusingSCP,completethefollowingprocedures:

CreateaPublicandPrivateKeyPair

ConfigureBackupsinOpsManager

CreateaPublicandPrivateKeyPairMySQLforPCFaccessesaremotehostasauserwithaprivatekeyforauthentication.PivotalrecommendsthatthisuserandkeypairbesolelyforMySQLforPCF.

1. DeterminetheremotehostthatyouwillbeusingtostorebackupsforMySQLforPCF.EnsurethattheMySQLserviceinstancescanaccesstheremotehost.

2. (Recommended)CreateanewuserforMySQLforPCFonthedestinationVM.

3. (Recommended)CreateanewpublicandprivatekeypairforauthenticatingastheaboveuseronthedestinationVM.

ConfigureBackupsinOpsManagerUseOpsManagertoconfigureMySQLforPCFtobackupusingSCP.

1. InOpsManager,opentheMySQLforPCFtileBackupspane.

2. SelectSCP.

Note:PivotalrecommendsusingaVMoutsidethePCFdeploymentforthedestinationofSCPbackups.AsaresultyoumayneedtoenablepublicIPsfortheMySQLVMs.

© Copyright Pivotal Software Inc, 2013-2018 24 2.1

Page 25: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

3. Fillinthefieldsasfollows:

Username—Entertheuserthatyoucreatedabove.PrivateKey—Entertheprivatekeythatyoucreatedabove.ThepublickeyshouldbestoredforsshandscpaccessonthedestinationVM.Hostname—EntertheIPorDNSentrythatshouldbeusedtoaccessthedestinationVM.DestinationDirectory—EnterthedirectoryinwhichMySQLforPCFshoulduploadbackups.CronSchedule—Entera cron schedule,usingstandardcronsyntax ,totakebackupsofeachserviceinstance.Fingerprint—EnterthefingerprintofthedestinationVM’spublickey.ThishelpstodetectanychangestothedestinationVM.EnableEmailAlerts—Selecttoreceiveemailnotificationswhenabackupfailureoccurs.Alsoverifythatyouhavedonethefollowing:

AddedalluserswhoneedtobenotifiedaboutfailedbackupstoSystemorgandSystemspaceConfiguredEmailNotificationsinElasticRuntime,seeConfigureEmailNotificationsforyourIaaS:AWS ,Azure ,GCP ,OpenStack,orvSphere .

Option2:BackUptoCephorS3TobackupyourdatabaseonCephorAmazonS3,completethefollowingprocedures:

CreateaPolicyandAccessKey

ConfigureBackupsinOpsManager

© Copyright Pivotal Software Inc, 2013-2018 25 2.1

Page 26: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

CreateaPolicyandAccessKeyMySQLforPCFaccessesyourS3storethroughauseraccount.PivotalrecommendsthatthisaccountbesolelyforMySQLforPCF.YoumustapplyaminimalpolicythatletstheuseraccountuploadbackupstoyourS3store.

1. CreateapolicyforyourMySQLforPCFuseraccount.

PolicycreationvariesdependingontheS3provider.FollowtherelevantproceduretogiveMySQLforPCFthefollowingpermissions:

Listanduploadtobuckets(Optional)Createbucketsinordertousebucketsthatdonotalreadyexist

Forexample,inAWS,tocreateanewcustompolicy,gotoIAM>Policies>CreatePolicy>CreateYourOwnPolicyandpasteinthefollowingpermissions:

{"Version": "2012-10-17","Statement": [{ "Sid": "ServiceBackupPolicy", "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:ListBucketMultipartUploads", "s3:ListMultipartUploadParts", "s3:CreateBucket", "s3:PutObject" ], "Resource": [ "arn:aws:s3:::MY_BUCKET_NAME/*", "arn:aws:s3:::MY_BUCKET_NAME" ]}]}

2. (Recommended)CreateanewuserforMySQLforPCFandrecorditsAccessKeyIDandSecretAccessKey,theusercredentials.

3. AttachthepolicyyoucreatedtotheAWSuseraccountthatMySQLforPCFwillusetoaccessS3(IAM>Policies>PolicyActions>Attach).

ConfigureBackupsinOpsManagerUseOpsManagertoconnectMySQLforPCFtoyourS3account.

1. InOpsManager,opentheMySQLforPCFtileBackupspane.

2. SelectCephorAmazonS3.

© Copyright Pivotal Software Inc, 2013-2018 26 2.1

Page 27: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

3. Fillinthefieldsasfollows:

AccessKeyID andSecretAccessKey—EntertheS3AccessKeyIDandSecretAccessKeyfromabove.EndpointURL—EntertheS3compatibleendpointURLforuploadingbackups.URLmuststartwith http:// or https:// .Thedefaultishttps://s3.amazonaws.com

Region—Entertheregionwhereyourbucketislocatedortheregionwhereyouwantabuckettobecreated.Ifthebucketdoesnotalreadyexist,itiscreatedautomatically.BucketName—Enterthenameofyourbucket.Donotincludean s3:// prefix,atrailing / ,orunderscores.Pivotalrecommendsusingthenamingconvention DEPLOYMENT-backups ,suchas sandbox-backups .BucketPath—Enterthepathinthebuckettostorebackups.Donotincludeatrailing / .Pivotalrecommendsusing mysql-v2 .CronSchedule—Entera cron schedule,usingstandardcronsyntax ,totakebackupsofeachserviceinstance.EnableEmailAlerts—Selecttoreceiveemailnotificationswhenabackupfailureoccurs.Alsoverifythatyoudonethefollowing:

AddedalluserswhoneedtobenotifiedaboutfailedbackupstoSystemorgandSystemspaceConfiguredEmailNotificationsinElasticRuntime,seeConfigureEmailNotificationsforyourIaaS:AWS ,Azure ,GCP ,OpenStack,orvSphere .

Option3:BackUptoGCSTobackupyourdatabaseonGoogleCloudStorage(GCS),completethefollowingprocedures:

CreateaPolicyandAccessKey

ConfigureBackupsinOpsManager

CreateaPolicyandAccessKeyMySQLforPCFaccessesyourGCSstorethroughaserviceaccount.PivotalrecommendsthatthisaccountbesolelyforMySQLforPCF.YoumustapplyaminimalpolicythatletstheuseraccountuploadbackupstoyourGCSstore.

1. IntheGCSconsole,createanewserviceaccountforMySQLforPCF:IAMandAdmin>ServiceAccounts>CreateServiceAccount.

© Copyright Pivotal Software Inc, 2013-2018 27 2.1

Page 28: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

MySQLforPCFneedsthefollowingpermissionsforthisaccount:

Listanduploadtobuckets(Optional)Createbucketsinordertousebucketsthatdonotalreadyexist

2. EnterauniquenameintheServiceaccountnamefield,suchas MySQL-for-PCF .

3. IntheRolesdropdown,grantthe MySQL-for-PCF serviceaccounttheStorageAdminrole.

4. ChecktheFurnishanewprivatekeyboxsothatanewkeyiscreatedanddownloaded.

5. ClickCreateandtakenoteofthenameandlocationoftheserviceaccountJSONfilethatisdownloaded.

ConfigureBackupsinOpsManagerUseOpsManagertoconnectMySQLforPCFtoyourGCSaccount.

1. InOpsManager,opentheMySQLforPCFtileBackupspane.

2. SelectGCS.

3. Fillinthefieldsasfollows:

ProjectID—EntertheProjectIDfortheGoogleCloudprojectthatyouareusing.BucketName—Enterthebucketnameinwhichtoupload.ServiceAccountJSON—Enterthecontentsoftheserviceaccountjsonfilethatyoudownloadedwhencreatingaserviceaccountabove.CronSchedule—Entera cron schedule,usingstandardcronsyntax ,totakebackupsofeachserviceinstance.EnableEmailAlerts—Selecttoreceiveemailnotificationswhenabackupfailureoccurs.Alsoverifythatyoudonethefollowing:

AddedalluserswhoneedtobenotifiedaboutfailedbackupstoSystemorgandSystemspaceConfiguredEmailNotificationsinElasticRuntime,seeConfigureEmailNotificationsforyourIaaS:AWS ,Azure ,GCP ,OpenStack,orvSphere .

© Copyright Pivotal Software Inc, 2013-2018 28 2.1

Page 29: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

Option4:BackUptoAzureStorageCompletethefollowingstepstobackupyourdatabasetoyourAzureStorageaccount.

1. InOpsManager,opentheMySQLforPCFtileBackupspane.

2. SelectAzure.

3. Fillinthefieldsasfollows:

Account—EntertheAccountnamefortheMicrosoftAzureaccountthatyouareusing.AzureStorageAccessKey—EnteroneofthestorageaccesskeysthatcanbeusedtoaccesstheAzureStorageaccount.ContainerName—Enterthecontainernamethatbackupsshouldbeuploadedto.DestinationDirectory—EnterthedirectoryinwhichbackupsshouldbeuploadedtoinsideoftheContainer.BlobStoreBaseURL—Bydefault,backupsaresenttothepublicAzureblobstore.Touseanon-premiseblobstore,enterthehostnameoftheblobstore.CronSchedule—Entera cron schedule,usingstandardcronsyntax ,totakebackupsofeachserviceinstance.EnableEmailAlerts—Selecttoreceiveemailnotificationswhenabackupfailureoccurs.Alsoverifythatyoudonethefollowing:

AddedalluserswhoneedtobenotifiedaboutfailedbackupstoSystemorgandSystemspaceConfiguredEmailNotificationsinElasticRuntime,seeConfigureEmailNotificationsforyourIaaS:AWS ,Azure ,GCP ,OpenStack,orvSphere .

DisableAutomatedBackupsTodisableMySQLforPCFautomatedbackups:

1. InOpsManager,opentheMySQLforPCFtileBackupspane.

© Copyright Pivotal Software Inc, 2013-2018 29 2.1

Page 30: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

2. SelectDisableBackups.

3. ClickSave.

4. ReturntotheOpsManagerInstallationDashboardandclickApplyChanges.

ManualBackupMySQLforPCFv2.1disablesremoteadminaccesstoMySQLdatabases.ToaccessyourMySQLdatabasetoperformamanualbackup,youmustcreateaservicekeyforeachserviceinstanceyouwanttobackup.

Thisbackupacquiresaglobalreadlockonalltables,butdoesnotholditfortheentiredurationofthedump.

PerformthefollowingstepstobackupyourMySQLforPCFdatamanually:

1. UsetheCloudFoundryCommandLineInterface(cfCLI)totargettheCloudControllerofyourPCFdeploymentwithcf api api.YOUR-SYSTEM-DOMAIN .Forexample:

$ cf api api.sys.cf-example.com

FormoreinformationaboutinstallingandusingthecfCLI,seethecfCLIdocumentation .

2. Login:

$ cf login

3. CreateaservicekeyfortheMySQLserviceinstance.Runthefollowingcommand: cf create-service-key SERVICE_INSTANCE_NAME SERVICE_KEY_NAME

Where:

SERVICE_INSTANCE_NAME :EnterthenameoftheexistingMySQLserviceinstancethatcontainsthedatayouwanttobackup.SERVICE_KEY_NAME :Chooseanameforthenewservicekey.

Forexample:

$ cf create-service-key mysql-spring spring-keyCreating service key spring-key for service instance mysql-spring as admin...OK

4. Aftercreatingtheservicekey,retrieveitsinformation.Runthefollowingcommand: cf service-key SERVICE-INSTANCE-NAME SERVICE-KEY-NAME

Where:

SERVICE-INSTANCE-NAME :EnterthenameoftheMySQLserviceinstanceyoucreatedaservicekeyfor.SERVICE-KEY-NAME :Enterthenameofthenewlycreatedservicekey.

Forexample:

$ cf service-key mysql-spring spring-keyGetting key spring-key for service instance mysql-spring as admin...

{ "hostname": "10.10.10.5", "jdbcUrl": "jdbc:mysql://10.10.10.5:3306/cf_e2d148a8_1baa_4961_b314_2431f57037e5?user=abcdefghijklm\u0026password=123456789", "name": "cf_e2d148a8_1baa_4961_b314_2431f57037e5", "password": "123456789", "port": 3306, "uri": "mysql://abcdefghijklm:[email protected]:3306/cf_e2d148a8_1baa_4961_b314_2431f57037e5?reconnect=true", "username": "abcdefghijklm"}

5. Examinetheoutputandrecordthefollowingvalues:

© Copyright Pivotal Software Inc, 2013-2018 30 2.1

Page 31: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

hostname :TheMySQLforPCFproxyIPaddresspassword :Thepasswordfortheuserthatcanbeusedtoperformbackupsoftheserviceinstancedatabaseusername :Theusernamefortheuserthatcanbeusedtoperformbackupsoftheserviceinstancedatabase

6. Usemysqldump tobackupthedataforyourserviceinstance.Runthefollowingcommand:

mysqldump --username=USERNAME --password=PASSWORD \--host=MYSQL-IP \--all-databases \--single-transaction > BACKUP-NAME.sql

Where:

USERNAME :Entertheusernameretrievedfromtheoutputof cf service-key .PASSWORD :Enterthepasswordretrievedfromtheoutputof cf service-key .MYSQL-IP :Enterthevalueof hostname retrievedfromtheoutputof cf service-key .BACKUP-NAME :Enteranameforthebackupfile.

Forexample:

$ mysqldump --username=abcdefghijklm --password=123456789 \--host=10.10.10.8 \--all-databases \--single-transaction > spring-db-backup.sql

RestoreaServiceInstancefromBackupRestoringMySQLforPCFfrombackupisamanualprocessprimarilyintendedfordisasterrecovery.RestoringaMySQLforPCFserviceinstancereplacesallofitsdataandrunningstate.

TorestoreaMySQLforPCFinstancefromanoffsitebackup,downloadthebackupandrestoretoanewinstancebyfollowingtheseprocedures:

DownloadtheBackupArtifact

RestoretheServiceInstance

DownloadtheBackupArtifactDownloadthebackupartifactfromyourblobstorage.

TheseinstructionsassumethatyouareusingAWSS3asyourbackupdestination.Ifyouareusingadifferentbackupdestination,steps5,6,and8aredifferent.Seethedocumentationforyourbackupproviderforthecorrectprocedure.

PerformthefollowingstepstodownloadthebackupartifactfromanAWSS3bucket:

1. Run cf service todeterminetheGUIDassociatedwiththeserviceinstancethatyouwanttorestore:

$ cf service MY-INSTANCE-NAME --guid12345678-90ab-cdef-1234-567890abcdef

2. FollowtheAdvancedTroubleshooting instructionstologintotheOpsManagerVM,whereyoucanruntheBOSHCLIv2.

3. FromtheOpsManagerVM,downloadthemanifestfortheserviceinstancedeploymentbyspecifyingthedeploymentnameas service-instance_GUID

andafilenameforthemanifest.Forexample:

$ bosh2 -e my-env -d service-instance_12345678-90ab-cdef-1234-567890abcdef manifest > ./manifest.yml

4. Inspectthedownloadedmanifestandrecordthefollowingpropertiesforlater:

properties.cf-mysql-backup.symmetric_key alsoreferredtoasanencryptionkey-thiswillbeusedlatertodecryptthebackupartifact.properties.service-backup.destinations[0].config.bucket_name whichisthebucketthatthebackupsareuploadedto.properties.service-backup.destinations[0].config.bucket_path thepathwithinthebucketabove.

5. LogintotheAWSCLI.ForinformationandtodownloadtheCLI,seeAWSCommandLineInterface .

© Copyright Pivotal Software Inc, 2013-2018 31 2.1

Page 32: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

6. Listtheavailablebackupsfortheinstance,replacing BUCKET-NAME and BUCKET-PATH withvaluesfromabove.Theartifactsaresortedbytime.

$ aws s3 ls --recursive s3://BUCKET-NAME/BUCKET-PATH/service-instance_12345678-90ab-cdef-1234-567890abcdef/

7. Choosethemostrecentbackupfile,oranolderbackupyouwanttorestorefrom.Thebackupsaretimestampedinthefilenameandhavea .gpg

extension.

8. Downloadtheselectedbackup:

$ aws s3 cp s3://BUCKET-NAME/BUCKET-PATH/service-instance_12345678-90ab-cdef-1234-567890abcdef/YEAR/MONTH/DATE/mysql-backup-1489168980-0.tar.gpg ./a-local-path/mysql-backup-1489168980-0.tar.gpg

RestoretheServiceInstanceBecauserestoringaserviceinstanceisdestructive,Pivotalrecommendsthatyourestoretoanewandunusedserviceinstance.

Theseinstructionsassumeyouhaveabackupdownloaded.

Torestorethebackuptoanewserviceinstance,followtheseprocedures:

CreateandPrepareaNewServiceInstanceforRestore

RuntheRestoreUtility

CreateandPrepareaNewServiceInstanceforRestore1. Determinetheserviceplanassociatedwiththeoldserviceinstance:

$ cf service OLD-INSTANCE-NAME

2. Createanewserviceinstanceusingthesameserviceplantorestoreto:

$ cf create-service p.mysql db-small NEW-SERVICE-INSTANCE

3. Monitorthestatusoftheserviceinstancecreation;itmaytakeseveralminutesastheVMiscreated.

$ cf service NEW-SERVICE-INSTANCE

4. DeterminetheGUIDassociatedwithyourserviceinstance:

$ cf service NEW-SERVICE-INSTANCE --guid

5. FromtheOpsManagerVM,downloadthemanifestfortheserviceinstancedeploymentbyspecifyingthedeploymentnameas service-instance_GUID

andafilenameforthemanifest.Forexample:

$ bosh2 -e my-env -d service-instance_12345678-90ab-cdef-1234-567890abcdef manifest > ./manifest.yml

6. DetermineandrecordtheMySQLadminpassword:

$ cat ./manifest | grep admin_password

7. FindandrecordtheMySQLinstancenameandGUIDfromBOSH:

$ bosh2 -e my-env -d my-dep instances

8. Copythedownloadedbackuptothenewserviceinstance:

$ bosh2 -e my-env -d my-dep scp mysql-backup-TIMESTAMP.tar.gpg BOSH-INSTANCE:DESTINATION-PATH

Note:YoucanalsologintoAWSanddownloadS3backupsfromabrowser.

© Copyright Pivotal Software Inc, 2013-2018 32 2.1

Page 33: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

BOSH-INSTANCEis mysql/INSTANCE-GUID .Forexample, mysql/d7ff8d46-c3e8-449f-aea7-5a05b0a1929c .DESTINATION-PATHiswherethebackupfilesavesontheBOSHVM.Forexample, /tmp/ .

9. UsetheBOSHCLIv2toSSHintothenewlycreatedMySQLserviceinstance.Formoreinformation,seeBOSHSSH .

10. AftersecurelyloggingintoMySQL,run sudo su tobecomeroot:

$ sudo su

11. Createthedirectorystructurethetoolingexpectsbycreatinga restore-artifact directory:

$ mkdir /var/vcap/store/restore-artifact/

12. Movethebackupartifacttothescript’sexpectedlocation:

$ mv /tmp/mysql-backup-1498863859-0.tar.gpg /var/vcap/store/restore-artifact/

RuntheRestoreUtility

1. Runtherestoreutilitytorestorethebackupartifactintothedatadirectory.Thisprocess:

deletesanyexistingdatadecryptsanduntarsthebackupartifactrestoresthebackupartifactintothemysqldatadirectory

$ /var/vcap/packages/mysql-restore/bin/restore --encryption-key ENCRYPTION-KEY --mysql-username admin --mysql-password ADMIN-PASSWORD

where:

ENCRYPTION-KEY isthe symmetric-key valuefromaboveADMIN-PASSWORD isthe admin_password valuefromabove

2. ExittheMySQLVM.

3. DetermineiftheapplicationiscurrentlyboundtoaMySQLserviceinstance:

$ cf services

4. IfthepreviousstepshowsthattheappiscurrentlyboundtoaMySQLinstance,unbindit:

$ cf unbind-service MY-APP OLD-SERVICE-INSTANCE

5. UpdateyourCFapptobindtothenewserviceinstance:

$ cf bind-service MY-APP NEW-SERVICE-INSTANCE

6. RestageyourCFapptomakethechangestakeeffect:

$ cf restage MY-APP

Yourappshouldberunningandabletoaccesstherestoreddata.

WARNING:Thisisadestructiveactionandshouldonlyberunonanewandunusedserviceinstance.

© Copyright Pivotal Software Inc, 2013-2018 33 2.1

Page 34: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

ControllingResourceUseThistopictellsoperatorshowtocontrolresourceuse,thatisnumberandsizeofserviceinstancesusedbyMySQLforPivotalCloudFoundry(PCF)v2,bysettingamaximumnumberofserviceinstancesandbyonlyallowingcertainorgstousesomeserviceplans.

Example1:LimittheNumberofServiceInstances

Resourcecostshavebeenincreasing.Employeesdon’tdeletetheirdatabasesaftertests.Tostopemployeeswastingsomanyresources,yousetquotasforthenumberofservicesinstancesthatcanexistatatime:

SetaglobalquotaforthetotalnumberofserviceinstancesusedbyMySQLforPCF.

Setaper-planquotafortheservice-planwiththemostexpensiveserviceinstances,thatis,VMtypes.

Example2:LimitPlanAccess

Youhaveaserviceplancalleddb-largewhichuseslargeserviceinstances,andit’sinanexpensiveavailabilityzone,too.YouwantthisMySQLforPCFplanusedonlyforyourflagshipproductionapp.Topreventyourdevelopmentteamfromcreatingserviceinstancesinthisplan,specifythatonlymembersoftheproductionorgcanaccessthedb-largeplan.

QuotasMySQLforPCFv2offerstwotypesofquotas:

Globalquota

Service-planquotas

GlobalQuotaTheglobalquotalimitsthetotalnumberofserviceinstancesthatcanbedeployedbyMySQLforPCF.

Configuringquotasallowsyoutolimitthenumberofserviceinstancesthatcanbedeployed,therebyensuringthatresourceconsumptionstayswithinlimits.Bydefault,MySQLforPCFshipswithamaximumlimitof50serviceinstances:thismeansthattheMySQLforPCFservicebrokerneverdeploysmorethan50serviceinstances.Youcansetthisquotatolessthan50,butnevertomorethan50.

Toconfigureaglobalquota,seeConfigureGlobalQuotas.

Service-PlanQuotasAservice-planquotalimitsthenumberofserviceinstancesforoneplan.

Inthecasewhereaserviceplanisconfiguredtousealotofresources,RAMordiskspace,youmightwanttolimitthenumberofserviceinstancesofthisplanthatcanbeconfigured.Settingaserviceplanquotaonthemoreexpensiveplanensuresthatresourceconsumptiondoesnotexceedanacceptableamount.

Toconfigureaservice-planquota,seeConfigureActiveServicePlans.

ControlAccesstoServicePlanbyOrgsMySQLforPCFv2allowsyoutocontrolwhichCForgsareabletoaccessspecificserviceplans.Bydefault,activeserviceplansarevisibletoallorgs.Controllingwhichorgshaveaccesstoaspecificserviceplanallowsyoutoensurethattheresource-intensiveserviceplansareonlyavailabletotheorgsthatexplicitlyneedthem.

ToconfigureMySQLforPCFv2tocontrolservice-planaccess,dothefollowing:

1. SettheServicePlanAccessfieldtoManualonanyactiveserviceplan.Formoreinformation,seeConfigureActiveServicePlans.

2. ClickSave.

© Copyright Pivotal Software Inc, 2013-2018 34 2.1

Page 35: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

3. ReturntotheOpsManagerInstallationDashboardandclickApplyChanges.

4. Foreachorgthatyouwanttousetheserviceplan,dothefollowing:

a. LogintotheCloudFoundryCommandLineInterface(cfCLI)asanadminuser:cf login

b. Enableserviceaccesstotheorg:cf enable-service-access p.mysql -p PLAN -o ORGANIZATION

Where:PLAN :Thenameofthespecificplantoenable,settomanualinstep1above.ORGANIZATION :Thenameoftheorgthatneedsaccessto PLAN

Forexample,

$ cf enable-service-access p.mysql -o prodteam -p db-largeEnabling access to plan db-large of service p.mysql for org prodteam as admin...OK

Theorgisnowabletousetheplan.

Forinformationonmodifyingandviewingservice-planaccess,seeAccessControl .

© Copyright Pivotal Software Inc, 2013-2018 35 2.1

Page 36: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

MonitoringandKPIsforOn-DemandMySQLforPCFThistopicexplainshowtomonitorthehealthoftheMySQLforPivotalCloudFoundry(PCF)serviceusingthelogs,metrics,andKeyPerformanceIndicators(KPIs)generatedbyMySQLforPCFcomponentVMs.

ForgeneralinformationaboutloggingandmetricsinPCF,seeLoggingandMetrics .

AboutMetricsMetricsareregularly-generatedlogmessagesthatreportmeasuredcomponentstates.Themetricspollingintervalis30secondsforMySQLinstancesand60secondsfortheservicebroker.

Metricsarelong,singlelinesoftextthatfollowtheformat:

origin:"p.mysql" eventType:ValueMetric timestamp:1496776477930669688 deployment:"service-instance_2b5a001f-2bf3-460c-aee6-fd2253f9fb0c" job:"mysql" index:"b09df494-b731-4d06-a4b0-c2985ceedf4c" ip:"10.0.8.4" valueMetric:<name:"/p.mysql/performance/open_files" value:24 unit:"file" >

KeyPerformanceIndicatorsKeyPerformanceIndicators(KPIs)forMySQLforPCFaremetricsthatoperatorsfindmostusefulformonitoringtheirMySQLservicetoensuresmoothoperation.KPIsarehigh-signal-valuemetricsthatcanindicateemergingissues.KPIscanberawcomponentmetricsorderivedmetricsgeneratedbyapplyingformulastorawmetrics.

PivotalprovidesthefollowingKPIsasgeneralalertingandresponseguidancefortypicalMySQLforPCFinstallations.Pivotalrecommendsthatoperatorscontinuetofine-tunethealertmeasurestotheirinstallationbyobservinghistoricaltrends.Pivotalalsorecommendsthatoperatorsexpandbeyondthisguidanceandcreatenew,installation-specificmonitoringmetrics,thresholds,andalertsbasedonlearningfromtheirowninstallations.

KPIsforMySQLServiceInstancesThissectionliststheKPIsthatarespecificforMySQLforPCFinstances.

ForalistofgeneralKPIsthatapplytoallinstances,andnotspecificallytoMySQLforPCFinstances,seeBOSHSystemMetrics.

ForalistofallMySQLforPCFcomponentmetrics,seeAllMySQLMetrics.

ServerAvailability

/p.mysql/available

Description

MySQLServeriscurrentlyrespondingtorequests,whichindicatesifthecomponentisavailable.

Use:Iftheserverdoesnotemitheartbeats,itisoffline.

Origin:Doppler/FirehoseType:booleanFrequency:30s

Recommendedmeasurement Averageoverlast5minutes

RecommendedalertthresholdsYellowwarning:N/ARedcritical:<1

RecommendedresponseChecktheMySQLServerlogsforerrors.YoucanfindtheinstancebytargetingyourMySQLdeploymentwithBOSHandinspectinglogsfortheinstance.Formoreinformation,seeFailingJobsandUnhealthyInstances.

PersistentandEphemeralDiskUsed

© Copyright Pivotal Software Inc, 2013-2018 36 2.1

Page 37: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

/p.mysql/system/persistent_disk_used_percentand/p.mysql/system/ephemeral_disk_used_percent

Description

Thepercentageofdiskusedonthepersistentandephemeralfilesystems.

Use:MySQLcannotfunctioncorrectlyifthereisn’tsufficientfreespaceonthefilesystems.Usethesemetricstoensurethatyouhavediskslargeenoughforyouruserbase.

Origin:Doppler/FirehoseType:PercentFrequency:30s(default)

RecommendedmeasurementMaxofpersistentdiskusedofallofnodesandMaximumephemeraldiskusedofallnodes

RecommendedalertthresholdsYellowwarning:>40%

Redcritical:>45%

Recommendedresponse Upgradetheserviceinstancetoaplanwithlargerdiskcapacity.

Connections

/p.mysql/net/connections

Description

Therateofconnectionstotheserver,shownasconnectionspersecond.

Use:Ifthenumberofconnectionsdrasticallychangesorifappsareunabletoconnect,theremightbeanetworkorappissue.

Origin:Doppler/FirehoseType:countFrequency:30s

Recommendedmeasurement (Numberofconnections/Maxconnections)overlast1minute

RecommendedalertthresholdsYellowwarning:>80Redcritical:>90

Recommendedresponse

Whenapproaching100%ofmaxconnections,appsmaybeexperiencingtimeswhentheycannotconnecttothedatabase.Theconnections/secondforaserviceinstancevarybasedonapplicationinstancesandapputilization.Ifthismetricismetorexceededforanextendedperiodoftime,monitorappusagetoensureeverythingisbehavingasexpected.

Questions

/p.mysql/performance/questions

Description

Therateofstatementsexecutedbytheserver,shownasqueriespersecond.

Use:Theservershouldalwaysbeprocessingsomequeries,ifjustaspartoftheinternalautomation.

Origin:Doppler/FirehoseType:countFrequency:30s

Recommendedmeasurement Averageoverlast2minutes

RecommendedalertthresholdsYellowwarning:0for90sRedcritical:0for120s

RecommendedresponseInvestigatetheMySQLserverlogs,suchastheauditlog,tounderstandwhyqueryratechangedanddetermineappropriateaction.

BOSHSystemHealthMetrics

© Copyright Pivotal Software Inc, 2013-2018 37 2.1

Page 38: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

TheBOSHlayerthatunderliesPCFgenerates healthmonitor metricsforallVMsinthedeployment.However,thesemetricsarenotincludedintheLoggregatorFirehosebydefault.Togetthesemetrics,doeitherofthefollowing:

TosendBOSHHMmetricsthroughtheFirehose,installtheopen-sourceHMForwarder .

ToretrieveBOSHhealthmetricsoutsideoftheFirehose,installtheJMXBridge forPCFtile.

AllBOSH-deployedcomponentsgeneratethefollowingsystemhealthmetrics;thesemetricsalsoserveasKPIsfortheMySQLforPCFservice.

PersistentDisk

persistent.disk.percent

Description

PersistentdiskbeingconsumedbytheMySQLserviceinstance.

Use:Ifthepersistentdiskfillsup,MySQLwillbeunabletoprocessqueriesandrecoveryisdifficult.

Origin:JMXBridgeorBOSHHMType:percentFrequency:60s(default)

Recommendedmeasurement Averageoverlast10minutes

RecommendedalertthresholdsYellowwarning:>75Redcritical:>90

RecommendedresponseUpdatetheserviceinstancetouseaplanwithalargerpersistentdisk.Thisprocessmaytakesometime,asthedataiscopiedfromtheoriginalpersistentdisktoanewone.

RAM

system.mem.percent

Description

RAMbeingconsumedbytheMySQLserviceinstance.

Use:MySQLincreasesitsmemoryusageasthedatasetincreases.Thisisnormal,asmuchofthatRAMisusedtobufferIO.AslongasthereisenoughremainingRAMforotherprocessesontheinstance,theMySQLservershouldbeOK.

Origin:JMXBridgeorBOSHHMType:percentageFrequency:60s(default)

Recommendedmeasurement Averageoverlast10minutes

RecommendedalertthresholdsYellowwarning:>95Redcritical:>99

Recommendedresponse UpdatetheserviceinstancetoaplanwithmoreRAM.

CPU

system.cpu.percent

Description

CPUtimebeingconsumedbytheMySQLservice.

Use:AnodethatexperiencescontextswitchingorhighCPUusagewillbecomeunresponsive.Thisalsoaffectstheabilityofthenodetoreportmetrics.

Origin:JMXBridgeorBOSHHMType:percentFrequency:60s(default)

Recommendedmeasurement Averageoverlast10minutes

© Copyright Pivotal Software Inc, 2013-2018 38 2.1

Page 39: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

RecommendedalertthresholdsYellowwarning:>80Redcritical:>90

RecommendedresponseDeterminewhatisusingsomuchCPU.Ifitisfromnormalprocesses,updatetheserviceinstancetouseaplanwithlargerCPUcapacity.

AllMySQLMetricsInadditiontotheaboveKPIs,theMySQLserviceemitsthefollowingsmetricsthatcanbeusedformonitoringandalerting.

DataSource Description MetricUnit

/p.mysql/available Indicatesifthelocaldatabaseserverisavailableandresponding. boolean

/p.mysql/innodb/buffer_pool_free

ThenumberoffreepagesintheInnoDBBufferPool. pages

/p.mysql/innodb/buffer_pool_total

ThetotalnumberofpagesintheInnoDBBufferPool. pages

/p.mysql/innodb/buffer_pool_used

ThenumberofusedpagesintheInnoDBBufferPool. pages

/p.mysql/innodb/buffer_pool_utilization

TheutilizationoftheInnoDBBufferPool. fraction

/p.mysql/innodb/current_row_locks

Thenumberofcurrentrowlocks. locks

/p.mysql/innodb/data_reads Thenumberofdatareads. reads/second

/p.mysql/innodb/data_writes Thenumberofdatawrites. writes/second

/p.mysql/innodb/mutex_os_waits ThenumberofmutexOSwaits. events/second

/p.mysql/innodb/mutex_spin_rounds

Thenumberofmutexspinrounds. events/second

/p.mysql/innodb/mutex_spin_waits

Thenumberofmutexspinwaits. events/second

/p.mysql/innodb/os_log_fsyncs Thenumberoffsyncwritestothelogfile. writes/second

/p.mysql/innodb/row_lock_time Timespentinacquiringrowlocks. milliseconds

/p.mysql/innodb/row_lock_waits Thenumberoftimespersecondarowlockhadtobewaitedfor. events/second

/p.mysql/net/connections Thenumberofconnectionstotheserver. connection/second

/p.mysql/net/max_connectionsThemaximumnumberofconnectionsthathavebeeninusesimultaneouslysincetheserverstarted.

connections

/p.mysql/performance/com_delete Thenumberofdeletestatements. queries/second

/p.mysql/performance/com_delete_multi

Thenumberofdelete-multistatements. queries/second

/p.mysql/performance/com_insert Thenumberofinsertstatements. query/second

/p.mysql/performance/com_insert_select Thenumberofinsert-selectstatements. queries/second

/p.mysql/performance/com_replace_select

Thenumberofreplace-selectstatements. queries/second

/p.mysql/performance/com_select Thenumberofselectstatements. queries/second

/p.mysql/performance/com_update Thenumberofupdatestatements. queries/second

/p.mysql/performance/com_update_multi

Thenumberofupdate-multistatements. queries/second

/p.mysql/performance/created_tmp_disk_tables

Thenumberofinternalon-disktemporarytablescreatedeachsecondbytheserverwhileexecutingstatements.

table/second

/p.mysql/performance/created_tmp_files

Thenumberoftemporaryfilescreatedeachsecond. files/second

/p.mysql/performance/created_tmp_tables

Thenumberofinternaltemporarytablescreatedeachsecondbytheserverwhileexecutingstatements.

tables/second

© Copyright Pivotal Software Inc, 2013-2018 39 2.1

Page 40: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

/p.mysql/performance/cpu_utilization_percent

ThepercentoftheCPUinusebyallprocessesontheMySQLnode. percent

/p.mysql/performance/kernel_time

PercentageofCPUtimespentinkernelspacebyMySQL. percent

/p.mysql/performance/key_cache_utilization

Thekeycacheutilizationratio. fraction

/p.mysql/performance/open_files Thenumberofopenfiles. files

/p.mysql/performance/open_tables

Thenumberofoftablesthatareopen. tables

/p.mysql/performance/qcache_hits

Thenumberofquerycachehits. hits/second

/p.mysql/performance/queriesThenumberofstatementsexecutedbytheserver,excluding COM_PING andCOM_STATISTICS .

count

/p.mysql/performance/queries_delta

Thechangeinthe /performance/queries metricsincethelasttimeitwasemitted.

integergreaterthanorequaltozero

/p.mysql/performance/questions Thenumberofstatementsexecutedbytheserver. queries/second

/p.mysql/performance/slow_queries

Thenumberofslowqueries. queries/second

/p.mysql/performance/table_locks_waited

Thetotalnumberoftimesthatarequestforatablelockcouldnotbegrantedimmediatelyandawaitwasneeded.

number

/p.mysql/performance/threads_connected

Thenumberofcurrentlyopenconnections. connections

/p.mysql/performance/threads_running Thenumberofthreadsthatarenotsleeping. threads

/p.mysql/performance/user_time PercentageofCPUtimespentinuserspacebyMySQL. percent

/p.mysql/performance/max_connections

Themaximumpermittednumberofsimultaneousclientconnections. integer

/p.mysql/performance/open_files_limit

Thenumberoffilesthattheoperatingsystempermitsmysqld toopen. integer

/p.mysql/performance/open_tables

Thenumberoftablesthatareopen. integer

/p.mysql/performance/opened_tables

Thenumberoftablesthathavebeenopened. integer

/p.mysql/performance/opened_table_definitions

Thenumberof .frm filesthathavebeencached. integer

/p.mysql/rpl_semi_sync_master_no_tx

Thenumberoftransactionscommittedwithoutfolloweracknowledgement. integer

/p.mysql/rpl_semi_sync_master_tx_avg_wait_time

Theaveragetimetheleaderhaswaitedforthefollowertoaccepttransactions. microseconds

/p.mysql/rpl_semi_sync_master_wait_sessions

Thecurrentnumberofconnectionswaitingforasemi-synccommit. integer

/p.mysql/variables/read_only Whethertheserverisinread-onlymode boolean

DataSource Description MetricUnit

© Copyright Pivotal Software Inc, 2013-2018 40 2.1

Page 41: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

EventsthatInterruptServiceThistopicexplainseventsinthelifecycleofaMySQLforPivotalCloudFoundry(PCF)serviceinstancethatmaycausetemporaryserviceinterruptions.

StemcellorServiceUpdateAnoperatorupdatesastemcellversionortheirversionofMySQLforPCF.

Impact:AppsloseaccesstotheMySQLservicewhilePCFupdatestheserviceinstancetheyareboundto.Theserviceshouldresumewithin10-15minutes.

RequiredActions:None.Iftheupdatedeployssuccessfully,appsreconnectautomatically.

PlanChangeAdeveloperchangestheirserviceinstancetoprovideadifferentserviceplan,using cf update-service orAppsManager.

Impact:AppsloseaccesstotheMySQLservicewhilePCFupdatestheserviceinstancetheyareboundto.Theserviceshouldresumewithin10-15minutes.

RequiredActions:None.Iftheplanchangedeployssuccessfully,appsreconnectautomatically.

VMProcessFailureAprocess,liketheMySQLserver,crashesontheserviceinstanceVM.

Impact:

BOSH(monit)bringstheprocessbackautomatically.Dependingontheprocessandwhatitwasdoing,theservicemayexperience60-120secondsofdowntime.Untiltheprocessresumes,appsmaybeunabletouseMySQL,metricsorloggingmaystop,andotherfeaturesmaybeinterrupted.

RequiredActions:None.Iftheprocessresumescleanlyandwithoutmanualintervention,appsreconnectautomatically.

VMFailureAMySQLforPCFVMfailsandgoesofflineduetoeitheravirtualizationproblemorahosthardwareproblem.

Impact:

IftheBOSHResurrector isenabled(recommended),BOSHshoulddetectthefailure,recreatetheVM,andreattachthesamepersistentdiskandIPaddress.DowntimelargelydependsonhowquicklytheResurrectornotices,usually1-2minutes,andhowlongittakestheIaaStocreateareplacementVM.IftheResurrectorisnotenabled,someIaaSessuchasvSpherehavesimilarresurrectionorHAfeatures.AppscannotconnecttoMySQLuntiltheVMisrecreatedandtheMySQLserverprocessisresumed.BasedonpriorexperiencewithBOSHResurrector,typicaldowntimeis8-10minutes.

RequiredActions:WhentheVMcomesback,nofurtheractionshouldberequiredfortheappdevelopertocontinueoperations.

AZFailureAnAvailabilityZone(AZ)goesofflineentirelyorlosesconnectivitytootherAZs(netsplit).Thiscausesserviceinterruptioninmulti-AZPCFdeploymentswhereDiego hasplacedmultipleinstancesofaMySQL-usingappindifferentAZs.

Impact:

Someappinstancesmaystillbeabletoconnectandcontinueoperating.AppinstancesintheotherAZswillnotbeabletoconnect.

© Copyright Pivotal Software Inc, 2013-2018 41 2.1

Page 42: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

Downtime:Unknown

RequiredActions:Recoveryoftheapp/databaseconnectionshouldbeautomatic.Dependingontheapp,manualinterventionmayberequiredtocheckdataconsistency.

RegionFailureExample:Anentireregionfails,bringingPCFplatformcomponentsoffline.

Impact:

TheentirePCFplatformneedstobebroughtbackupmanually.Downtime:Unknown

RequiredActions:Eachserviceinstancemayneedtoberestoredindividuallydependingontherestoredstateoftheplatform.

© Copyright Pivotal Software Inc, 2013-2018 42 2.1

Page 43: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

UpgradingMySQLforPCFThistopicexplainshowtoupgradetheMySQLforPivotalCloudFoundry(PCF)serviceandexistingserviceinstances.Italsoexplainstheserviceinterruptionsthatcanresultfromservicechangesandupgradesandfromfailuresattheprocess,VM,andIaaSlevel.

UpgradeMySQLforPCFToupgradetheMySQLforPCFservice,youfollowthesameOpsManagerprocessthatyouusetoinstalltheserviceforthefirsttime.Yourconfigurationsettingsmigratetothenewversionautomatically.Toperformanupgrade:

1. ReviewtheReleaseNotesfortheversionyouareupgradingto.

2. DownloadthedesiredversionoftheproductfromPivotalNetwork .

3. NavigatetotheOpsManagerInstallationDashboardandclickImportaProducttouploadtheproductfile.

4. UndertheImportaProductbutton,click+nexttoMySQLforPCF.Thisaddsthetiletoyourstagingarea.

5. Clickthenewly-addedMySQLforPCFtiletoreviewitsconfigurationpanes.ClickSaveonanypaneswhereyoumakechanges.

6. ReturntotheInstallationDashboardandclickApplyChanges.

UpgradingtheMySQLforPCFserviceandserviceinstancescantemporarilyinterrupttheservice,asdescribedbelow.

UpgradeMySQLInstancesAfterupgradingtheMySQLforPCFservice,operatorscanruntheupgrade-allservicebrokererrandtoupgradeexistingserviceinstancestobeinsyncwiththenewversionoftheservice.

Bothoperatorsanddeveloperscanupgradeexistingserviceinstancesindividuallybyrunningthe cf update-service command.SeeManagingServiceInstanceswiththecfCLI .

ServiceInterruptionsServicechangesandupgradesandfailuresattheprocess,VM,andIaaSlevelcancauseoutagesintheMySQLforPCFservice,asdescribedbelow.

Readthissectionif:

Youareexperiencingaserviceinterruptionandarewonderingwhy.

Youareplanningtoupdateorchangeaserviceinstanceandwanttoknowifitmightcauseaserviceinterruption.

StemcellorServiceUpdateAnoperatorupdatesastemcellversionortheirversionofMySQLforPCF.

Impact:AppsloseaccesstotheMySQLservicewhilePCFupdatestheserviceinstancetheyareboundto.Theserviceshouldresumewithin10–15minutes.

RequiredActions:None.Iftheupdatedeployssuccessfully,appsreconnectautomatically.

PlanChangeAdeveloperchangestheirserviceinstancetoprovideadifferentserviceplan,using cf update-service orAppsManager.

Impact:AppsloseaccesstotheMySQLservicewhilePCFupdatestheserviceinstancetheyareboundto.Theserviceshouldresumewithin10–15minutes.

RequiredActions:None.Iftheplanchangedeployssuccessfully,appsreconnectautomatically.

© Copyright Pivotal Software Inc, 2013-2018 43 2.1

Page 44: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

© Copyright Pivotal Software Inc, 2013-2018 44 2.1

Page 45: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

TroubleshootingMySQLforPCFInthistopic:

TroubleshootingErrors

FailedInstallCannotCreateorDeleteServiceInstancesBrokerRequestTimeoutsCannotBindtoorUnbindfromServiceInstancesCannotConnecttoaServiceInstanceUpgradeAllInstancesFailsMissingLogsandMetrics

TroubleshootingComponents

BOSHProblemsConfigurationAuthenticationNetworkingQuotasFailingJobsandUnhealthyInstancesAZorRegionFailure

TechniquesforTroubleshooting

ParseaCloudFoundry(CF)ErrorMessageAccessBrokerandInstanceLogsandVMsRunServiceBrokerErrandstoManageBrokersandInstancesDetectOrphanedInstancesServiceInstancesSelecttheBOSHDeploymentforaServiceInstanceRetrieveAdminandRead-OnlyAdminCredentialsforaServiceInstanceReinstallaTileViewResourceSaturationandScalingIdentifyServiceInstanceOwnerMonitorQuotaSaturationandServiceInstanceCount

KnowledgeBase(Community)

FileaSupportTicket

Thistopicprovidesoperatorswithbasicinstructionsfortroubleshootingon-demandMySQLforPCF.

ForinformationontemporaryMySQLforPCFserviceinterruptions,seeServiceInterruptions.

TroubleshootingErrorsStarthereifyou’rerespondingtoaspecificerrorsorerrormessages.

FailedInstall

1. Certificateissues:Theon-demandbroker(ODB)requiresvalidcertificates.Ensurethatyourcertificatesarevalidandgeneratenewones ifnecessary.

2. Deployfails:Deployscanfailforavarietyofreasons.ViewthelogsusingOpsManagertodeterminewhythedeployisfailing.

3. Networkingproblems:

CloudFoundrycannotreachtheMySQLforPCFservicebrokerCloudFoundrycannotreachtheserviceinstances

© Copyright Pivotal Software Inc, 2013-2018 45 2.1

Page 46: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

TheservicenetworkcannotaccesstheBOSHdirector

4. Registerbrokererrandfails.

5. Thesmoketesterrandfails.

6. Resourcesizingissues:TheseoccurwhentheresourcesizesselectedforagivenplanarelessthantheMySQLforPCFservicerequirestofunction.CheckyourresourceconfigurationinOpsManagerandensurethattheconfigurationmatchesthatrecommendedbytheservice.

7. Otherservice-specificissues.

CannotCreateorDeleteServiceInstances

Ifdevelopersreporterrorssuchasthefollowing:

Instance provisioning failed: There was a problem completing your request. Please contact your operations team providing the following information: service: redis-acceptance, service-instance-guid: ae9e232c-0bd5-4684-af27-1b08b0c70089, broker-request-id: 63da3a35-24aa-4183-aec6-db8294506bac, task-id: 442, operation: create

1. IftheBOSHerrorshowsaproblemwiththedeploymentmanifest:

a. Downloadthemanifestfortheon-demandserviceinstancebyrunning:bosh download manifest service-instance_SERVICE-INSTANCE-GUID MY-SERVICE.yml.

b. Checkthemanifestforconfigurationerrors.

2. Tocontinuetroubleshooting,LogintoBOSH andtargettheMySQLforPCFserviceinstanceusingtheinstructionsonparsingaCloudFoundryerrormessage.

3. RetrievetheBOSHtaskIDfromtheerrormessageandrunoneofthefollowingcommandsdependingonyourOpsManagerversion:

OpsManagerVersion BOSHCommand

1.10andearlier bosh task TASK-ID

1.11 bosh2 task TASK-ID

1.12andlater bosh task TASK-ID

4. Ifyouneedmoreinformation,accessthebrokerlogsandusethe broker-request-id fromtheerrormessageabovetosearchthelogsformoreinformation.Checkfor:

AuthenticationerrorsNetworkerrorsQuotaerrors

BrokerRequestTimeoutsIfdevelopersreporterrorssuchas:

Server error, status code: 504, error code: 10001, message: The request to the service broker timed out: https://BROKER-URL/v2/service_instances/e34046d3-2379-40d0-a318-d54fc7a5b13f/service_bindings/aa635a3b-ef6d-41c3-a23f-55752f3f651b

1. ConfirmthatCloudFoundry(CF)isconnectedtotheservicebroker.

2. ChecktheBOSHqueuesize:

a. LogintoBOSHasanadmin.b. RunoneofthesecommandsdependingonyourOpsManagerversion:

1.10andearlier: bosh tasks

Note:ThiserrordoesnotapplyifyouareusingBOSHCLIv2.Inthatcase,totroubleshootpossibleproblemswiththemanifest,openitinatexteditorandinspectthemanifestthere.

© Copyright Pivotal Software Inc, 2013-2018 46 2.1

Page 47: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

1.11: bosh2 tasks1.12andlater: bosh tasks

3. Iftherearealargenumberofqueuedtasks,thesystemmaybeundertoomuchload.BOSHisconfiguredwithtwoworkersandonestatusworker,whichmaynotbesufficientresourcesforthelevelofload.Adviseappdeveloperstotryagainoncethesystemisunderlessload.

CannotBindtoorUnbindfromServiceInstances

InstanceDoesNotExist

Ifdevelopersreporterrorssuchas:

Server error, status code: 502, error code: 10001, message: Service broker error: instance does not exist`

Followthesesteps:

1. Type cf service MY-INSTANCE --guid .ThisconfirmsthatthetheMySQLforPCFserviceinstanceexistsinBOSHandCF,andreturnsaGUID.

2. UsingtheGUIDobtainedabove,runoneofthefollowingBOSHCLIcommandsdependingonyourOpsManagerversion:

OpsManagerVersion BOSHCommand

1.10andearlier bosh vms service-instance_GUID

1.11 bosh2 -d service-instance_GUID vms

1.12andlater bosh -d service-instance_GUID vms

IftheBOSHdeploymentisnotfound,ithasbeendeletedfromBOSH.ContactPivotalsupportforfurtherassistance.

OtherErrors

Ifdevelopersreporterrorssuchas:

Server error, status code: 502, error code: 10001, message: Service broker error: There was a problem completing your request. Please contact your operations team providing the following information: service: example-service, service-instance-guid: 8d69de6c-88c6-4283-b8bc-1c46103714e2, broker-request-id: 15f4f87e-200a-4b1a-b76c-1c4b6597c2e1, operation: bind

Tofindouttheexactissuewiththebindingprocess:

1. Accesstheservicebrokerlogs.

2. Searchthelogsforthe broker-request-id stringlistedintheerrormessageabove.

3. ContactPivotalsupportforfurtherassistanceifyouareunabletoresolvetheproblem.

4. Checkfor:

AuthenticationerrorsNetworkerrors

CannotConnecttoaServiceInstanceIfdevelopersreportthattheirappcannotuseserviceinstancesthattheyhavesuccessfullycreatedandbound:

Asktheusertosendapplicationlogsthatshowtheconnectionerror.Iftheerrorisoriginatingfromtheservice,thenfollowMySQLforPCF-specificinstructions.Iftheissueappearstobenetwork-related,then:

© Copyright Pivotal Software Inc, 2013-2018 47 2.1

Page 48: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

1. Checkthatapplicationsecuritygroups areconfiguredcorrectly.Accessshouldbeconfiguredfortheservicenetworkthatthetileisdeployedto.

2. EnsurethatthenetworkthePCFElasticRuntimetileisdeployedtohasnetworkaccesstotheservicenetwork.YoucanfindthenetworkdefinitionforthisservicenetworkintheOpsManagerDirectortile.

3. InOpsManagergointotheservicetileandseetheservicenetworkthatisconfiguredinthenetworkstab.

4. InOpsManagergointotheERTtileandseethenetworkitisassignedto.Makesurethatthesenetworkscanaccesseachother.

ServiceinstancescanalsobecometemporarilyinaccessibleduringupgradesandVMornetworkfailures.SeeServiceInterruptionsformoreinformation.

UpgradeAllInstancesFailsIfthe upgrade-all-service-instances errandfails,lookattheerrandoutputintheOpsManagerlog.

Ifaninstancefailstoupgrade,debugandfixitbeforerunningtheerrandagaintopreventanyfailureissuesfromspreadingtootheron-demandinstances.

OncetheOpsManagerlognolongerliststhedeploymentas failing ,re-runtheerrandtoupgradetherestoftheinstances.

MissingLogsandMetricsIfnologsarebeingemittedbytheon-demandbroker,checkthatyoursyslogforwardingaddressiscorrectinOpsManager.

1. Ensureyouhaveconfiguredsyslogforthetile.

2. Ensurethatyouhavenetworkconnectivitybetweenthenetworksthatthetileisusingandthesyslogdestination.Ifthedestinationisexternal,youneedtousethepublicip VMextensionfeatureavailableinyourOpsManagertileconfigurationsettings.

3. VerifythattheFirehoseisemittingmetrics:

a. Installthe cf nozzle plugin

b. Run cf nozzle -f ValueMetric | grep --line-buffered "on-demand-broker/MY-SERVICE" tofindlogsfromyourserviceinthecf nozzle output.

Ifnometricsappearwithinfiveminutes,verifythatthebrokernetworkhasaccesstotheLoggregatorsystemonallrequiredports.

ContactPivotalsupportifyouareunabletoresolvetheissue.

TroubleshootingComponentsGuidanceoncheckingforandfixingissuesinon-demandservicecomponents.

BOSHProblems

MissingBOSHDirectorUUID

IfusingtheBOSHCLIv1,re-addthe director_uuid tothemanifest:

1. Run bosh status --uuid andrecordthe director_uuid valuefromtheoutput.

Note:ThiserrordoesnotoccurifyouareusingBOSHCLIv2

© Copyright Pivotal Software Inc, 2013-2018 48 2.1

Page 49: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

2. Editthemanifestandaddthe director_uuid: DIRECTOR-UUID fromthelaststepatthetopofthemanifest.

Formore,seeDeploymentIdentification intheBOSHdocs.

LargeBOSHQueue

On-demandservicebrokersaddtaskstotheBOSHrequestqueue,whichcanbackupandcausedelayunderheavyloads.AnappdeveloperwhorequestsanewMySQLforPCFinstancesees create in progress intheCloudFoundryCommandLineInterface(cfCLI)untilBOSHprocessesthequeuedrequest.

OpsManagercurrentlydeploystwoBOSHworkerstoprocessitsqueue.FutureversionsofOpsManagerwillletusersconfigurethenumberofBOSHworkers.

Configuration

Serviceinstancesinfailingstate

YoumayhaveconfiguredaVM/DisktypeintileplanpageinOpsManagerthatisinsufficientlylargefortheMySQLforPCFserviceinstancetostart.Seetile-specificguidanceonresourcerequirements.

Authentication

UAAChanges

IfyouhaverotatedanyUAAusercredentialsthenyoumayseeauthenticationissuesintheservicebrokerlogs.

Toresolvethis,redeploytheMySQLforPCFtileinOpsManager.Thisprovidesthebrokerwiththelatestconfiguration.

NetworkingCommonissuesinclude:

1. NetworklatencywhenconnectingtotheMySQLforPCFserviceinstancetocreateordeleteabinding.

Solution:Tryagainorimprovenetworkperformance

2. NetworkfirewallrulesareblockingconnectionsfromtheMySQLforPCFservicebrokertotheserviceinstance.

Solution:OpentheMySQLforPCFtileinOpsManagerandcheckthetwonetworksconfiguredintheNetworkspane.Ensurethatthesenetworksallowaccesstoeachother.

3. NetworkfirewallrulesareblockingconnectionsfromtheservicenetworktotheBOSHdirectornetwork.

Solution:EnsurethatserviceinstancescanaccesstheDirectorsothattheBOSHagentscanreportin.

4. Appscannotaccesstheservicenetwork.

Note:YoumustensurethatanychangestoUAAcredentialsarereflectedintheOpsManager credentials taboftheElasticRuntimetile.

© Copyright Pivotal Software Inc, 2013-2018 49 2.1

Page 50: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

Solution:ConfigureCloudFoundryapplicationsecuritygroupstoallowruntimeaccesstotheservicenetwork.

5. ProblemsaccessingBOSH’sUAAortheBOSHdirector.

Solution:FollownetworktroubleshootingandcheckthattheBOSHdirectorisonline.

ValidateServiceBrokerConnectivitytoServiceInstances1. Tovalidateyoucan bosh2 ssh ontotheMySQLforPCFservicebroker:

WithBOSHCLIv2:Targetthedeployment,andreachtheserviceinstance.WithBOSHCLIv1:Downloadthebrokermanifestandtargetthedeployment,thentrytoreachtheserviceinstance.

2. IfnoBOSH task-id appearsintheerrormessage,lookinthebrokerlogusingthe broker-request-id fromthetask.

ValidateAppAccesstoServiceInstance

Use cf ssh toaccesstotheappcontainer,thentryconnectingtotheMySQLforPCFserviceinstanceusingthebindingincludedintheVCAP_SERVICES

environmentvariable.

Quotas

PlanQuotaissues

Ifdevelopersreporterrorssuchas:

Message: Service broker error: The quota for this service plan has been exceeded. Please contact your Operator for help.

1. Checkyourcurrentplanquota.

2. Increasetheplanquota.

3. LogintoOpsManager.

4. Reconfigurethequotaontheplanpage.

5. Deploythetile.

6. Findwhoisusingtheplanquotaandtaketheappropriateaction.

GlobalQuotaIssues

Ifdevelopersreporterrorssuchas:

Message: Service broker error: The quota for this service has been exceeded. Please contact your Operator for help.

1. Checkyourcurrentglobalquota.

2. Increasetheglobalquota.

© Copyright Pivotal Software Inc, 2013-2018 50 2.1

Page 51: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

3. LogintoOpsManager.

4. Reconfigurethequotaontheon-demandsettingspage.

5. Deploythetile.

6. Findoutwhoisusingthequotaandtaketheappropriateaction.

FailingJobsandUnhealthyInstancesTodeterminewhetherthereisanissuewiththeMySQLforPCFservicedeployment,inspecttheVMs.Todoso,runoneofthefollowingcommands:

OpsManagerVersion BOSHCommand

1.10orearlier bosh vms --vitals service-instance_GUID

1.11 bosh2 -d service-instance_GUID vms --vitals

1.12andlater bosh -d service-instance_GUID vms --vitals

Foradditionalinformation,runoneofthefollowingcommands:

OpsManagerVersion BOSHCommand

1.10andearlier bosh instances --ps --vitals

1.11 bosh2 instances --ps --vitals

1.12andlater bosh instances --ps --vitals

IftheVMisfailing,followtheservice-specificinformation.Anyunadvisedcorrectiveactions(suchasrunningBOSH restart onaVM)cancauseissuesintheserviceinstance.

AfailingprocessorfailingVMmightcomebackautomaticallyafteratemporaryserviceoutage.SeeVMProcessFailureandVMFailure.

AZorRegionFailureFailuresattheIaaSlevel,suchasAvailabilityZone(AZ)orregionfailures,caninterruptserviceandrequiremanualrestoration.SeeAZFailureandRegionFailure.

TechniquesforTroubleshootingInstructionsoninteractingwiththeon-demandservicebrokerandon-demandserviceinstanceBOSHdeployments,andonperforminggeneralmaintenanceandhousekeepingtasks

ParseaCloudFoundry(CF)ErrorMessageFailedoperations(create,update,bind,unbind,delete)resultinanerrormessage.YoucanretrievetheerrormessagelaterbyrunningthecfCLIcommand cf service INSTANCE-NAME .

© Copyright Pivotal Software Inc, 2013-2018 51 2.1

Page 52: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

$ cf service myservice

Service instance: myserviceService: super-dbBound apps:Tags:Plan: dedicated-vmDescription: Dedicated InstanceDocumentation url:Dashboard:

Last OperationStatus: create failedMessage: Instance provisioning failed: There was a problem completing your request. Please contact your operations team providing the following information: service: redis-acceptance, service-instance-guid: ae9e232c-0bd5-4684-af27-1b08b0c70089, broker-request-id: 63da3a35-24aa-4183-aec6-db8294506bac, task-id: 442, operation: createStarted: 2017-03-13T10:16:55ZUpdated: 2017-03-13T10:17:58Z

Usetheinformationinthe Message fieldtodebugfurther.ProvidethisinformationtoPivotalSupportwhenfilingaticket.

The task-id fieldmapstotheBOSHtaskID.FormoreinformationonafailedBOSHtask,usethe bosh task TASK-ID .

The broker-request-guid mapstotheportionoftheOn-DemandBrokerlogcontainingthefailedstep.Accessthebrokerlogthroughyoursyslogaggregator,oraccessBOSHlogsforthebrokerbytyping bosh logs broker 0 .Ifyouhavemorethanonebrokerinstance,repeatthisprocessforeachinstance.

AccessBrokerandInstanceLogsandVMsBeforefollowingtheproceduresbelow,logintothecfCLI andtheBOSHCLI .

AccessBrokerLogsandVM(s)

YoucanaccesslogsusingOpsManager byclickingontheLogstabinthetileanddownloadingthebrokerlogs.

ToaccesslogsusingtheBOSHCLI,dothefollowing:

1. Identifytheon-demandbroker(ODB)deploymentbyrunningoneofthefollowingcommands,dependingonyourOpsManagerversion:

OpsManagerVersion BOSHCommand

1.10andearlier bosh deployments

1.11 bosh2 deployments

1.12andlater bosh deployments

2. ForBOSHCLIv1only:

a. Run bosh download manifest ODB-DEPLOYMENT-NAME odb.yml todownloadtheODBmanifest.b. SelecttheODBdeploymentusing bosh deployment odb.yml .

3. ViewVMsinthedeploymentusingoneofthefollowingcommands:

OpsManagerVersion BOSHCommand

1.10andearlier bosh instances

1.11 bosh2 -d DEPLOYMENT-NAME instances

1.12andlater bosh -d DEPLOYMENT-NAME instances

4. SSHontotheVMbyrunningoneofthefollowingcommands:

OpsManagerVersion BOSHCommand

© Copyright Pivotal Software Inc, 2013-2018 52 2.1

Page 53: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

1.10andearlier bosh ssh service-instance_GUID

1.11 bosh2 -d service-instance_GUID ssh

1.12andlater bosh -d service-instance_GUID ssh

OpsManagerVersion BOSHCommand

5. Downloadthebrokerlogsbyrunningoneofthefollowingcommands:

OpsManagerVersion BOSHCommand

1.10andearlier bosh logs service-instance_GUID

1.11 bosh2 -d service-instance_GUID logs

1.12andlater bosh -d service-instance_GUID logs

ThearchivegeneratedbyBOSHorOpsManagerincludesthefollowinglogs:

LogName Description

broker.logRequeststotheon-demandbrokerandtheactionsthebrokerperformswhileorchestratingtherequest(e.g.generatingamanifestandcallingBOSH).Startherewhentroubleshooting.

broker_ctl.log Controlscriptlogsforstartingandstoppingtheon-demandbroker.

post-start.stderr.log

Errorsthatoccurduringpost-startverification.

post-start.stdout.log

Post-startverification.

drain.stderr.log Errorsthatoccurwhilerunningthedrainscript.

AccessServiceInstanceLogsandVMs1. Totargetanindividualserviceinstancedeployment,retrievetheGUIDofyourserviceinstancewiththecfCLIcommand cf service MY-SERVICE --guid .

2. ForBOSHCLIv1only:

a. Run bosh status --uuid toretrievetheBOSHDirectorGUID.

b. TodownloadyourBOSHmanifestfortheservice,run bosh download manifest service-instance_BOSH-DIRECTOR-GUID MANIFEST.ymlusingtheGUIDyoujustobtainedandafilenameyouwanttosavethemanifestas.

c. Editthefollowinglineintheserviceinstancemanifestthatyoujustsaved,toincludethecurrentBOSHDirectorGUID:

director_uuid: BOSH-DIRECTOR-GUID

d. Run bosh deployment MANIFEST.yml toselectthedeploymentusingtheDirectorUUID.

3. ViewVMsinthedeploymentusingoneofthefollowingcommands:

OpsManagerVersion BOSHCommand

1.10andearlier bosh instances

1.11 bosh2 -d DEPLOYMENT-NAME instances

1.12andlater bosh -d DEPLOYMENT-NAME instances

4. SSHontoaVMbyrunningoneofthefollowingcommands:

OpsManagerVersion BOSHCommand

1.10andearlier bosh ssh service-instance_GUID

1.11 bosh2 -d service-instance_GUID ssh

1.12andlater bosh -d service-instance_GUID ssh

5. Downloadtheinstancelogsbyrunningoneofthefollowingcommands:

Note:“GUID”and“UUID”meanthesamething.

© Copyright Pivotal Software Inc, 2013-2018 53 2.1

Page 54: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

OpsManagerVersion BOSHCommand

1.10andearlier bosh logs service-instance_GUID

1.11 bosh2 -d service-instance_GUID logs

1.12andlater bosh -d service-instance_GUID logs

RunServiceBrokerErrandstoManageBrokersandInstancesFromtheBOSHCLI,youcanrunservicebrokererrandsthatmanagetheservicebrokersandperformmassoperationsontheserviceinstancesthatthebrokerscreated.Theseservicebrokererrandsinclude:

register-broker registersabrokerwiththeCloudControllerandlistsitintheMarketplace

deregister-broker deregistersabrokerwiththeCloudControllerandremovesitfromtheMarketplace

upgrade-all-service-instances upgradesexistinginstancesofaservicetoitslatestinstalledversion

delete-all-service-instances deletesallinstancesofservice

orphan-deployments detects“orphan”instancesthatarerunningonBOSHbutnotregisteredwiththeCloudController

Torunerrands:

1. ForBOSHCLIv1only:Selectthebrokerdeploymentbyrunningthiscommand:bosh deployment BOSH_MANIFEST.yml

2. RunoneofthefollowingcommandsdependingonyourOpsManagerversion:

OpsManagerVersion BOSHCommand

1.10andearlier bosh run errand ERRAND_NAME

1.11 bosh2 -d DEPLOYMENT_NAME run-errand ERRAND_NAME

1.12andlater bosh -d DEPLOYMENT_NAME run-errand ERRAND_NAME

Examples:bosh run errand deregister-broker bosh2 -d DEPLOYMENT-NAME run-errand deregister-broker

RegisterBroker

The register-broker errandregistersthebrokerwithCloudFoundryandenablesaccesstoplansintheservicecatalog.Runthiserrandwheneverthebrokerisre-deployedwithnewcatalogmetadatatoupdatetheCloudFoundrycatalog.

Planswithdisabledserviceaccessarenotvisibletonon-adminCloudFoundryusers(includingOrgManagersandSpaceManagers).AdminCloudFoundryuserscanseeallplansincludingthosewithdisabledserviceaccess.

Theerranddoesthefollowing:

RegisterstheservicebrokerwithCloudController.

Enablesserviceaccessforanyplansthathavetheradiobuttonsetto enabled inthetileplanpage.

Disablesserviceaccessforanyplansthathavetheradiobuttonsetto disabled inthetileplanpage.

Doesnothingforanyforanyplansthathavetheradiobuttonsetto manual .

Toruntheerrand,dothefollowing:

1. ForBOSHCLIv1only:Selectthebrokerdeploymentbyrunningthiscommand:bosh deployment BOSH_MANIFEST.yml

2. RunoneofthefollowingcommandsdependingonyourOpsManagerversion:

OpsManagerVersion BOSHCommand

© Copyright Pivotal Software Inc, 2013-2018 54 2.1

Page 55: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

1.10andearlier bosh run errand register-broker

1.11 bosh2 -d DEPLOYMENT-NAME run-errand register-broker

1.12andlater bosh -d DEPLOYMENT-NAME run-errand register-broker

OpsManagerVersion BOSHCommand

DeregisterBroker

ThiserrandderegistersabrokerfromCloudFoundry.

Theerranddoesthefollowing:

DeletestheservicebrokerfromCloudController

Failsifthereareanyserviceinstances,withorwithoutbindings

UsetheDeleteAllServiceInstanceserrandtodeleteanyexistingserviceinstances.

Toruntheerrand,dothefollowing:

1. ForBOSHCLIv1only:Selectthebrokerdeploymentbyrunningthecommand:bosh deployment BROKER_MANIFEST.yml .

2. RunoneofthefollowingcommandsdependingonyourOpsManagerversion:

OpsManagerVersion BOSHCommand

1.10andearlier bosh run errand deregister-broker

1.11 bosh2 -d DEPLOYMENT-NAME run-errand deregister-broker

1.12andlater bosh -d DEPLOYMENT-NAME run-errand deregister-broker

UpgradeAllServiceInstances

IfyouhavemadechangestotheplandefinitionoruploadedanewtileintoOpsManager,youmaywanttoupgradealltheMySQLforPCFserviceinstancestothelatestsoftware/plandefinition.

The upgrade-all-service-instances erranddoesthefollowing:

Collectsalloftheserviceinstancestheon-demandbrokerhasregistered.

Foreachinstancetheerrandserially:

Issuesanupgradecommandtotheon-demandbroker.Re-generatestheserviceinstancemanifestbasedonitslatestconfigurationfromthetile.Deploysthenewmanifestfortheserviceinstance.Waitsforthisoperationtocomplete,thenproceedstothenextinstance.

AddstoaretrylistanyinstancesthathaveongoingBOSHtasksatthetimeofupgrade.

Retriesanyinstancesintheretrylistuntilallareupgraded.

Ifanyinstancefailstoupgrade,theerrandfailsimmediately.Thispreventssystemicproblemsfromspreadingtotherestofyourserviceinstances.Runtheerrandbyfollowingeitheroftheproceduresbelow.

Toruntheerrand,youcaneitherselecttheerrandthroughtheOpsManagerUIandhaveitrunwhenyouclickApply Changes ,ordothefollowing:

1. ForBOSHCLIv1only:Selectthebrokerdeploymentbyrunningthiscommand:bosh deployment BOSH_MANIFEST.yml

2. RunoneofthefollowingcommandsdependingonyourOpsManagerversion:

OpsManagerVersion BOSHCommand

1.10andearlier bosh run errand upgrade-all-service-instances

1.11 bosh2 -d DEPLOYMENT-NAME run-errand upgrade-all-service-instances

© Copyright Pivotal Software Inc, 2013-2018 55 2.1

Page 56: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

1.12andlater bosh -d DEPLOYMENT-NAME run-errand upgrade-all-service-instancesOpsManagerVersion BOSHCommand

DeleteAllServiceInstances

Thiserranddeletesallserviceinstancesofyourbroker’sserviceofferingineveryorgandspaceofCloudFoundry.ItusestheCloudControllerAPItodothis,andthereforeonlydeletesinstancestheCloudControllerknowsabout.ItwillnotdeleteorphanBOSHdeployments.

OrphanBOSHdeploymentsdon’tcorrespondtoaknownserviceinstance.Whilerare,orphandeploymentscanoccur.Usethe orphan-deployments errandtoidentifythem.

Theerranddoesthefollowing:

Unbindsallapplicationsfromtheserviceinstances.

Deletesallserviceinstancessequentially.

Checksifanyinstanceshavebeencreatedwhiletheerrandwasrunning.

Ifnewly-createdinstancesaredetected,theerrandfails.

Toruntheerrand,dothefollowing:

1. ForBOSHCLIv1only:Selectthebrokerdeploymentbyrunningthecommand:bosh deployment BROKER_MANIFEST.yml .

2. RunoneofthefollowingcommandsdependingonyourOpsManagerversion:

OpsManagerVersion BOSHCommand

1.10andearlier bosh run errand delete-all-service-instances

1.11 bosh2 -d service-instance_GUID delete-deployment

1.12andlater bosh -d service-instance_GUID delete-deployment

DetectOrphanedInstancesServiceInstances

Aserviceinstanceisdefinedas‘orphaned’whentheBOSHdeploymentfortheinstanceisstillrunning,buttheserviceisnolongerregisteredinCloudFoundry.

The orphan-deployments errandcollatesalistofservicedeploymentsthathavenomatchingserviceinstancesinCloudFoundryandreturnthelisttotheoperator.ItisthenuptotheoperatortoremovetheorphanedBOSHdeployments.

Toruntheerrand,dothefollowing:

1. ForBOSHCLIv1only:Selectthebrokerdeploymentbyrunningthecommand:bosh deployment BROKER_MANIFEST.yml

2. RuntheerrandusingoneofthefollowingcommandsdependingonyourOpsManagerversion:

OpsManagerVersion BOSHCommand

1.10andearlier bosh run errand orphan-deployments

1.11 bosh2 -d DEPLOYMENT-NAME run-errand orphan-deployments

1.12andlater bosh -d DEPLOYMENT-NAME run-errand orphan-deployments

Iforphandeploymentsexist,theerrandscriptwill:

Exitwithexitcode10

Outputalistofdeploymentnamesundera [stdout] header

WARNING:Useextremecautionwhenrunningthiserrand.Youshouldonlyuseitwhenyouwanttototallydestroyalloftheon-demandserviceinstancesinanenvironment.

© Copyright Pivotal Software Inc, 2013-2018 56 2.1

Page 57: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

Provideadetailederrormessageundera [stderr] header

Forexample:

[stdout][{"deployment_name":"service-instance_80e3c5a7-80be-49f0-8512-44840f3c4d1b"}]

[stderr]Orphan BOSH deployments detected with no corresponding service instance in Cloud Foundry. Before deleting any deployment it is recommended to verify the service instance no longer exists in Cloud Foundry and any data is safe to delete.

Errand 'orphan-deployments' completed with error (exit code 10)

ThesedetailswillalsobeavailablethroughtheBOSH /tasks/ APIendpointforuseinscripting:

$ curl 'https://bosh-user:bosh-password@bosh-url:25555/tasks/task-id/output?type=result' | jq .{ "exit_code": 10, "stdout": "[{"deployment_name":"service-instance_80e3c5a7-80be-49f0-8512-44840f3c4d1b"}]\n", "stderr": "Orphan BOSH deployments detected with no corresponding service instance in Cloud Foundry. Before deleting any deployment it is recommended to verify the service instance no longer exists in Cloud Foundry and any data is safe to delete.\n", "logs": { "blobstore_id": "d830c4bf-8086-4bc2-8c1d-54d3a3c6d88d" }}

Ifnoorphandeploymentsexist,theerrandscriptwill:

Exitwithexitcode0

Stdoutwillbeanemptylistofdeployments

Stderrwillbe None

[stdout][]

[stderr]None

Errand 'orphan-deployments' completed successfully (exit code 0)

Iftheerrandencountersanerrorduringrunningitwill:

Exitwithexit1

Stdoutwillbeempty

Anyerrormessageswillbeunderstderr

Tocleanuporphanedinstances,runthefollowingcommandoneachinstance:

OpsManagerVersion BOSHCommand

1.10andearlier bosh delete deployment service-instance_SERVICE-INSTANCE-GUID

1.11 bosh2 delete-deployment service-instance_SERVICE-INSTANCE-GUID

1.12andlater bosh delete-deployment service-instance_SERVICE-INSTANCE-GUID

SelecttheBOSHDeploymentforaServiceInstance

ThisisanadditionaltroubleshootingoptionforBOSHCLIv1only.ItdoesnotapplytotheBOSHCLIv2.

1. RetrievetheGUIDofyourserviceinstancewiththecommand cf service YOUR-SERVICE-INSTANCE --guid .

WARNING:RunningthiscommandmayleaveIaaSresourcesinanunusablestate.

© Copyright Pivotal Software Inc, 2013-2018 57 2.1

Page 58: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

2. TodownloadyourBOSHmanifestfortheservice,run bosh download manifest service-instance_SERVICE-INSTANCE-GUID myservice.yml usingtheGUIDyoujustobtainedandafilenameyouwanttousewhensavingthemanifest.

3. Run bosh deployment MY-SERVICE.yml toselectthedeployment.

RetrieveAdminandRead-OnlyAdminCredentialsforaServiceInstance

Toretrievetheadminandread-onlyadmincredentialsforaserviceinstance,performthefollowingsteps:

1. IdentifytheservicedeploymentbyGUID.

2. LogintoBOSH .

3. DownloadthemanifestfortheserviceinstanceandaddtheGUIDifusingtheBOSHCLIv1.

4. Lookinthemanifestforthe admin and roadmin credentials.

ReinstallaTile

ToreinstalltheMySQLforPCFv2.xtile,seetheReinstallingMySQLforPivotalCloudFoundryversion2andabove KnowledgeBasearticle.

ViewResourceSaturationandScaling

BOSHCLIv2:Viewingstatistics

Toviewusagestatisticsforanyservicedothefollowing:

1. ForBOSHCLIv1only:Selectthebrokerdeploymentbyrunningthiscommand:bosh deployment BOSH_MANIFEST.yml

2. RunthefollowingcommandsdependingonyourOpsManagerversion:

OpsManagerVersion BOSHCommands

v1.10andearlier

RuntheBOSHCLIv1command bosh vms --vitals .Toviewprocess-levelinformation,run bosh instances --ps .

v1.11RuntheBOSHCLIv2command bosh2 -d DEPLOYMENT-NAME vms --vitals .Toviewprocess-levelinformation,runbosh2 -d DEPLOYMENT-NAME instances --ps

v1.12andlaterRuntheBOSHCLIv2command bosh -d DEPLOYMENT-NAME vms --vitals .Toviewprocess-levelinformation,runbosh2 -d DEPLOYMENT-NAME instances --ps

IdentifyServiceInstanceOwner

IfyouwanttoidentifywhichappsareusingaspecificserviceinstancefromtheBOSHdeploymentsname,youcanrunthefollowingsteps:

1. Takethedeploymentnameandstripthe service-instance_ leavingyouwiththeGUID.

SkipthisstepifyouareusingtheBOSHCLIv2.YoucannotdownloadthemanifestwiththeBOSHCLIv2.Openitinatexteditorinstead.

© Copyright Pivotal Software Inc, 2013-2018 58 2.1

Page 59: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

2. LogintoCFasanadmin.

3. Obtainalistofallservicebindingsbyrunningthefollowing: cf curl /v2/service_instances/GUID/service_bindings

4. Theoutputfromtheabovecurlgivesyoualistof resources ,witheachitemreferencingaservicebinding,whichcontainsthe APP-URL .Tofindthename,org,andspacefortheapp,runthefollowing:

a. cf curl APP-URL andrecordtheappnameunder entity.nameb. cf curl SPACE-URL toobtainthespace,usingthe entity.space_url fromtheabovecurl.Recordthespacenameunder entity.namec. cf curl ORGANIZATION-URL toobtaintheorg,usingthe entity.organization_url fromtheabovecurl.Recordtheorganizationnameunder entity.name

MonitorQuotaSaturationandServiceInstanceCount

QuotasaturationandtotalnumberofserviceinstancesareavailablethroughODBmetricsemittedtoLoggregator.Themetricnamesareshownbelow:

MetricName Description

on-demand-broker/SERVICE-NAME-MARKETPLACE/quota_remaining globalquotaremainingforallinstancesacrossallplans

on-demand-broker/SERVICE-NAME-MARKETPLACE/PLAN-NAME/quota_remaining quotaremainingforaparticularplan

on-demand-broker/SERVICE-NAME-MARKETPLACE/total_instances totalinstancescreatedacrossallplans

on-demand-broker/SERVICE-NAME-MARKETPLACE/PLAN-NAME/total_instances totalinstancescreatedforagivenplan

KnowledgeBase(Community)FindtheanswertoyourquestionandbrowseproductdiscussionsandsolutionsbysearchingthePivotalKnowledgeBase .

FileaSupportTicketYoucanfileasupporttickethere .Besuretoprovidetheerrormessagefrom cf service YOUR-SERVICE-INSTANCE .

Tohelpexpeditetroubleshooting,alsoprovideyourservicebrokerlogs,yourserviceinstancelogsandBOSHtaskoutput,ifyourcf service YOUR-SERVICE-INSTANCE outputincludesa task-id .

Note:Whenrunning cf curl ensurethatyouqueryallpages,becausetheresponsesarelimitedtoacertainnumberofbindingsperpage.Thedefaultis50.Tofindthenextpagecurlthevalueunder next_url

Note:Quotametricsarenotemittedifnoquotahasbeenset.

© Copyright Pivotal Software Inc, 2013-2018 59 2.1

Page 60: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

UsingMySQLforPCFThistopicprovidesinstructionsfordevelopersusingtheMySQLforPivotalCloudFoundryv2servicefortheirPivotalCloudFoundry(PCF)apps.MySQLprovidesarelationaldatabaseforappsanddevices.

TheseproceduresusetheCloudFoundryCommandLineInterface(cfCLI).YoucanalsouseAppsManager toperformthesametasksusingagraphicalUI.

Forgeneralinformation,seeManagingServiceInstanceswiththecfCLI .

PrerequisitesTouseMySQLforPCFv2withyourPCFapps,youneed:

APCFinstallationwithMySQLforPCF installedandlistedintheMarketplace

ASpaceDeveloper orAdminaccountonthePCFinstallation

Alocalmachinewiththefollowinginstalled:

abrowserashelltheCloudFoundryCommand-LineInterface (cfCLI)theLinuxwatch command

Tologinto theorgandspacecontainingyourapp

TheCreate-BindProcessBecauseeveryappandserviceinPCFisscopedtoaspace ,anappcanonlyuseaserviceifaninstanceoftheserviceexistsinthesamespace.

TouseMySQLinaPCFapp:

1. UsethecfCLI orAppsManager tologintotheorgandspacethatcontainstheapp.

2. MakesureaninstanceoftheMySQLforPCFserviceexistsinthesamespaceastheapp.

IfthespacedoesnotalreadyhaveaMySQLforPCFinstance,createone.IfthespacealreadyhasaMySQLforPCFinstance,youcanbindyourapptotheexistinginstanceorcreateanewinstancetobindtoyourapp.

3. BindtheapptotheMySQLforPCFserviceinstance,toenabletheapptouseMySQL.

ConfirmServiceAvailabilityForanapptouseaservice,1)theservicemustbeavailableintheMarketplaceforitsspaceand2)aninstanceoftheservicemustexistinitsspace.

YoucanconfirmbothoftheseusingthecfCLIasfollows.

1. TofindoutifaMySQLforPCFv2serviceisavailableintheMarketplace:

a. Enter cf marketplaceb. Iftheoutputlists p.mysql inthe service column,on-demandMySQLforPCFisavailable.Ifitisnotavailable,askyouroperatortoinstallit.

$ cf marketplaceGetting services from marketplace in org my-org / space my-space as [email protected] plans description[...]p.mysql db-small Dedicated instances of MySQL service to provide a relational database[...]

2. ToconfirmthataMySQLforPCFv2instanceisrunninginthespace

© Copyright Pivotal Software Inc, 2013-2018 60 2.1

Page 61: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

a. Enter cf servicesb. Any p.mysql listingsinthe service columnareserviceinstancesofon-demandMySQLinthespace.

$ cf servicesGetting services in org my-org / space my-space as [email protected] service plan bound apps last operationmy-instance p.mysql db-small create succeeded

Youcanbindyourapptoanexistinginstanceorcreateanewinstancetobindtoyourapp.

Create,Use,andManageServiceInstances

CreateaServiceInstanceUnlikepre-provisionedservices,on-demandservicesarecreatedasynchronously,notimmediately.The watch commandshowsyouwhenyourserviceinstanceisreadytobindanduse.

TocreateaninstanceoftheMySQLforPCFv2service,run cf create-service

:

1. Enter cf create-service p.mysql db-small SERVICE-INSTANCE

Where SERVICE-INSTANCE isanameyouchoosetoidentifytheserviceinstance.Thisnamewillappearunder service [sic]inoutputfrom cf

services .

2. Enter watch cf services andwaitforthe last operation foryourinstancetoshowas create succeeded .

$ cf create-service p.mysql db-small my-instance

Creating service my-instance in org my-org / space my-space as [email protected]

$ watch cf services

Getting services in org my-org / space my-space as [email protected] service plan bound apps last operationmy-instance p.mysql db-small create succeeded

Ifyougetanerror,seeTroubleshootingInstances.

BindaServiceInstancetoYourAppForanapptouseaservice,youmustbindittoaserviceinstance.Dothisafteryoupushorre-pushtheappusing cf push .

TobindanapptoaMySQLinstancerun $ cf bind-service

.

1. Enter cf bind-service APP SERVICE-INSTANCE

Where APP istheappyouwanttousetheMySQLserviceinstanceand SERVICE-INSTANCE isthenameyousuppliedwhenyouran cf create-service .

$ cf bind-service my-app my-instance

Binding service mydb to my-app in org my-org / space test as [email protected]: Use 'cf push' to ensure your env variable changes take effect

UsetheMySQLServiceinYourAppToaccesstheMySQLservicefromyourapp:

1. Run cf env APP-NAME withthenameoftheappboundtotheMySQLforPCFinstance.

© Copyright Pivotal Software Inc, 2013-2018 61 2.1

Page 62: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

2. Intheoutput,notetheconnectionstringslistedinthe VCAP_SERVICES > credentials objectfortheapp.

3. Inyourappcode,calltheMySQLserviceusingtheconnectionstrings.

ForhowtocodeyourapptouseMySQLmessaging,seeAboutUsingPivotalMySQL>ClientDocumentationintheMySQLdocumentation .

UpdatetoaLargerServiceInstanceAsappsandtheirdatabasesgrow,itmaybenecessarytoupdatetheserviceinstancetoalargerplan.

1. Enter cf update-service SERVICE-INSTANCE -p PLAN

Where PLAN istheplanyouwanttoupgradetheserviceinstanceto.

$ cf update-service my-instance -p db-large

Thisdoesnotrequirearebindingofyourapp.However,whiletheinstanceisbeingmigratedtoanewserviceinstance,thedatabasewillbeunavailableforseveralminutes.

UnbindaServiceInstancetoYourAppTostopanappfromusingaserviceitnolongerneeds,unbinditfromtheserviceinstanceusing cf unbind-

service.

1. Enter cf unbind-service APP SERVICE-INSTANCE

Where APP istheappyouwanttostopusingtheMySQLserviceinstanceand SERVICE-INSTANCE isthenameyousuppliedwhenyouran cf create-

service .

$ cf unbind-service my-app my-instance

Unbinding app my-app from service my-instance in org my-org / space my-space as [email protected]

DeleteaServiceInstanceTodeleteaserviceinstance,run cf delete-

service.

1. Enter cf delete-service SERVICE-INSTANCE

Where SERVICE-INSTANCE isthenameoftheservicetodelete.

$ cf delete-service my-instance

Are you sure you want to delete the service my-instance ? yDeleting service my-service in org my-org / space my-space as [email protected]

2. Enter watch cf service SERVICE-INSTANCE andwaitfora Service instance not found errorindicatingthattheinstancenolongerexists.

Youcannotdeleteaserviceinstancethatanappisboundto.

ExampleApplicationTohelpapplicationdevelopersgetstartedwithMySQLforPCF,wehaveprovidedanexampleapplication,whichcanbedownloadedhere .InstructionscanbefoundintheincludedREADME.

MySQLforPCFToolsThefollowingtoolsletdevelopersaccesstheirMySQLforPCFdatabases.

© Copyright Pivotal Software Inc, 2013-2018 62 2.1

Page 63: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

PivotalMySQLWebDatabaseManagementAppThePivotalMySQLWebappprovidesaweb-basedUIformanagingMySQLforPCFdatabases.Thefreeappletsyouviewandoperateontables,indexes,constraints,andotherdatabasestructures,anddirectlyexecuteSQLcommands.

YoucanrunthePivotalMySQLWebappintwoways:

Standaloneonyourownmachine

DeployedtoPCF

IfyoudeployPivotalMySQLWebtoPCF,youcanconfigureitinthedeploymentmanifesttoautomaticallybindtoaspecificserviceinstance.

SeethePivotalMySQLWebcoderepo anddemovideo ,forhowtoinstallandrunPivotalMySQLWeb.

Command-LineInterfaceMySQLPluginToconnecttoyourMySQLforPCFdatabasesfromacommandline,usetheCloudFoundryCommand-LineInterface(cfCLI)MySQLplugin.Thepluginletsyou:

Inspectdatabasesfordebugging.

Manuallyadjustdatabaseschemaorcontentsindevelopmentenvironments.

Dumpandrestoredatabases.

ToinstallthecfCLIMySQLplugin,runthefollowing:

$ cf install-plugin -r "CF-Community" mysql-plugin

Formoreinformation,seethecf-mysql-plugin repository.

© Copyright Pivotal Software Inc, 2013-2018 63 2.1

Page 64: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

CustomizingMySQLforPCFThistopicprovidesinstructionsfordeveloperscustomizingtheirMySQLforPCFserviceinstances.

TheseproceduresusetheCloudFoundryCommandLineInterface(cfCLI).YoucanalsouseAppsManager toperformthesametasksusingagraphicalUI.

ForgeneralinformationaboutusingMySQLforPCF,seeUsingMySQLforPCF.

ConfiguringMySQLforPCFserviceinstancesareconfiguredbydefaultwithindustrybestpractices.Formorespecificusecases,MySQLforPCFserviceinstancescanbemorecustomizedviathecfCLI.

ProvideOptionalParameters

Youcancreateserviceinstancebypassingoptionalparametersto cf create-service

usingthe -c flag.The -c flagacceptsavalidJSONobjectcontaining

service-specificconfigurationparameters,providedeitherin-lineorinafile.

TheMySQLservicebrokersupportsthefollowingparameters:

Key Type Default Description

enable_lower_case_table_names Boolean false

Whensettotrue,setsMySQL’s lower_case_table_names propertyto 1 .Formoreinformation,consulttheMySQLdocumentation .Mayonlybesetwhencreatingaserviceinstance.

Ifyouencounteranerrorusingoptionalparameters,seeTroubleshootingInstances

© Copyright Pivotal Software Inc, 2013-2018 64 2.1

Page 65: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

MigratingaDatabasetoMySQLforPCFv2ThispageprovidesinstructionsonhowtomigrateyourMySQLforPCFv1.xdatabasestoMySQLforPCFv2.Toperformthemigration,youusethebackupandrestoreprocessasfollows:

1. Preemptivelycreateanewv2serviceinstancetominimizedowntime.

2. Stoptraffictotheolddatabaseandtakeabackup.

3. Importthebackupintoyournewserviceinstance.

4. Connectyourapptothenewdatabaseandrestarttheapp.

PrerequisitesTominimizedowntimewhilemigrating,preemptivelycreateanewserviceinstance.

Theapplicationsourcecodecanuse p.mysql asavalidkeyforaccessingthedatabase.

Createanewserviceinstanceof p.mysql withapersistentdisklargeenoughforthedata.Ifyoudonothaveaninstance,followtheinstructionstocreateanewserviceinstanceinthesamespaceasyourexistingserviceinstance.

BackUpYourCurrentDatabaseIfyouaremigratingfromaMySQLforPCFv1.xdatabase,pleaserefertotheinstructionsbelow.IfyouaremigratingfromanotherMySQLprovider,pleaserefertotheirdocumentationontakingaMySQLbackup.

BackUpYourMySQLforPCFv1.xInstance1. Stopanytraffictoyourexistingdatabasebystoppingtheapplication:

$ cf stop my-appStopping app my-app in org my-org / space my-space as [email protected]

2. Unbindyourapplicationfromtheoldserviceinstance:

$ cf unbind-service my-app my-old-instanceUnbinding app my-app from service my-old-instance in org my-org / space my-space as [email protected]

3. Useacfapplicationtocreateansshtunnel toconnecttoyouroldserviceinstance.Thetunnelmayappearasthoughitishanging.

AnsshtunnelisnecessaryastheMySQLserviceisonlyaccessiblewithintheCloudFoundrynetwork.

4. Takeabackupoftheexistingdatabaseinaseparateshell:

$ mysqldump --single-transaction --add-drop-table --add-locks --create-options --disable-keys --extended-insert --quick --set-charset --routines --flush-privileges -u USERNAME -p -h 0 -P 63306 DB_NAME > backup.sql

DB_NAMEisthe“name”propertyfromyourservice-keyUSERNAMEisthe“username”propertyfromyourservice-key63306istheavailableportyouconfiguredinthesshtunnelonyourlocalmachineYouwillbepromptedforapasswordafterenteringthepreviouscommandwhichisthe“password”propertyfromyourservice-key

5. Killthesshtunnel

Donotbindthenewserviceinstancetoyourapplication.We’lldothatlater.

Sinceyourapplicationisnowstopped,you’llneedanotherapplicationforthesshtunnel.Ifyoudon’thavearunningapp,youcancloneandcfpushthissampleapp fortunneling.YoucanuseanyrunningappinthesameOrg/Space

© Copyright Pivotal Software Inc, 2013-2018 65 2.1

Page 66: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

RestoretoYourNewDatabaseThissectionprovidesstepstorestoreyourbackuptoanewserviceinstanceofMySQLforPCF:

1. Usecfsshtocreateatunnel toremotelyaccessyournewMySQLinstance.

2. Inanothershell,restoreyourbackuptothenewserviceinstanceviathesshtunnel:

$ mysql -u USERNAME -p -h 0 -P 63306 -D service_instance_db < backup.sql

USERNAMEisthe“username”propertyfromyourservice-key63306istheavailableportyouconfiguredinthesshtunnelonyourlocalmachinebackup.sqlisthepathtothebackuponyourlocalmachineYouwillbepromptedforapasswordafterenteringthepreviouscommandwhichisthe“password”propertyfromyourservice-key

3. Validatethatdatathatyouexpecttoseehasbeenimportedintothenewserviceinstancebyusingthefollowingcommandtoenteramysqlshell.

$ mysql -u USERNAME -p -h 0 -P 63306 -D service_instance_db

USERNAMEisthe“username”propertyfromyourservice-key63306istheavailableportyouconfiguredinthesshtunnelonyourlocalmachineYouwillbepromptedforapasswordafterenteringthepreviouscommandwhichisthe“password”propertyfromyourservice-key

4. Exitthemysqlshellandkillthesshtunnel

5. Bindtheapplicationtothenewserviceinstance

$ cf bind-service my-app my-new-instanceBinding service my-new-instance to app my-app in org my-org / space my-space as [email protected]: Use 'cf restage my-app' to ensure your env variable changes take effect

6. Restagetheapptorestarttheappwiththenewchanges

$ cf restage my-appRestaging app my-app in org my-org / space my-space as [email protected]...[...]

7. YourapplicationisnowusingyournewMySQLforPivotalCloudFoundryv2databaseandshouldbeoperationalagain.

DeletetheOldDatabaseAfterrebindingandrestagingyourappstoconfirmthatmigrationwassuccessful,Pivotalrecommendssavingresourcesbydeletingtheolddatabaseinstance.

Toperformthedeletion,runthefollowingcommand:

cf delete-service SERVICE_INSTANCE

Where SERVICE_INSTANCE isthenameofyourolddatabaseinstance.

Forexample:

$ cf delete-service my-instance

© Copyright Pivotal Software Inc, 2013-2018 66 2.1

Page 67: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

MySQLEnvironmentVariablesThistopicprovidesareferencefortheenvironmentvariablesthatCloudFoundrystoresforMySQLforPCFserviceinstances.Thesevariablesincludethecredentialsthatappsusetoaccesstheserviceinstances.

VCAP_SERVICESApplicationsrunninginCloudFoundrygainaccesstotheboundserviceinstancesviaanenvironmentvariablecredentialshashcalledVCAP_SERVICES .Anexamplehashisshowbelow:

{ "p.mysql": [{ "label": "p.mysql", "name": "my-instance", "plan": "db-medium", "provider": null, "syslog_drain_url": null, "tags": [ "mysql" ], "credentials": { "hostname": "10.0.0.20", "jdbcUrl": "jdbc:mysql://10.0.0.20:3306/service_instance_db?user=fefcbe8360854a18a7994b870e7b0bf5\u0026password=z9z6eskdbs1rhtxt", "name": "service_instance_db", "password": "z9z6eskdbs1rhtxt", "port": 3306, "uri": "mysql://fefcbe8360854a18a7994b870e7b0bf5:[email protected]:3306/service_instance_db?reconnect=true", "username": "fefcbe8360854a18a7994b870e7b0bf5" }, "volume_mounts": [] }}

Youcansearchforyourservicebyits name ,givenwhencreatingtheserviceinstance,ordynamicallyviathe tags or label properties.The credentials

propertycanbeusedasfollows:

The credentials properties uri , name , hostname , port , username , password ,and jdbcUrl provideaccesstotheMySQLprotocol.

IncommonwithallservicesinPivotalCloudFoundry (PCF),the VCAP_SERVICES environmentvariableforanapplicationisonlymodifiedwhentheapplicationisboundtoaserviceinstance.Userswillneedto cf unbind-

service, cf bind-

serviceand cf restage theirappinthisscenario.

© Copyright Pivotal Software Inc, 2013-2018 67 2.1

Page 68: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

TroubleshootingInstancesThistopicprovidesbasicinstructionsforappdeveloperstroubleshootingOn-DemandMySQLforPCF.

TemporaryOutagesMySQLforPCFserviceinstancescanbecometemporarilyinaccessibleduringupgradesandVMornetworkfailures.SeeServiceInterruptionsformoreinformation.

ErrorsYoumayseeanerrorwhenusingtheCloudFoundryCommand-LineInterface(cfCLI)toperformbasicoperationsonaMySQLforPCFserviceinstance:

cf create

cf update

cf bind

cf unbind

cf delete

ParseaCloudFoundry(CF)ErrorMessageFailedoperations(create,update,bind,unbind,delete)resultinanerrormessage.YoucanretrievetheerrormessagelaterbyrunningthecfCLIcommand cf service INSTANCE-NAME .

$ cf service myservice

Service instance: myserviceService: super-dbBound apps:Tags:Plan: dedicated-vmDescription: Dedicated InstanceDocumentation url:Dashboard:

Last OperationStatus: create failedMessage: Instance provisioning failed: There was a problem completing your request. Please contact your operations team providing the following information: service: redis-acceptance, service-instance-guid: ae9e232c-0bd5-4684-af27-1b08b0c70089, broker-request-id: 63da3a35-24aa-4183-aec6-db8294506bac, task-id: 442, operation: createStarted: 2017-03-13T10:16:55ZUpdated: 2017-03-13T10:17:58Z

Usetheinformationinthe Message fieldtodebugfurther.ProvidethisinformationtoPivotalSupportwhenfilingaticket.

The task-id fieldmapstotheBOSHtaskID.FormoreinformationonafailedBOSHtask,usethe bosh task TASK-ID .

The broker-request-guid mapstotheportionoftheOn-DemandBrokerlogcontainingthefailedstep.Accessthebrokerlogthroughyoursyslogaggregator,oraccessBOSHlogsforthebrokerbytyping bosh logs broker 0 .Ifyouhavemorethanonebrokerinstance,repeatthisprocessforeachinstance.

RetrieveServiceInstanceInformation1. Logintothespacecontainingtheinstanceorfailedinstance.

$ cf login

© Copyright Pivotal Software Inc, 2013-2018 68 2.1

Page 69: © Copyright Pivotal Software Inc, 2013-present · MySQL for Pivotal Cloud Foundry This guide describes setting up and using MySQL for Pivotal Cloud Foundry (PCF) as an on-demand

2. Ifyoudonotknowthenameoftheserviceinstance,run cf services toseealistingofallserviceinstancesinthespace.Theserviceinstancesarelistedinthe name column.

$ cf servicesGetting services in org my-org / space my-space as [email protected] service plan bound apps last operationmy-instance p.mysql db-small create succeeded

3. Run cf service SERVICE-INSTANCE-NAME toretrievemoreinformationaboutaspecificinstance.

4. Run cf service SERVICE-INSTANCE-NAME --guid toretrievetheGUIDoftheinstance,whichisusefulfordebugging.

SelecttheBOSHDeploymentforaServiceInstanceThisisanadditionaltroubleshootingoptionforBOSHCLIv1only.ItdoesnotapplytotheBOSHCLIv2.

1. RetrievetheGUIDofyourserviceinstancewiththecommand cf service YOUR-SERVICE-INSTANCE --guid .

2. TodownloadyourBOSHmanifestfortheservice,run bosh download manifest service-instance_SERVICE-INSTANCE-GUID myservice.yml usingtheGUIDyoujustobtainedandafilenameyouwanttousewhensavingthemanifest.

3. Run bosh deployment MY-SERVICE.yml toselectthedeployment.

KnowledgeBase(Community)FindtheanswertoyourquestionandbrowseproductdiscussionsandsolutionsbysearchingthePivotalKnowledgeBase .

FileaSupportTicketYoucanfileasupporttickethere .Besuretoprovidetheerrormessagefrom cf service YOUR-SERVICE-INSTANCE .

Tohelpexpeditetroubleshooting,ifpossiblealsoprovideyourservicebrokerlogs,serviceinstancelogs,andBOSHtaskoutput.Yourcloudoperatorshouldbeabletoobtainthesefromyourerrormessage.

© Copyright Pivotal Software Inc, 2013-2018 69 2.1