Mysql Innodb:InnoDB:错误:最后一个检查点的寿命是InnoDB:它超出了日志组的容量


25

我真的需要一些mysql专业知识。我是mysql的新手,并且在过去1周内看到数据库的服务器崩溃。

我在Ubuntu上使用mysql 5.1.36。这是具有双核和4GB内存以及40GB SSD的专用mysql服务器。

日志错误为:

120413 23:57:15 [Note] Plugin 'FEDERATED' is disabled.
120413 23:57:15 [Warning] option 'innodb-autoextend-increment': unsigned value 2000 adjusted to 1000
120413 23:57:15  InnoDB: Initializing buffer pool, size = 2.9G
120413 23:57:15  InnoDB: Completed initialization of buffer pool
120413 23:57:16  InnoDB: Started; log sequence number 0 44234
120413 23:57:16 [Note] Event Scheduler: Loaded 0 events
120413 23:57:16 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.58-1ubuntu1-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
120414  0:00:25 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-log=e2-relay-bin' to avoid this problem.
120414  0:00:25 [Note] 'CHANGE MASTER TO executed'. Previous state master_host='', master_port='3306', master_log_file='', master_log_pos='4'. New state master_host='', master_port='3306', master_log_file='mysql-bin.000043', master_log_pos='87039427'.
120414  0:58:37 [Note] 'CHANGE MASTER TO executed'. Previous state master_host='', master_port='3306', master_log_file='mysql-bin.000043', master_log_pos='87039427'. New state master_host='', master_port='3306', master_log_file='mysql-bin.000043', master_log_pos='87846901'.
120414  2:20:34  InnoDB: ERROR: the age of the last checkpoint is 241588252,
InnoDB: which exceeds the log group capacity 241588224.
InnoDB: If you are using big BLOB or TEXT rows, you must set the   
InnoDB: combined size of log files at least 10 times bigger than the
InnoDB: largest such row.

My.cnf如下。

default-storage-engine=innodb
default-table-type=innodb
key_buffer              = 384M
max_allowed_packet      = 64M
thread_stack            = 256K
thread_cache_size       = 16
max_heap_table_size     = 64M
myisam_sort_buffer_size = 64M
join_buffer_size        = 8M
read_buffer_size        = 2M
read_rnd_buffer_size    = 8M
sort_buffer_size        = 3M
tmp_table_size          = 64M
# Innodb changes
innodb_additional_mem_pool_size = 16M
innodb_autoextend_increment     = 2000
innodb_buffer_pool_size         = 3000M #As current Db is around 1.2G.
innodb_file_per_table
innodb_data_file_path           = ibdata1:512M;ibdata2:512M:autoextend
innodb_flush_log_at_trx_commit  = 2 #For more reliablity use 1
innodb_flush_method             = O_DIRECT
innodb_log_buffer_size          = 8M
innodb_log_file_size            = 128M #Transaction Log up to 1/4 Buffer Pool
innodb_thread_concurrency       = 16
#innodb_force_recovery          = 2
#innodb_read_io_threads         = 8
#innodb_write_io_threads                = 8
innodb_lock_wait_timeout        = 50
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
max_connections        = 400
table_cache            = 1024M
thread_concurrency     = 16

任何建议,我可以改变。


抱歉...前几行被删除了。
TheVyom

如果可以,请帮自己一个忙,并使用较新版本的MySQL。5.1.38是古老的。如果可以的话,至少升级到最新的5.1版本,如果不是5.5,请升级。
亚伦·布朗

Answers:


26

乍一看,我想说您的innodb_log_file_size太小了。做两件事应该更大:

  • 容纳任何大的BLOB或TEXT字段
  • 进行更大的交易

这是您现在应该执行的操作,以查看是否有帮助:

步骤01)在/etc/my.cnf中更改以下内容

[mysqld]
innodb_log_buffer_size          = 32M
innodb_buffer_pool_size         = 3G
innodb_log_file_size            = 768M

步骤02) service mysql stop

步骤03) rm -f /var/lib/mysql/ib_logfile*

步骤04) service mysql start

这将重建以下文件

  • / var / lib / mysql / ib_logfile0
  • / var / lib / mysql / ib_logfile1

试试看 !!!

更新2013-07-03 12:37 EDT

我已经更新了与此相关的其他帖子,却错过了这一篇

ButtleButkus刚刚评论了2013-07-03 07:18:56 EDT

在删除ib_logfile *之前,将其复制到另一个位置进行备份是否明智?

由于内部可能存在未完成的交易数据,因此应执行以下操作

步骤01)在/etc/my.cnf中更改以下内容

[mysqld]
innodb_log_buffer_size          = 32M
innodb_buffer_pool_size         = 3G
innodb_log_file_size            = 768M

STEP 02)mysql -uroot -p -e“设置全局innodb_fast_shutdown = 0;”

步骤03) service mysql stop

步骤04) rm -f /var/lib/mysql/ib_logfile*

步骤05) service mysql start

我加了SET GLOBAL innodb_fast_shutdown = 0;。那是做什么的?它强制InnoDB从所有InnoDB活动部件中完全清除事务更改,包括事务日志(ib_logfile0,ib_logfile1)。因此,无需备份旧的ib_logfile0,ib_logfile1。如果删除它们使您感到紧张,请执行步骤04

mv /var/lib/mysql/ib_logfile* ..

把旧的日志放进去/var/lib。如果重新创建日志成功并且mysqld启动,则可以删除旧日志。

我已经使用此功能一年了。我更新了其他帖子以反映这一点...

如果还有我的其他较旧的帖子没有提及innodb_fast_shutdown,请告诉我,以便我进行更新。再次感谢,ButtleButkus


将日志文件增加到256M并将buffer_pool_size减小到2G似乎可以解决问题。
TheVyom

我的回答有帮助吗?
RolandoMySQLDBA'5

抱歉,忘记更新此内容。自从上个月以来,这对我们起到了很大的帮助作用,并且我们的服务器一直正常运行。
TheVyom

在删除ib_logfile *之前,将其复制到另一个位置进行备份是否明智?
Buttle Butkus

1
768MB是相当大的每Percona的巴伦·施瓦茨 percona.com/blog/2008/11/21/...
greenlitmysql
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.