适用版本
从 OAT V3.2.0、V3.2.0 BP1、V4.0.0、V4.0.0 BP1 升级到 OAT V4.1
问题现象
从 OAT V3.2.0/V4.0.0 版本升级到 OAT V4.1 时,新版 OAT 容器启动失败,一直报错 ERROR 2002 (HY000): Can't connect to server on '127.1' (115)。
在 OAT 容器的 data_dir/db/mariadb.log 日志中:
230406 10:16:46 mysqld_safe Starting mariadbd daemon with databases from /data/db2023-04-06 10:16:46 0 [Note] Starting MariaDB 10.6.12-MariaDB source revision 4c79e15cc3716f69c044d4287ad2160da8101cdc as process 1382023-04-06 10:16:46 0 [Note] InnoDB: Compressed tables use zlib 1.2.112023-04-06 10:16:46 0 [Note] InnoDB: Number of pools: 12023-04-06 10:16:46 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions2023-04-06 10:16:46 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)2023-04-06 10:16:46 0 [Note] InnoDB: Using Linux native AIO2023-04-06 10:16:46 0 [Note] InnoDB: Initializing buffer pool, total size = 1073741824, chunk size = 1342177282023-04-06 10:16:46 0 [Note] InnoDB: Completed initialization of buffer pool2023-04-06 10:16:46 0 [ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.3.27. You must start up and shut down MariaDB 10.4 or earlier on the data directory.2023-04-06 10:16:46 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error2023-04-06 10:16:46 0 [Note] InnoDB: Starting shutdown...2023-04-06 10:16:47 0 [ERROR] Plugin 'InnoDB' init function returned error.2023-04-06 10:16:47 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.2023-04-06 10:16:47 0 [Note] Plugin 'FEEDBACK' is disabled.2023-04-06 10:16:47 0 [ERROR] Unknown/unsupported storage engine: InnoDB2023-04-06 10:16:47 0 [ERROR] Aborting
问题原因
因为 OAT V3.2/V4.0 中的 MariaDB 版本 < OAT V4.1 中的 MariaDB 版本,所以如果不先 kill 掉旧版 OAT 容器内的 mysqld 进程,直接 stop 旧版 OAT 容器来进行升级的话,大概率会遇到如上的报错。
解决方法
重新拉起旧版的 OAT 容器。
[root@oat_server ~]# docker exec -it oat_old bashkill 掉旧版 OAT 容器中的 mysqld 进程。
[root@oat_server oat]# ps -ef | grep mysqld root 16 1 0 10:18 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --user=mysql mysql 169 16 1 10:18 ? 00:00:04 /usr/libexec/mysqld --basedir=/usr --datadir=/data/db/ --plugin-dir=/usr/lib64/mariadb/plugin --user=mysql --log-error=/data/db/mariadb.log --pid-file=/run/mariadb/mariadb.pid --socket=/data/db/mysql.sock --port=3306 root 2062 2048 0 10:25 pts/0 00:00:00 grep --color=auto mysqld [root@oat_server oat]# pkill mysqld [root@oat_server oat]# [root@oat_server oat]# ps -ef | grep mysqld root 2131 2048 0 10:25 pts/0 00:00:00 grep --color=auto mysqld [root@oat_server oat]# [root@oat_server oat]# exit [root@oat_server ~]#再次停掉旧版的 OAT 容器。
[root@oat_server ~]# docker stop oat_old oat_old [root@oat_server ~]#启动新版的 OAT 容器。
[root@oat_server ~]# docker start oat oat [root@oat_server ~]#
相关文档
关于 OAT 升级的更多信息,参见 OAT 升级指南。