简体   繁体   English

没有明显原因的 AWS EC2 实例空间不足

[英]Aws EC2 instance running out of space without apparent reason

I have an Amazon EC2 instance with two docker containers that gets out of space every 20/25 days.我有一个带有两个 docker 容器的 Amazon EC2 实例,每 20/25 天就会出现空间不足的情况。
Filesystem Size Used Avail Use%
/dev/xvda1 50G 40G 10G 80%
Already tried du -hs * | sort -h已经尝试过du -hs * | sort -h du -hs * | sort -h in many folders but couldn't find big folders or something like it. du -hs * | sort -h在许多文件夹中,但找不到大文件夹或类似的东西。
Is there any other way to proceed?还有其他方法可以继续吗?

This could be caused by the extensive logging done by the Docker container, if you use the following command:如果您使用以下命令,这可能是由 Docker 容器完成的大量日志记录引起的:

docker logs [container_id] | wc -l

You will see that the container is filled with logs.您将看到容器中充满了日志。 Imagine if all of this are stored in memory, of course the EC2's memory will be exhausted too right?想象一下,如果所有这些都存储在 memory 中,当然 EC2 的 memory 也会用完吧? Not really because the OS redirects not-so-used memory contents to the machine's swap.并不是因为操作系统将不常用的 memory 内容重定向到机器的交换。 You can check if my guess is right using the command below:您可以使用以下命令检查我的猜测是否正确:

grep Swap /proc/meminfo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM