Kubernetes&Database-コンテナクラウド環境Mysqlの起動に失敗した問題を記録し、反省する


Kubernetes&Database-コンテナクラウド環境Mysqlの起動に失敗した問題を記録し、反省する
昨日の夜10時過ぎに運維の同僚から、あるコンテナクラウドプロジェクトでmysqlが起動できない問題の解決に協力するようにメッセージが送られました.ここのmysqlは、主にプラットフォームコンポーネントのバージョン情報を格納するために使用される会社のコンテナクラウド製品のコンポーネントです.hotfixのたびにこのライブラリが更新され、他のコンポーネントも新しいクラスタとアップグレード操作でこのライブラリを使用します.実はこの問題の原因は簡単だが、現場でのコミュニケーションに問題があるため、30分以上で調査が終わった.注意:プラットフォームで使用されるストレージはglusterfsです.
最初に見たmysqlログは次のとおりです.

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/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
13:42:00 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

上のログに表示された情報により、mysqlコンテナが他の理由でダウンし、再起動時にデータの衝突でバグが発生したと初歩的に認定された.そこで、メンテナンスの同僚に、その後の操作でデータが破損しないように、マウントされたデータファイルをバックアップさせます.ログに表示されるリンクに基づいて:http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html、innodb_を変更しようとしますforce_recoveryパラメータは、エラーを無視してライブラリを強制し、バックアップと再構築の操作を行います.
ただし、後で表示されるログには次のものが表示されます.
~ # kubectl logs -f am-mysql-6985689999-qh9v2                                                                             root@kube-master-1
2020-08-23T13:42:15.650213Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-08-23T13:42:15.656529Z 0 [Warning] Can't create test file /var/lib/mysql/am-mysql-6985689999-qh9v2.lower-test
2020-08-23T13:42:15.656661Z 0 [Note] mysqld (mysqld 5.7.26) starting as process 1 ...
2020-08-23T13:42:15.667091Z 0 [Warning] Can't create test file /var/lib/mysql/am-mysql-6985689999-qh9v2.lower-test
2020-08-23T13:42:15.672911Z 0 [Warning] Can't create test file /var/lib/mysql/am-mysql-6985689999-qh9v2.lower-test
2020-08-23T13:42:15.675303Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-08-23T13:42:15.675338Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-08-23T13:42:15.675342Z 0 [Note] InnoDB: Uses event mutexes
2020-08-23T13:42:15.675346Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-08-23T13:42:15.675349Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-08-23T13:42:15.675354Z 0 [Note] InnoDB: Using Linux native AIO
2020-08-23T13:42:15.675745Z 0 [Note] InnoDB: Number of pools: 1
2020-08-23T13:42:15.675925Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-08-23T13:42:15.678565Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-08-23T13:42:15.690587Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-08-23T13:42:15.694116Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-08-23T13:42:15.720597Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-08-23T13:42:15.726557Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 12862247
2020-08-23T13:42:15.726580Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12864344
2020-08-23T13:42:15.726893Z 0 [Note] InnoDB: Database was not shutdown normally!
2020-08-23T13:42:15.726904Z 0 [Note] InnoDB: Starting crash recovery.
2020-08-23T13:42:15.742203Z 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
2020-08-23T13:42:16.245030Z 0 [Note] InnoDB: Apply batch completed
2020-08-23T13:42:16.390120Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-08-23T13:42:16.390155Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-08-23T13:42:16.396469Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-08-23 13:42:18 0x7f295c22a740  InnoDB: Assertion failure in thread 139815616161600 in file os0file.cc line 3109
InnoDB: We intentionally generate a memory trap.


実はこのエラーは明らかですが、最初はバグに関する情報に重点を置いていました...ライブラリの起動時にInnoDB:Settings file'./ibtmp1’ size to 12 MB. 後の通常のログは[Note]InnoDB:File'./ibtmp1’ size is now 12 MB. しかし、この事故ではスレッドのファイル作成に失敗したエラーが報告されました.前のCan’t create test fileの警告と合わせて、基本的に記憶に問題があると判断できますが、pvの記憶容量の割り当てを見ると、記憶領域が足りないため、今回の問題がほとんど明らかになりました.なぜストレージ容量に問題があるのかというと、mysqlがマウントされているpvは他のアプリケーションと1つのパーティションの下にあるが、割り当てられた割当額がquotaを超え、他のアプリケーションがほとんどのスペースを占めているため、mysqlがストレージを使用できないのは、ストレージリソースの使用が規範化されていないためである.
この小さな事故から、文脈環境をはっきりさせなければならないことを注意し、当然のことながら関連する調査を行うことはできない.この問題はもともと2,3分で解決できるはずだったが,結局大半の時間を費やした.