shenkonghui / issue

问题记录
0 stars 0 forks source link

MYSQL 8 开始半同步复制插件启动失败 #166

Closed shenkonghui closed 2 years ago

shenkonghui commented 2 years ago

initialize阶段提示配置错误

2022-04-27T22:01:16.675661+08:00 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2022-04-27T22:01:16.675725+08:00 0 [Warning] [MY-011068] [Server] The syntax 'master_verify_checksum' is deprecated and will be removed in a future release. Please use source_verify_checksum instead.
2022-04-27T22:01:16.675739+08:00 0 [Warning] [MY-011068] [Server] The syntax 'sync_master_info' is deprecated and will be removed in a future release. Please use sync_source_info instead.
2022-04-27T22:01:16.675749+08:00 0 [Warning] [MY-011068] [Server] The syntax 'skip_slave_start' is deprecated and will be removed in a future release. Please use skip_replica_start instead.
2022-04-27T22:01:16.675759+08:00 0 [Warning] [MY-011068] [Server] The syntax 'log_slave_updates' is deprecated and will be removed in a future release. Please use log_replica_updates instead.
2022-04-27T22:01:16.675794+08:00 0 [Warning] [MY-011068] [Server] The syntax 'slave_load_tmpdir' is deprecated and will be removed in a future release. Please use replica_load_tmpdir instead.
2022-04-27T22:01:16.675805+08:00 0 [Warning] [MY-011068] [Server] The syntax 'slave_sql_verify_checksum' is deprecated and will be removed in a future release. Please use replica_sql_verify_checksum instead.
2022-04-27T22:01:16.675815+08:00 0 [Warning] [MY-011068] [Server] The syntax 'slave_preserve_commit_order' is deprecated and will be removed in a future release. Please use replica_preserve_commit_order instead.
2022-04-27T22:01:16.675825+08:00 0 [Warning] [MY-011068] [Server] The syntax 'slave_parallel_type' is deprecated and will be removed in a future release. Please use replica_parallel_type instead.
2022-04-27T22:01:16.675834+08:00 0 [Warning] [MY-011068] [Server] The syntax 'slave_parallel_workers' is deprecated and will be removed in a future release. Please use replica_parallel_workers instead.
2022-04-27T22:01:16.675843+08:00 0 [Warning] [MY-011069] [Server] The syntax '--master-info-repository' is deprecated and will be removed in a future release.
2022-04-27T22:01:16.675856+08:00 0 [Warning] [MY-011069] [Server] The syntax '--relay-log-info-repository' is deprecated and will be removed in a future release.
2022-04-27T22:01:16.676035+08:00 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.26) initializing of server in progress as process 3572
2022-04-27T22:01:16.779137+08:00 0 [Warning] [MY-013267] [InnoDB] The setting INNODB_UNDO_TABLESPACES is deprecated and is no longer used.  InnoDB always creates 2 undo tablespaces to start with. If you need more, please use CREATE UNDO TABLESPACE.
2022-04-27T22:01:16.784100+08:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-04-27T22:01:20.831822+08:00 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-04-27T22:01:25.875081+08:00 0 [Warning] [MY-013501] [Server] Ignoring --plugin-load[_add] list as the server is running with --initialize(-insecure).
2022-04-27T22:01:34.589805+08:00 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2022-04-27T22:01:34.590031+08:00 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2022-04-27T22:01:35.470281+08:00 0 [ERROR] [MY-000067] [Server] unknown variable 'rpl_semi_sync_master_enabled=ON'.
2022-04-27T22:01:35.472083+08:00 0 [ERROR] [MY-013236] [Server] The designated data directory /data/mysql/db_mysql/data/ is unusable. You can remove all files that the server added to it.
2022-04-27T22:01:35.472639+08:00 0 [ERROR] [MY-010119] [Server] Aborting
2022-04-27T22:01:38.678666+08:00 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.26)  MySQL Community Server - GPL.
shenkonghui commented 2 years ago

在initialize阶段不配置,initialize以后再配置启动是正常的

shenkonghui commented 2 years ago

And also the fact that unknown options prevent mysqld from starting is also well known behavior. This makes the bug report a feature request technically. Marking the bug as such.

Now on ways to fix this: I do not think that currently --initalize needs any external plugins to perform its function. On the contrary: the server is in such a limbo state at init time that allowing arbitrary plugins to load during that time is probably not a very sustainable.

As for fixing the issue. Unfortunately there's very little one can do to fix this issue as it's a well-known consequence from the architectural decision of having options for dynamically loadable components interwoven with the server options. This leaves the server with no way of distinguishing between a misspelled and a correctly-spelled-but-for-a-missing-plugin option. We are working on a solution for this covering components but it's a feature and not a bug fix as it changes architecture.

In the meanwhile I would suggest workarounds:

  1. use --defaults-extra-file for the plugin-related variables and do not pass that during --initialize
  2. use SET PERSIST[_ONLY]: this automatically prefixes with --loose behind the scenes.

https://bugs.mysql.com/bug.php?id=100363 https://docs.oracle.com/cd/E17952_01/mysql-8.0-relnotes-en/news-8-0-18.html#mysqld-8-0-18-feature

加上loose前缀即可,initialize会自动忽略掉该配置

    loose-rpl_semi_sync_master_enabled                =ON
    loose-rpl_semi_sync_master_timeout                =1000
    loose-rpl_semi_sync_master_trace_level            =32
    loose-rpl_semi_sync_master_wait_for_slave_count   =1
    loose-rpl_semi_sync_master_wait_no_slave          =ON
    loose-rpl_semi_sync_master_wait_point             =AFTER_SYNC
    loose-rpl_semi_sync_slave_enabled                 =ON
    loose-rpl_semi_sync_slave_trace_level             =32