Create a Read-replica AWS RDS
- Databases will be used by different applications for performing CRUD operations. This might overwhelm your db.
- So we go with DB Replications and redirect requests, There is a better alternative.
- There are some applications (like BI) and some other apps which retrieve the data only and app servers & Web Servers will use more retrieve calls than modification (CUD)
- The typical usage looks like this
- We can use read-replicas as shown below
- The Replication can be created in same/different region.
- The Replicated Database will allow only read operations.
- In any kind of needs (like primary db failed etc) we can convert read replica to accept update requests, this is called as promoting read-replica.
- Creating Read-replica
-
Ensure you have some db
-
Create Read Replica from console.
- Select the DB and Click on Actions => Read Replica.
- Read Replica will not be enabled if backup retention period is 0.
-
Create Read Replica from cli
aws rds create-db-instance-read-replica --db-instance-identifier 'qtmrsrrep' --source-db-instance-identifier 'qtmrs'
-
Create One-Time RDS Backup
- Console:
- CLI
aws rds create-db-snapshot --db-snapshot-identifier 'qtmrsbkpcli' --db-instance-identifier 'qtmrs'
- This snapshot can be copied to other region & from that snapshot creating an rds instance.
Restore from S3
- AWS Supports restoring backup files of mysql from s3 buckets
- Create a backup of mysql db Refer Here for cli based backup created
- upload the backup to s3 bucket
- Now use the Restore from S3 bucket option