Menu Close

MariaDB binlog删除后不能重启解决方案

1. 故障现象(SYMPTOMS)

重启 mariadb 服务后报如下错误:

2037-08-01 15:11:36 0 [Warning] The parameter innodb_buffer_pool_instances is deprecated and has no effect.
2037-08-01 15:11:36 0 [Warning] The parameter innodb_log_files_in_group is deprecated and has no effect.
2037-08-01 15:11:36 0 [Note] InnoDB: Using Linux native AIO
2037-08-01 15:11:36 0 [Note] InnoDB: Uses event mutexes
2037-08-01 15:11:36 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2037-08-01 15:11:36 0 [Note] InnoDB: Number of pools: 1
2037-08-01 15:11:36 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2037-08-01 15:11:36 0 [Note] mariadbd: O_TMPFILE is not supported on /data/etmaridb/tmp (disabling future attempts)
2037-08-01 15:11:36 0 [Note] InnoDB: Initializing buffer pool, total size = 8589934592, chunk size = 134217728
2037-08-01 15:11:36 0 [Note] InnoDB: Completed initialization of buffer pool
2037-08-01 15:11:36 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2037-08-01 15:11:36 0 [Note] InnoDB: 128 rollback segments are active.
2037-08-01 15:11:36 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2037-08-01 15:11:36 0 [Note] InnoDB: Setting file '/data/etmaridb/data/ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2037-08-01 15:11:36 0 [Note] InnoDB: File '/data/etmaridb/data/ibtmp1' size is now 12 MB.
2037-08-01 15:11:36 0 [Note] InnoDB: 10.5.8 started; log sequence number 1642963204395; transaction id 68855179
2037-08-01 15:11:36 0 [Note] InnoDB: Loading buffer pool(s) from /data/etmaridb/data/ib_buffer_pool
2037-08-01 15:11:36 0 [Note] Plugin 'FEEDBACK' is disabled.
2037-08-01 15:11:36 0 [ERROR] mariadbd: File '/data/etmaridb/log/mysql-bin.000791' not found (Errcode: 2 "No such file or directory")
2037-08-01 15:11:36 0 [ERROR] Failed to open log (file '/data/etmaridb/log/mysql-bin.000791', errno 2)
2037-08-01 15:11:36 0 [ERROR] Could not open log file
2037-08-01 15:11:36 0 [ERROR] Can't init tc log
2037-08-01 15:11:36 0 [ERROR] Aborting

2. 变化(CHANGES)

3. 故障原因(CAUSE)

注意到:

[ERROR] mariadbd: File '/data/etmaridb/log/mysql-bin.000791' not found (Errcode: 2 "No such file or directory")
[ERROR] Failed to open log (file '/data/etmaridb/log/mysql-bin.000791', errno 2)
[ERROR] Could not open log file

/data/etmaridb/log/mysql-bin.000791 文件被删除。

4. 解决方案(SOLUTION)

  • 注释my.cnf的log-bin配置
  • 如果需要开启bin-log,那就删除bin-log日志目录里的mysql-bin.index文件或将其备份

5. 总结(SUMMARY)