InnoDB: 오류: 로그 파일 ./ib_logfile0의 크기가 다릅니다.

InnoDB: 오류: 로그 파일 ./ib_logfile0의 크기가 다릅니다.

InnoDB 엔진을 사용하도록 하나의 데이터베이스를 변환한 후 /etc/mysql/my.cnf에 다음 줄을 추가했습니다.

innodb_buffer_pool_size = 2560M
innodb_log_file_size    = 256M
innodb_log_buffer_size  = 8M
innodb_flush_log_at_trx_commit  = 2
innodb_thread_concurrency   = 16
innodb_flush_method = O_DIRECT

하지만 mysqld를 다시 시작하면 "ERROR 2013 (HY000) at line 2: Lost Connection to MySQL server while query" 오류가 발생합니다. 그리고 mysql 오류 로그는 다음을 보여줍니다

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!
100118 20:52:52 [ERROR] Plugin 'InnoDB' init function returned error.
100118 20:52:52 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
100118 20:52:52 [ERROR] Unknown/unsupported table type: InnoDB
100118 20:52:52 [ERROR] Aborting

그래서 나는 이 줄을 주석 처리했습니다.

# innodb_log_file_size  = 256M

그리고 mysql을 성공적으로 다시 시작했습니다.

mysql 오류에 표시된 "5242880바이트의 로그 파일"이 무엇인지 궁금합니다. 이 서버의 InnoDB 엔진에 대한 첫 번째 데이터베이스이므로 해당 로그 파일은 언제 어디서 생성됩니까? 이 경우 my.cnf에서 innodb_log_file_size 지시문을 어떻게 활성화할 수 있습니까?

편집하다

/var/lib/mysql/ib_logfile0을 삭제하고 mysqld를 다시 시작하려고 시도했지만 여전히 실패했습니다. 이제 오류 로그에 다음이 표시됩니다.

100118 21:27:11  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 256 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200
InnoDB: Error: log file ./ib_logfile1 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!

해결

/var/lib/mysql에서 ib_logfile0 및 ib_logfile1을 모두 삭제한 후 이제 작동합니다.

답변1

InnoDB는 구성에 대해 엄청나게 까다롭습니다. 뭔가 옳지 않다면 그냥 포기하고 집으로 돌아갈 것입니다. 데이터 손실 없이 로그 파일 크기를 변경하려면 다음을 수행하십시오.

  1. 로그 파일 크기에 대한 구성 변경 사항을 되돌리고 MySQL을 다시 시작하십시오.
  2. 실행 중인 MySQL에서: SET GLOBALinnodb_fast_shutdown=0;
  3. MySQL 중지
  4. 로그 파일 크기에 대한 구성을 변경합니다.
  5. 두 로그 파일을 모두 삭제합니다.
  6. MySQL을 시작합니다. 로그 파일이 부족하다고 불평하지만 로그 파일을 생성하면 모든 것이 잘 될 것입니다.

관련 정보