Disaster Recovery is the Recovery of your application and data from the production or real-time environment once any disaster hits a region. Disaster can be anything, it may be a natural disaster like Hurricane or some engineering human error like defect. As per research, average Companies invest 7% of their Budget in Disaster Recovery.
Metrics to measure DR:
1. RTO(Recovery Time Objective) - It is the maximum amount of time a workload can remain offline, it is dependent on the SLA (Service Level Agreement- a promise by Google Cloud for availability of service).
2. RPO(Recovery Point Objective) - It is the maximum amount of time for which you can afford to lose your data.
Factors for choosing the correct DR Pattern :
1. Budget.
2. Availability of Application / Services.
3. RPO and RTO.
GCP Console Commands :
Create secondary read-Only instance:
gcloud sql instances create replica-first-admin --master-instance-name=primary-beforedr-admin --region=us-west1
Connect to MySql instance:
gcloud sql connect replica-first-admin --user=root
Simulate a disaster by switching off the primary instance. we need to remove our [replica-first-admin] from the [primary-beforedr-admin]. Enter Y after running the below command.
gcloud sql instances patch replica-first-admin --no-enable-database-replication
Turn off the primary-beforedr-admin
gcloud sql instances patch primary-beforedr-admin --activation-policy NEVER
Cross-region replica of new primary instance (replica-first-[your-name]) with the name replica-second-admin:
gcloud sql instances create replica-second-admin --master-instance-name=replica-first-admin --region=us-east1
Delete the old primary instance to avoid confusion, Brain-split. Where you write to the old instance and a new instance, making the data inconsistent.
gcloud sql instances delete primary-beforedr-admin
Ещё видео!