DB Instance Becoming Read-Only Due to Insufficient Storage
Scenario
The following error is displayed for an RDS for MySQL instance:
The MySQL server is running with the --read-only option so it cannot execute this statement
Troubleshooting
- Go to the instance details page and check whether the storage is full.
- Log in to the database and check the read_only variable.
show variables like 'read_only';
- From the previous steps, you can find that the storage space is full and the instance status has changed to read-only. As a result, the SQL statement fails to be executed.
Solution
- For insufficient storage caused by increased workload data, scale up storage space.
If the original storage has reached the maximum, upgrade the specifications first.
- If too much data is stored, delete unnecessary historical data.
- If the instance becomes read-only, you need to contact technical support to cancel the read-only status first.
- To clear up space, you can optimize tables with a high fragmentation rate during off-peak hours.
To delete data of an entire table, run DROP or TRUNCATE. To delete part of table data, run DELETE and OPTIMIZE TABLE.
- If binlog files occupy too much space, clear local binlogs.
- If temporary files generated by sorting queries occupy too much storage space, optimize your SQL queries.
Parent topic: Performance Issues
- Scenario
- Troubleshooting
- Solution