mongodb - MongoDB在带有docker的设备上没有剩余空间
问题描述
我的 MongoDB 卡住并返回以下错误:
2019-01-28T18:28:53.419+0000 E STORAGE [WTCheckpointThread] WiredTiger error (28) [1548700133:419188][1:0x7feecb0ae700], file:WiredTiger.wt, WT_SESSION.checkpoint: /data/db/WiredTiger.turtle.set: handle-open: open: No space left on device
2019-01-28T18:28:53.419+0000 E STORAGE [WTCheckpointThread] WiredTiger error (22) [1548700133:419251][1:0x7feecb0ae700], file:WiredTiger.wt, WT_SESSION.checkpoint: WiredTiger.wt: the checkpoint failed, the system must restart: Invalid argument
2019-01-28T18:28:53.419+0000 E STORAGE [WTCheckpointThread] WiredTiger error (-31804) [1548700133:419260][1:0x7feecb0ae700], file:WiredTiger.wt, WT_SESSION.checkpoint: the process must exit and restart: WT_PANIC: WiredTiger library panic
2019-01-28T18:28:53.419+0000 F - [WTCheckpointThread] Fatal Assertion 28558 at src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp 361
2019-01-28T18:28:53.419+0000 F - [WTCheckpointThread]
***aborting after fassert() failure
2019-01-28T18:28:53.444+0000 F - [WTCheckpointThread] Got signal: 6 (Aborted).
但是,我的磁盘有空间:
df -h
Filesystem Size Used Avail Use% Mounted on
udev 992M 0 992M 0% /dev
tmpfs 200M 5.7M 195M 3% /run
/dev/xvda1 39G 26G 14G 66% /
tmpfs 1000M 1.1M 999M 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
tmpfs 200M 0 200M 0% /run/user/1000
df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 253844 322 253522 1% /dev
tmpfs 255835 485 255350 1% /run
/dev/xvda1 5120000 5090759 29241 100% /
tmpfs 255835 10 255825 1% /dev/shm
tmpfs 255835 3 255832 1% /run/lock
tmpfs 255835 16 255819 1% /sys/fs/cgroup
tmpfs 255835 4 255831 1% /run/user/1000
这将是我的 docker-compose:
version: "3"
services:
# MariaDB
mariadb:
container_name: mariadb
image: mariadb
ports: ['3306:3306']
restart: always
volumes:
- /home/ubuntu/mysql:/var/lib/mysql
environment:
- "MYSQL_ROOT_PASSWORD=PasswordGoesHere"
command:
# - --memory=1536M
- --wait_timeout=28800
- --innodb_buffer_pool_size=1g
- --innodb_buffer_pool_instances=4
# - --innodb_buffer_pool_chunk_size=1073741824
# APACHE
apache:
container_name: apache
image: apache-php7.1
ports: ['80:80', '443:443']
restart: always
entrypoint: tail -f /dev/null
volumes:
- /home/ubuntu/apache2/apache-config:/etc/apache2/sites-available/
- /home/ubuntu/apache2/www:/var/www/html/
# MONGODB
mongodb:
container_name: mongodb
image: mongo
ports: ['27017:27017']
restart: always
command:
- --auth
volumes:
- /home/ubuntu/moongodb:/data/db
我的 docker-compose.yml 会不会有问题?因为我使用的是物理磁盘而不是虚拟磁盘。我可以运行应用程序,1-2 小时后 mongo 将再次失败。
解决方案
如果您在 centos/RHEL/Amazon Linux 中运行它,您应该知道 devicemapper 在 Docker 中发布 inode 时存在重大问题。
即使你修剪了整个 docker 系统,它仍然会挂在很多 inode 上,真正解决这个问题的唯一方法是基本上 implode docker:
service docker stop
rm -rf /var/lib/docker
service docker start
这应该释放你所有的 inode。
我在这方面花了很多时间,Docker 真的只完全支持 Ubuntu overlay2,而 devicemapper 虽然可以工作,但在技术上不受支持。
推荐阅读
- python - 使用交互式平移和缩放制作 Altair 地图
- python - 支持异步和同步调用的 Python 上下文管理器
- jenkins - 将方法的日志输出到管道到詹金斯输出
- uwp - 如何在两个 UWP 应用之间快速传递实时数据?
- android - 测试 Google 登录 Android
- swift - Swift:Alamofire RequestInterceptor 错误代码
- python - 如何在python中读取excel工作簿的隐藏选项卡?
- node.js - 当我尝试在 Bitmex (ccxt) 中取款时出现“金额无效”错误
- python - 为什么在虚拟环境中使用 subprocess.run() 执行时,'python -m pip' 会运行错误的 pip?
- facebook - Facebook 像素导致奇怪的文本行为