MySQL-8.0.18 引入了破坏性变更
MySQL-8.0.18 引入了破坏性变更
变更日志里面有这样一项
When the server is run with --initialize, there is no reason to load non-early plugins. The server now logs a warning and ignores any --plugin-load or --plugin-load-add options given with --initialize. (Bug #29622406)
也就是说当我们在做初始化的时,像半同步插件这样的非必要插件是不会被加载的,一旦我们在配置文件中加入了相应的配置项,整个初始化就会失败。
场景再现
配置文件(关键部分)
[mysqld] ## replication rpl_semi_sync_master_enabled = 1 rpl_semi_sync_slave_enabled = 1 rpl_semi_sync_master_timeout = 1000 rpl_semi_sync_master_wait_point = AFTER_SYNC rpl_semi_sync_master_wait_no_slave = ON rpl_semi_sync_master_wait_for_slave_count = 1 master_info_repository = table sync_master_info = 10000 skip_slave_start = OFF slave_load_tmpdir = /tmp/ plugin_load_add = semisync_master.so plugin_load_add = semisync_slave.so
初始化命令
/usr/local/mysql-8.0.18-linux-glibc2.12-x86_64/bin/mysqld --defaults-file=/etc/my-3307.cnf --initialize --user=mysql3307
错误日志
2019-10-17T09:40:53.905909+08:00 0 [System] [MY-013169] [Server] /usr/local/mysql-8.0.18-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.18) initializing of server in progress as process 8077 100 100 100 100 100 100 100 100 2019-10-17T09:40:56.474963+08:00 0 [Warning] [MY-013501] [Server] Ignoring --plugin-load[_add] list as the server is running with --initialize(-insecure). 2019-10-17T09:40:57.620921+08:00 0 [ERROR] [MY-000067] [Server] unknown variable 'rpl_semi_sync_master_enabled=1'. 2019-10-17T09:40:57.621099+08:00 0 [ERROR] [MY-013236] [Server] The designated data directory /database/mysql/data/3307/ is unusable. You can remove all files that the server added to it. 2019-10-17T09:40:57.621375+08:00 0 [ERROR] [MY-010119] [Server] Aborting 2019-10-17T09:40:58.676973+08:00 0 [System] [MY-010910] [Server] /usr/local/mysql-8.0.18-linux-glibc2.12-x86_64/bin/mysqld: Shutdown complete (mysqld 8.0.18) MySQL Community Server - GPL. 2019-10-17T09:40:59.113521+08:00 0 [System] [MY-010116] [Server] /usr/local/mysql-8.0.18-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.18) starting as process 8165 mysqld: Table 'mysql.plugin' doesn't exist 2019-10-17T09:40:59.941092+08:00 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure. 2019-10-17T09:41:00.013579+08:00 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
解决方案
方案一:由变更日志中提到的内容可以知道,我们只要在初始化时把非必要插件的内容从配置文件中去掉,初始化完成之后再加回来就行了。然而就要求 dba 特别能吃苦,特别能受累。
方案二:使用 dbm-agent 这个自动化工具,它已经对 MySQL-8.0.18 做了兼容,而且整个安装、配置、调优 过程一行命令解决
# 一行命令完成安装、配置、调优 dbma-cli-single-instance --pkg=mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz --port=3306 --max-mem=256 install
验证一下
mysql> select @@version; +-----------+ | @@version | +-----------+ | 8.0.18 | +-----------+ 1 row in set (0.00 sec) mysql> show plugins; +---------------------------------+----------+--------------------+--------------------+---------+ | Name | Status | Type | Library | License | +---------------------------------+----------+--------------------+--------------------+---------+ | | rpl_semi_sync_master | ACTIVE | REPLICATION | semisync_master.so | GPL | | rpl_semi_sync_slave | ACTIVE | REPLICATION | semisync_slave.so | GPL | | clone | ACTIVE | CLONE | mysql_clone.so | GPL | +---------------------------------+----------+--------------------+--------------------+---------+ 47 rows in set (0.00 sec)
dbm-agent
dbm-agent 是一个开源的自动化工具,可以在 github 上看到到 https://github.com/Neeky/dbm-agent
文章转载自:https://www.sqlpy.com/blogs/books/1/chapters/13/articles/109
---
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 字符编码:从基础到乱码解决
2015-10-17 linux----man
2015-10-17 linux---finger命令
2014-10-17 MYSQL 数学运算符问题
2014-10-17 MYSQL 触发器
2014-10-17 SQL Server MYSQL 对外键建立索引的必要性
2014-10-17 SQL Server IO系统问题解决
2014-10-17 SQL Server 的 3 种连接