定位过程:
1.docker ps
mysql的状态变为Restarting (1) 34 seconds ago
2.docker logs 容器id
2021-06-14T11:41:26.576567Z 0 [ERROR] InnoDB: Write to file ./ibtmp1failed at offset 7340032, 1048576 bytes should have been written, only 65536 were written. Operating system error number 28. Check that your OS and file system support files of this size. Check also that the disk is not full or a disk quota exceeded.
2021-06-14T11:41:26.576589Z 0 [ERROR] InnoDB: Error number 28 means 'No space left on device'
2021-06-14T11:41:26.576595Z 0 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html
2021-06-14T11:41:26.576603Z 0 [ERROR] InnoDB: Could not set the file size of './ibtmp1'. Probably out of disk space
2021-06-14T11:41:26.576608Z 0 [ERROR] InnoDB: Unable to create the shared innodb_temporary
2021-06-14T11:41:26.576618Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-06-14T11:41:27.137686Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-06-14T11:41:27.137731Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-06-14T11:41:27.137736Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-06-14T11:41:27.137742Z 0 [ERROR] Failed to initialize builtin plugins.
2021-06-14T11:41:27.137745Z 0 [ERROR] Aborting
3.发现内存不足之后,cd /到根目录,du -sh *,后来发现
du -s * | sort -nr | tail
这个命令好用
,发现vagrant占用36G,一路找下去,发现到application data目录无线循环,百度~~~,发现一位大佬的博文,问题顺利解决
积累三个命令
du -s * | sort -nr | head 选出排在前面的10个,
du -s * | sort -nr | tail 选出排在后面的10个。
du -s /usr/* |sort -nr | head
5.大佬实现思路,我们ls,ll等会发现很多和我们c盘目录、文件一样。vagrant提供了将本机目录挂载到虚拟机目录下的功能,默认是将vagrant配置文件所在目录挂载到虚拟机/vagrant目录下。
这个默认绑定挂载真心讨厌,
在和Vagrantfile同级目录(C:\Users\lenovo\)创建一个自己的文件夹,我的(vagrantCache),
然后打开目录到C:\Users\lenovo\.vagrant.d\boxes\centos-VAGRANTSLASH-7\2004.01\virtualbox,修改Vagrantfile文件
config.vm.synced_folder ".", "/vagrant", type: "rsync"
修改为
config.vm.synced_folder "./vagrantCache", "/vagrant", type: "rsync"
6.vagrant reload,