Running out of disk space, MySQL (VM azure) - mysql

I created replication in Microsoft Azure Virtual Machine .
I'm using MySQL and working with sql workbench (windows).
yesterday I discovered that my 250 GB storage are full and replication stopped.
this log wrote,
Timestamp, Thread, Type, Details
2015-07-29 23:26:44, 1672, Warning, Disk is full writing '.\database123-relay-bin.000164' (Errcode: 28 - No space left on device). Waiting for someone to free space...
and I created another 250 GB external storage.
I have 2 Q :
how can I create queries and use data within two difference storage ?
is it the right thing to do? to create another storage or there is a way to create flexible storage
?
that i found is this : http://www.psce.com/blog/2012/05/07/running-out-of-disk-space-on-mysql-partition-a-quick-rescue/
but it not help , need help and Guidance
this is another option that i found :
how to extend C drive size of Azure VM

Use data disks for storing application data from your Azure VMs. The largest data disk size available is 1TB. If you require more space, you can stripe more than one data disk together. Avoid using the OS disk for storing application data because you will run into this issue of limited space. Also avoid using the temporary disk for storing application data as it is not persistent. You cannot extend the OS disk size, but if you use data disks, you can start with a smaller data disk and increase its size as your application grows.
Learn more about Azure disks here: https://msdn.microsoft.com/en-us/library/azure/Dn790303.aspx

Related

Cloud SQL resize would make me lose data?

We currently have a database hosted in Google Cloud SQL. We are paying almost 100$ but we use less than 5% of our size. Our configs are:
Version: MySQL 8.0
Machine Type: High Memory 4 vCPU, 26 GB
Storage Type: SSD
Storage capacity: 100GB
I was thinking of switching to Machine Type High Memory to Lightweight.
Would this delete my current database data?
You can scale up and down the memory and te CPU without data loss. Your database will be unavailable (you need to stop and to start it again with the new machine type configuration). Don't be afraid, you can do this
At, the opposite, you can scale up but not to scale down the storage capacity. If you want to achieve that, you need to export the data outside of your database, to delete the current Cloud SQL instance and to create a new one with a smallest disk. And then to reimport the data.

How to identify AWS RDS Scaling conditions

I have an application that is hosted in AWS ECS and having the database in AWS RDS. I'm using a microservice-based container architecture for my application. The frontend of the application is in Angular and Backends are in Java and Python. Right now, the database size is ~1GB. The database size will increase day by day as the scraped data will be inserted daily.
Right now, some queries are taking 4-6 seconds to execute. We need to host this application to the public and there are a lot of users will be using the application. So when we load tested the application with 50 users, I found that the CPU of RDS reached 100% and some queries had taken more than 60 seconds to execute and then timed-out. Also, the CPU and memory of other microservices (frontend and backend) are normal. I have tried vertically scaling the application up to 64GB RAM and 4 vCPUs but still, this condition remains.
Is this an issue with the query or can I do anything with the database server configuration?
The RDS storage I'm using is 100GB with a general-purpose SSD. So, I guess there will be only 300 IOPS, right? I'm planning to use RDS read replicas but before that, I need to know is there anything that I need to do for improving the performance? Any database configurations etc?
I also not have a good idea about the MySQL connection count. Right now, it is using a total of 24 connections. Do I need to change the connection count also?
Query Optimisation
As Tim pointed out, try and optimise the queries. Since you have more data getting inserted, consider indexing the table and make the queries to use indexed columns if possible. also consider archiving unused old data.
number of connections
If you have control over the code, you can make use of database pools to control the number of connections that your applications can use.
CPU usage
the CPU usage is highly related to the performance of the queries, once you optimise the queries, the CPU usage should come down.
disk usage
Use the cloudwatch metrics to monitor the disk usage, based on that, you can decide on a provisioned IOPS disk.
hope this helps.

GCP SQL Cloud - Empty MySQL Database taking 1.2GB of storage space

