我无法弄清楚AWS如何在ElasticBeanstalk上设置Docker“精简池”,以及如何填充它。 我的docker精简池正在填满,导致我的应用程序在试图写入磁盘时崩溃。
这是从容器内部:
>df -h > /dev/xvda1 25G 1.4G 24G 6%
事实上,EBS有一个25GB的磁盘分配给它; 1.6 GB是什么du -sh /返回。
在EC2之外,它开始无害…(通过lvs )
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert docker-pool docker twi-aot--- 11.86g 37.50 14.65
但是,文件系统很快会以只读方式重新装载。 通过dmesg:
[2077620.433382] Buffer I/O error on device dm-4, logical block 2501385 [2077620.437372] EXT4-fs warning (device dm-4): ext4_end_bio:329: I/O error -28 writing to inode 4988708 (offset 0 size 8388608 starting block 2501632) [2077620.444394] EXT4-fs warning (device dm-4): ext4_end_bio:329: I/O error [2077620.473581] EXT4-fs warning (device dm-4): ext4_end_bio:329: I/O error -28 writing to inode 4988708 (offset 8388608 size 5840896 starting block 2502912) [2077623.814437] Aborting journal on device dm-4-8. [2077649.052965] EXT4-fs error (device dm-4): ext4_journal_check_start:56: Detected aborted journal [2077649.058116] EXT4-fs (dm-4): Remounting filesystem read-only
回到EC2的实例,Docker报道:(来自docker info )
Pool Name: docker-docker--pool Pool Blocksize: 524.3 kB Base Device Size: 107.4 GB Backing Filesystem: ext4 Data file: Metadata file: Data Space Used: 12.73 GB Data Space Total: 12.73 GB Data Space Available: 0 B Metadata Space Used: 3.015 MB Metadata Space Total: 16.78 MB Metadata Space Available: 13.76 MB Thin Pool Minimum Free Space: 1.273 GB
LVS转储此信息:
--- Logical volume --- LV Name docker-pool VG Name docker LV UUID xxxxxxxxxxxxxxxxxxxxxxxxxxxx LV Write Access read/write LV Creation host, time ip-10-0-0-65, 2017-03-25 22:37:38 +0000 LV Pool metadata docker-pool_tmeta LV Pool data docker-pool_tdata LV Status available # open 2 LV Size 11.86 GiB Allocated pool data 100.00% Allocated metadata 17.77% Current LE 3036 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2
这个精简池是什么,它为什么填满了,我怎样才能阻止它呢? 另外,如果我的容器内有20多GB的可用空间,为什么它会停止新的写入? 据我可以告诉它没有连接到我的程序正在写入的文件。
谢谢!
我们受到同样的问题。 根本原因似乎是Docker没有在discard选项中安装其存储引擎(Elastic Beanstalk中默认的精简configurationdevicemapper ),而discard选项依次填充块,直到中断为止。
我无法find一个明确的解决scheme,但这是一个解决方法(请参阅此评论 ),我可以使用受影响的实例:
docker ps -qa | xargs docker inspect --format='{{ .State.Pid }}' | xargs -IZ fstrim /proc/Z/root/