MySQL-8.0.18 引入了破壞性變動

MySQL-8.0.18 引入了破壞性變動mysql

 

變動日誌裏面有這樣一項linux

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)

也就是說當咱們在作初始化的時,像半同步插件這樣的非必要插件是不會被加載的,一旦咱們在配置文件中加入了相應的配置項,整個初始化就會失敗。git

 

場景再現github

 

配置文件(關鍵部分)sql

[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

錯誤日誌spa

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 作了兼容,並且整個安裝、配置、調優 過程一行命令解決code

# 一行命令完成安裝、配置、調優
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

---

相關文章
相關標籤/搜索