mysql を起動できません - error.log が継続的に書き込まれます

mysql を起動できません - error.log が継続的に書き込まれます

最近、Ubuntu サーバーでホストされているサイトに「データベース接続の確立エラー」が表示されるようになりました。

サーバーに接続すると、mysql が継続的に再起動されているように見えます (このコマンドを実行するたびに、3 秒前、20 秒前など)。

sudo systemctl status mysql.service

 mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (start) since Fri 2023-09-15 14:31:16 UTC; 3s ago
    Process: 8351 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 8362 (mysqld)
     Status: "Server startup in progress"
      Tasks: 12 (limit: 4541)
     Memory: 318.8M
     CGroup: /system.slice/mysql.service
             └─8362 /usr/sbin/mysqld

私の /var/log/mysql/error.log ファイルも急速に大きくなっています。このファイルには、次のようなテキストに続く奇妙な文字がたくさん含まれています。

InnoDB: End of page dump
InnoDB: Page may be a transaction system page
2023-09-15T14:33:15.169775Z 1 [ERROR] [MY-011899] [InnoDB] [FATAL] Unable to read page [page id: space=0, page number=5] into the buffer pool after 100 attempts. The most probable cause of this error may be that the table has been corrupted. Or, the table was compressed with with an algorithm that is not supported by this instance. If it is not a decompress failure, you can try to fix this problem by using innodb_force_recovery. Please see http://dev.mysql.com/doc/refman/8.0/en/ for more details. Aborting...
2023-09-15T14:33:15.169807Z 1 [ERROR] [MY-013183] [InnoDB] Assertion failure: buf0buf.cc:4054:ib::fatal triggered thread 140275780638464
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/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
2023-09-15T14:33:15Z UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
BuildID[sha1]=b0a6398207071378976beb42c50ef89be92e92db
Thread pointer: 0x5580f6f1c3f0
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 = 7f9480134be0 thread_stack 0x100000
/usr/sbin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x41) [0x5580f29d9e71]
/usr/sbin/mysqld(print_fatal_signal(int)+0x39b) [0x5580f184efab]
/usr/sbin/mysqld(my_server_abort()+0x76) [0x5580f184f0f6]
/usr/sbin/mysqld(my_abort()+0xe) [0x5580f29d3e0e]
/usr/sbin/mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x349) [0x5580f2c77929]
/usr/sbin/mysqld(ib::fatal::~fatal()+0xd5) [0x5580f2c7a165]
/usr/sbin/mysqld(Buf_fetch<Buf_fetch_normal>::read_page()+0x1aa) [0x5580f2ce2fba]
/usr/sbin/mysqld(Buf_fetch_normal::get(buf_block_t*&)+0x170) [0x5580f2ceec20]
/usr/sbin/mysqld(Buf_fetch<Buf_fetch_normal>::single_page()+0x59) [0x5580f2ceed09]
/usr/sbin/mysqld(buf_page_get_gen(page_id_t const&, page_size_t const&, unsigned long, buf_block_t*, Page_fetch, ut::Location, mtr_t*, bool)+0x1fa) [0x5580f2cf02ea]
/usr/sbin/mysqld(Double_write::get(mtr_t*)+0x56) [0x5580f2cf3c56]
/usr/sbin/mysqld(Double_write::init_v1(unsigned int&, unsigned int&)+0x11b) [0x5580f2cf8c1b]
/usr/sbin/mysqld(dblwr::v1::init()+0x1b) [0x5580f2cf8e2b]
/usr/sbin/mysqld(srv_start(bool)+0x1471) [0x5580f2c166a1]
/usr/sbin/mysqld(+0x2349496) [0x5580f2a1d496]
/usr/sbin/mysqld(dd::bootstrap::DDSE_dict_init(THD*, dict_init_mode_t, unsigned int)+0x9e) [0x5580f27564ae]
/usr/sbin/mysqld(dd::upgrade_57::do_pre_checks_and_initialize_dd(THD*)+0x1a9) [0x5580f29abf89]
/usr/sbin/mysqld(+0x1240896) [0x5580f1914896]
/usr/sbin/mysqld(+0x289d0fd) [0x5580f2f710fd]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8609) [0x7f94a20cb609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7f94a1c9c133]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): is an invalid pointer
Connection ID (thread ID): 1
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

問題は元々、ハード ドライブがいっぱいになったことが原因で発生したと思います。サーバーの古いバックアップを復元しようとしましたが、最も古いバックアップにはすでに問題があるようです。

完全に行き詰まってしまい、解決策がありません。今何を試せばいいでしょうか?

答え1

my.cnf [mysqld]セクションに次の行が必要です

thread_cache_size=64

セクション内に行が存在しない場合は、[mysqld] セクションに追加してください。

私たちは支援するためにここにいます。

関連情報