我在 ubuntu 12.04 上运行 mysql 5.5
我有许多数据库:主数据库有~15k 个 innodb 表,大小约为 2GB,另一个是用于简单机器论坛的数据库,大小约为 50MB。
2 天前,我的所有 Web 应用程序都崩溃了,因为所有查询都会出现“与 MySQL 服务器失去连接”的情况。
这是我的 /var/log/mysql/error.log
InnoDB: End of page dump
140108 10:42:55 InnoDB: Page checksum 3777857050, prior-to-4.0.14-form checksum 2381448317
InnoDB: stored checksum 3777857050, prior-to-4.0.14-form stored checksum 3688692048
InnoDB: Page lsn 2 764141590, low 4 bytes of lsn at page end 762375020
InnoDB: Page number (if stored to page already) 129743,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be an index page where index id is 32470
InnoDB: (index "PRIMARY" of table "gwc"."xxia_minute_history")
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 129743.
InnoDB: You may have to recover from a backup.
InnoDB: It is also possible that your operating
InnoDB: system has corrupted its own file cache
InnoDB: and rebooting your computer removes the
InnoDB: error.
InnoDB: If the corrupt page is an index page
InnoDB: you can also try to fix the corruption
InnoDB: by dumping, dropping, and reimporting
InnoDB: the corrupt table. You can use CHECK
InnoDB: TABLE to scan your table for corruption.
InnoDB: See also http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
InnoDB: Ending processing because of a corrupt database page.
140108 10:42:55 InnoDB: Assertion failure in thread 2918591296 in file buf0buf.c line 3631
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
000000000000000000 ;
InnoDB: End of page dump
140110 17:25:34 InnoDB: Page checksum 1575996416, prior-to-4.0.14-form checksum 1371122432
InnoDB: stored checksum 0, prior-to-4.0.14-form stored checksum 0
InnoDB: Page lsn 0 0, low 4 bytes of lsn at page end 0
InnoDB: Page number (if stored to page already) 0,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be a freshly allocated page
140110 17:25:34 InnoDB: Assertion failure in thread 3054144320 in file btr0btr.c line 719
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
22:25:34 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=16777216
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346066 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0xffffffffb953e830
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = ffffffffb60a82cc thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x33)[0xb7314873]
/usr/sbin/mysqld(handle_fatal_signal+0x484)[0xb71c1454]
[0xb6e77500]
/usr/sbin/mysqld(+0x4f2041)[0xb738c041]
/usr/sbin/mysqld(+0x4f2a13)[0xb738ca13]
/usr/sbin/mysqld(+0x5338fc)[0xb73cd8fc]
/usr/sbin/mysqld(+0x533db6)[0xb73cddb6]
/usr/sbin/mysqld(+0x49cf2c)[0xb7336f2c]
/usr/sbin/mysqld(_ZN7handler7ha_openEP5TABLEPKcii+0x43)[0xb71c63a3]
/usr/sbin/mysqld(_Z21open_table_from_shareP3THDP11TABLE_SHAREPKcjjjP5TABLEb+0x65d)[0xb7119f3d]
/usr/sbin/mysqld(_Z10open_tableP3THDP10TABLE_LISTP11st_mem_rootP18Open_table_context+0xef5)[0xb704ba15]
/usr/sbin/mysqld(_Z11open_tablesP3THDPP10TABLE_LISTPjjP19Prelocking_strategy+0x5e3)[0xb704c763]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x1855)[0xb7089595]
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0xfc)[0xb709072c]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x18da)[0xb70920da]
/usr/sbin/mysqld(_Z10do_commandP3THD+0xd3)[0xb70929f3]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0x1eb)[0xb7145e1b]
/usr/sbin/mysqld(handle_one_connection+0x50)[0xb7145e80]
/lib/i386-linux-gnu/libpthread.so.0(+0x6d4c)[0xb6df8d4c]
/lib/i386-linux-gnu/libc.so.6(clone+0x5e)[0xb6c08dde]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (ffffffffab213018): is an invalid pointer
Connection ID (thread ID): 2
Status: NOT_KILLED
如何查明所有这些的原因?
* 是我的 webapp 试图在数据库中插入格式不正确的行吗?
* 也许是系统内存不足造成的?
* 使用 apt-get 会弄乱库版本/权限吗?
* 也许是重新启动时没有正确关闭 mysql?
* 总是有很多垃圾邮件发送者/黑客在我的服务器上尝试一堆东西,在 apache2 访问日志中,我看到诸如 ?page=admin;php5; 之类的东西,还有其他奇怪的东西,
我希望学习一些关于如何排除 Linux 服务器故障的新见解。
如果重要的话,我会将 python3 bottle 作为 webapp 运行,并且还会运行 php smf。
答案1
嗯,文件读取错误可能是由硬盘或文件系统问题引起的。您是否尝试过使用 SMART 或任何其他工具检查驱动器是否有错误?也请尝试检查您的文件系统。
有时,如果您的服务器超载,也可能会导致健康硬盘出现超时违规。
另一个原因,正如日志中提到的那样(“这可能是因为您遇到了错误。”),是 MySQL 中的一个错误。我刚刚在 Google 上搜索了一下,找到了以下页面:http://bugs.mysql.com/bug.php?id=69476为了避免这种情况,您可以尝试从 InnoDB 切换到 MyISAM。