• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

MySQL中ib_logfile和ibdata1参数大小被修改后_MySQL

mysql 搞代码 4年前 (2022-01-09) 43次浏览 已收录 0个评论

1. 环境说明

RHEL 6.4 x86_64 + MySQL 5.5.37和MySQL 5.6.19

blog地址:http://blog.gaodaima.com/hw_libo/article/details/39215723

2. 案例:redo log文件(ib_logfile)大小参数被修改:innodb_log_file_size

innodb_log_file_size = 256M — 修改为200M

版本是5.5的,启动失败,会出现如下错误:

InnoDB: Error: log file ./ib_logfile0 is of different size 0 268435456 bytes  ## 原来redo log的大小InnoDB: than specified in the .cnf file 0 209715200 bytes!   ## redo log被修改的大小140912  0:01:12 [ERROR] Plugin 'InnoDB' init function returned error.140912  0:01:12 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.140912  0:01:12 [ERROR] Unknown/unsupported storage engine: InnoDB140912  0:01:12 [ERROR] Aborting

版本是5.6.16之后的,正常启动,会自动将原来的redo log删除,然后重新生成新的redo log(这个比较重要):

2014-09-11 21:57:05 1093 [Warning] InnoDB: Resizing redo log from 2*16384 to 2*12800 pages, LSN=712491712014-09-11 21:57:05 1093 [Warning] InnoDB: Starting to delete and rewrite log files.    ## 删除原redo log2014-09-11 21:57:05 1093 [Note] InnoDB: Setting log file ./ib_logfile101 size to 200 MBInnoDB: Progress in MB: 100 2002014-09-11 21:57:06 1093 [Note] InnoDB: Setting log file ./ib_logfile1 size to 200 MBInnoDB: Progress in MB: 100 2002014-09-11 21:57:07 1093 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile02014-09-11 21:57:07 1093 [Warning] InnoDB: New log files created, LSN=71249171   ## 新redo log重建完毕

原redo log大小:2*16384*8(page的大小为8k)/1024=256MB

新redo log大小:2*12800*8/1024=200MB

3. 案例:ibdata1文件大小参数被修改:innodb_data_file_path

(1)ibdata1从大改小

innodb_data_file_path = ibdata1:1G:autoextend — 修改为:ibdata1:300M:autoextend

在版本是5.5和5.6中,启动正常,并且日志中没有任何异常。但是如果将autoextend去掉,就会报错,启动失败,如:[版本:5.5.37]

InnoDB: Error: data file ./ibdata1 is of a different sizeInnoDB: 65536 pages (rounded down to MB)InnoDB: than specified in the .cnf file 19200 pages!140911 23:51:53 InnoDB: Could not open or create data files.140911 23:51:53 InnoDB: If you tried to add new data files, and it failed here,140911 23:51:53 InnoDB: you should now edit innodb_data_file_path in my.cnf back140911 23:51:53 InnoDB: to what it was, and remove the new ibdata files InnoDB created140911 23:51:53 InnoDB: in this failed attempt. InnoDB only wrote those files full of140911 23:51:53 InnoDB: zeros, but did not yet use them in any way. But be careful: do not140911 23:51:53 InnoDB: remove old data files which contain your precious data!140911 23:51:53 [ERROR] Plugin 'InnoDB' init function returned error.140911 23:51:53 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.140911 23:51:53 [ERROR] Unknown/unsupported storage engine: InnoDB140911 23:51:53 [ERROR] Aborting原来的ibdata1大小为:65536*8*2/1024=1024M=1G当前ibdata1被修改为:19200*8*2/1024=300M

(2)ibdata1值小改大

比如:

innodb_data_file_path = ibdata1:1G:autoextend — 修改为:ibdata1:1200M:autoextend

那么会在启动时出现如下错误:

*****在5.5版本中:[版本:5.5.37]

InnoDB: Error: auto-extending data file ./ibdata1 is of a different sizeInnoDB: 65536 pages (rounded down to MB) than specified in the .cnf file:InnoDB: initial 76800 pages, max 0 (relevant if non-zero) pages!140911 23:57:43 InnoDB: Could not open or create data files.140911 23:57:43 InnoDB: If you tried to add new data files, and it failed here,140911 23:57:43 InnoDB: you should now edit innodb_data_file_path in my.cnf back140911 23:57:43 InnoDB: to what it was, and remove the new ibdata files InnoDB created140911 23:57:43 InnoDB: in this failed attempt. InnoDB only wrote those files full of140911 23:57:43 InnoDB: zeros, but did not yet use them in any way. But be careful: do not140911 23:57:43 InnoDB: remove old data files which contain your precious data!140911 23:57:43 [ERROR] Plugin 'InnoDB' init function returned error.140911 23:57:43 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.140911 23:57:43 [ERROR] Unknown/unsupported storage engine: InnoDB140911 23:57:43 [ERROR] Aborting

*****在5.6版本中:[版本:5.6.19]

2014-09-11 22:20:01 1222 [ERROR] InnoDB: auto-ex<span>本文来源gaodai#ma#com搞*!代#%^码网5</span>tending data file ./ibdata1 is of a different size 65536 pages (rounded down to MB) than specified in the .cnf file: initial 76800 pages, max 0 (relevant if non-zero) pages!2014-09-11 22:20:01 1222 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!2014-09-11 22:20:01 1222 [ERROR] Plugin 'InnoDB' init function returned error.2014-09-11 22:20:01 1222 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.2014-09-11 22:20:01 1222 [ERROR] Unknown/unsupported storage engine: InnoDB2014-09-11 22:20:01 1222 [ERROR] Aborting

原来的ibdata1大小为:65536*8*2/1024=1024M=1G

当前ibdata1被修改为:76800*8*2/1024=1200M

blog地址:http://blog.gaodaima.com/hw_libo/article/details/39215723

— Bosco QQ:375612082

—- END —-
——————————————————————————————————-
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:MySQL中ib_logfile和ibdata1参数大小被修改后_MySQL

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址