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
---