Incorrect key file for table ‘xxx’; try to repair it

2017-04-21 01:29:34 7f1d8c0bd700 InnoDB: Error: Write to file (merge) failed at offset 2095054848.
InnoDB: 1048576 bytes should have been written, only 978944 were written.
InnoDB: Operating system error number 28.
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number 28 means ‘No space left on device’.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2017-04-21 01:29:35 93551 [ERROR] Slave SQL: Worker 7 failed executing transaction ” at master log mysql-bin.001470, end_log_pos 931467087; Error ‘Incorrect key file for table ‘xxx’; try to repair it’ on query. Default database: ‘xxx’. Query: ‘ALTER TABLE xxx ADD xxx TINYINT(3) DEFAULT ‘0’ NOT NULL’, Error_code: 1034
2017-04-21 01:29:35 93551 [Warning] Slave SQL: … The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state. A restart should restore consistency automatically, although using non-transactional storage for data or info tables or DDL queries could lead to problems. In such cases you have to examine your data (see documentation for details). Error_code: 1756

报错信息如上,日志提示空间不够,df -h 确认 MySQL datadir 所在磁盘空间是足够的。后确认是修改表定义需新建临时表,临时表目录为 my.cnf 设置中 temdir 的路径(默认为 /tmp),修改该配置后重启 MySQL 服务,问题解决。

filebeat index out of range

filebeat 启动时出现如题报错,同样的配置文件有的机器正常有的机器报错。修改报错那台机器的 filebeat 配置文件重试多次后发现是

multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2} '

导致的报错,把后面的空格去掉,改为

multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}'

后正常。

疑问:1. 为什么同样的配置文件有的机器报错有的不报错,2 为什么多一个空格会导致这个报错。

补充信息:报错的机器是 CentOS 7.3,正常机器是 CentOS 6.8。

nginx fpm 常见错误对比分析

fastcgi_read_timeout 8; // nginx.conf
request_terminate_timeout=0 // php-fpm.conf

sleep(10);

浏览器 8 秒后返回 504 Gateway Time-out

nginx-error.log
upstream timed out (110: Connection timed out) while reading response header from upstream

 

fastcgi_read_timeout 8; // nginx.conf
request_terminate_timeout=5 // php-fpm.conf

sleep(10);

浏览器 5 秒后返回 502 Bad Gateway

nginx-error.log
recv() failed (104: Connection reset by peer) while reading response header from upstream
fpm-error.log
[pool www] child 5378, script ‘/usr/share/nginx/html/sleep.php’ (request: “GET /sleep.php”) execution timed out (5.793874 sec), terminating

 

fastcgi_read_timeout 8; // nginx.conf
request_terminate_timeout=5 // php-fpm.conf

set_time_limit(1);
while(true){}

浏览器返回 500 Internal Server Error
php-error.log
[08-Apr-2017 23:39:44 Asia/Shanghai] PHP Fatal error: Maximum execution time of 1 second exceeded in /usr/share/nginx/html/while_true.php on line 3