Instance Usage Suggestions
DB Instances
DB Instance Types
- Primary/Standby
- A primary/standby pair provides an HA architecture. It is suitable for production databases of large and medium enterprises in the Internet, Internet of Things (IoT), retail e-commerce sales, logistics, gaming, and other sectors.
- When a primary instance is being created, a standby instance is provisioned along with it to provide data redundancy. The standby instance is invisible to you after being created.
- If a failover occurs due to a primary instance failure, your database client will be disconnected for a short period of time. The client needs to be able to reconnect to the instance.
- Single
- A single-node architecture is more cost-effective than primary/standby pairs.
- It is only recommended for development and testing of microsites, and small and medium enterprises, or for learning about RDS.
- If a fault occurs on a single instance, the instance cannot recover in a timely manner.
Instance Classes
- General-purpose
CPU resources are shared with other general-purpose DB instances on the same physical machine. CPU usage is maximized through resource overcommitment. This instance class is a cost-effective option and suitable for scenarios where performance stability is not critical.
Database Connection
- Configure RDS for MySQL parameters for your workloads.
- Keep an appropriate number of active connections.
- Periodically release persistent connections because maintaining them may generate a large cache and use up memory.
Reliability and Availability
- Select primary/standby DB instances for production databases.
- Deploy primary and standby instances in different AZs.
- Create read replicas and enable read/write splitting for workloads involving frequent read/write operations.
- Change instance classes during off-peak hours.
- Select an instance class and storage space appropriate to your workloads.
- After scaling up your DB instance, scale up its read replicas in a timely manner to prevent service exceptions caused by insufficient storage of read replicas.
Backup and Restoration
- To prevent backup failures, create manual backups during off-peak hours and tailor the time window for automated backups to your workload requirements.
- Set the backup cycle to All for DB instances that process many write requests every day.
- Configure a backup retention period suited to your service demands. The default value is 7 days.
- Set the local retention period of binlogs as required. The default value is 0, indicating that local binlogs are deleted once they are successfully backed up to OBS.
- Before restoring tables to a specified point in time, check whether any large tables without primary keys were deleted before the selected point in time. If yes, it is difficult to estimate when the restoration can be complete.
- Select the right storage type before creating a DB instance. DB instances using local SSDs cannot be restored to existing instances.
- If a DB instance is deleted, its automated full backups and binlog backups are also deleted. Perform manual backup for all data before deleting a DB instance.
- Configure a custom recycling policy to ensure that any instances that are deleted by mistake can be rebuilt.
SQL Audit
- Enable Audit Logging when periodic audits are required.
- Enable SQL Explorer when SQL analysis is required.
Routine O&M
- Periodically check slow query logs and error logs to identify problems in advance.
- Periodically check the resource usage of DB instances. If the resources are insufficient, scale up the resources in a timely manner.
- Monitor instance metrics. If any metric is beyond its expected range, address related issues as soon as possible.
- Run the SELECT statement before deleting or modifying a record.
Security
- Prevent your database from being accessed from the Internet. If you want to allow the access from the Internet, bind an EIP to your DB instance.
- Use SSL to connect to your DB instance.
Parent topic: Suggestions on Using RDS for MySQL
- DB Instances
- Database Connection
- Reliability and Availability
- Backup and Restoration
- SQL Audit
- Routine O&M
- Security