因插入大量数据,mysql服务报错:
Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.io.EOFException
MESSAGE: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
STACKTRACE:
java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
一开始查看超时时间为600,以为是这个问题
便将wait_timeout调大(永久改动可去修改my.cnf文件)
show global variables like 'wait_timeout';
set global wait_timeout=86400;
但并没有解决问题,于是便到服务器上进行操作
tail -90 mysql-error.log //查看报错
top //查看当前进程使用情况
发现mysql内存占用太高
查看mysql配置,发现参数“innodb-buffer-pool-size”配置过高,导致重启
解决方案:
my.cnf中将innodb_buffer_pool_size调小