I'm just looking for a clarification as the documentation state that an empty, just created, SQL Instance should only take 250Mb approximately.
Quoting from documentation about anything I could find on storage space:
MySQL Second Generation instances: The most recent 7 automated backups, and all on-demand backups, are retained. They are charged at the backup storage rate. Binary logs use storage space (not backup space), and are charged as storage.
For the purpose of this test, binary logging is disabled.
MySQL Second Generation [...]: Storage is calculated based on the amount of storage you have provisioned for your instance. Storage for backups is charged by how much space your backups are using. Storage is charged whether your instance is on or off.
Again, freshly created instance. It should be 0 storage space.
A newly created database uses about 270MB of space for system tables and InnoDB logs. If you create a per-use instance but do not use it, you are still charged for the storage cost.
This is where I got the idea about "250 MB" as initial storage space.
As you can see however, a newly created database takes around 1.2GB.
I'd like some clarification on it if someone has any.
Sources:
https://cloud.google.com/sql/faq#storage_limits
https://cloud.google.com/sql/docs/mysql/pricing#2nd-gen-storage-networking-prices
I've been looking into this and the thing that you should take into account is that, the information you quoted about Cloud SQL MySQL empty instances occupying around 270MB is for first generation instances, not for second generation ones. I think that answers your question.
At first I interpreted that the same way as you did, but the only points where 270MB empty instances are specified are here and here which are within the "MySQL First Generation Pricing" category on the right.
Hope this helps.

How to free up space in a MySQL Amazon RDS instance

We are using an Amazon RDS instance and it ran out of free storage space. Looking into the issue we dropped a no-longer required table. Amazon's monitoring tool showed that 1Gb of space was now available.
Further investigation showed that another table had 7 million entries, so we removed 5 million of them (using a simple delete command). However now the Free Storage Space has dropped to almost 1/2 Gb. We are dangerously close to running out of space again.
I (naively) assumed that deleting entries from a table would reclaim space. Why is this not the case? Do I need to perform some form of manual cleanup operation? Why did performing the delete cause nearly 1/2 Gb of free space to be used (looking at the table the size was 2677Mb before the delete and is now 2961Mb!)
Thanks,
Phil
You may have unused indexes in your database which maybe taking up space. Percona makes tools and patches for MySQL to collect index usage data.
Check these links:
User statistics(index statistics
pt-index usage
You can also have a look at these:
New table_io_waits_summary_by_index_usage table in performance_schema in MySQL 5.6
New INDEX_STATISTICS table in the information_schema
I'll recommend to use performance schema provided you use MySQL version 5.6 or higher. Also you can have look at MONyog- Mysql Monitoring tool. It include tools to monitor different performance metrics of the MySQL server, there's a disk info feature in it which might help you in this issue.

How can I tell the raw size of a MySQL DB snapshots in Amazon RDS?

When I launch an Amazon MySQL database instance in RDS, I choose the amount of Allocated Storage for it.
When I create a snapshot (either manually or with the automatic backup), it says under "Storage" the same size as the size allocated for the instance, even though my database did not reach that size.
Since the pricing (or the free tier) in Amazon is dependent on the amount of storage used, I would like to know the real storage size I'm using, rather than the size allocated by the original database.
From looking at the Account Activity, and from knowing how mysqldump works, I would guess the snapshot does not really include the empty space allocated.
I was interested in the answer to this question and a google search brought me here. I was surprised to see that although there is an accepted, upvoted answer, it does not actually answer the question that was asked.
The question asked is:
How can I tell the raw size of a MySQL DB snapshots in Amazon RDS?
However, the accepted answer is actually the answer to this question:
Am I charged for the allocated size of the source database when I take an RDS snapshot from it.
As to the the original question, AFAICT, there is no API or console function to determine the storage used by an RDS snapshot. The DBSnapshot resource has allocated_storage (ruby, java), but this returns the storage maximum size requested when the database was created. This mirrors the AWS RDS console:
One might have thought this would be broken out on the AWS bill, but it provides very little details. For RDS:
The S3 part of the bill is even less helpful:
Conclusion, there is no way to tell the raw size of a MySQL DB snapshot in Amazon RDS.
RDS is being stored through EBS according to FAQ:
Amazon RDS uses EBS volumes for database and log storage.
EBS doesn't store empty blocks, according to its pricing page:
Because data is compressed before being saved to Amazon S3, and Amazon EBS does not save empty blocks, it is likely that the snapshot size will be considerably less than your volume size.
And takes space only for changed blocks after initial snapshot was made, according to details page:
If you have a device with 100 GB of data but only 5 GB has changed after your last snapshot, a subsequent snapshot consumes only 5 additional GB and you are billed only for the additional 5 GB of snapshot storage, even though both the earlier and later snapshots appear complete.
RDS backups are block level full virtual machine snapshots; no mysqldump at all is involved. Given this fact, each of your snapshots will use exactly the same ammount of storage as your production instance at the moment the backup took place.