问题现象
有大量的数据要做数据清洗入库,在清洗快结束了的时候报错,如下
uncategorized SQLException; SQL state [HY000]; error code [1114]; The table 'task_master' is full; nested exception is java.sql.BatchUpdateException: The table 'task_master' is full
排查步骤
-
根据
The table 'task_master' is full
提示猜测磁盘满了 -
去数据库服务器查询硬盘空间情况
df -h
-
发现/data已经使用100%
-
进入data目录查询当前目录下文件大小,mysql目录占用了93G
cd /data du -sh *
-
进入mysql目录,重复使用上一步的操作发现binlog目录占用了63G是罪魁祸首
解决方案
进入到bin_log,我这里场景不需要bin_log备份还原所以直接删除了,大家自行斟酌是否进行服务器扩容
cd bin_log
find . -name 'mysql-bin*' -exec rm {} \
补充
后来百度搜索The table is full的时候,还有另外一种情况也会导致上述情况
You are using the MEMORY (HEAP) storage engine; in this case you
need to increase the value of the max_heap_table_size system variable.
See Section 5.1.3, “Server System Variables”.
解决办法是修改Mysql的配置文件my.ini,在[mysqld]下添加/修改两行:
tmp_table_size = 256M
max_heap_table_size = 256M
系统默认16M,修改完成后重启mysql