ITPub博客

首页 > 数据库 > MySQL > mgr参数-group_replication_recovery_get_public_key

mgr参数-group_replication_recovery_get_public_key

原创 MySQL 作者:贺子_DBA时代 时间:2023-12-17 20:59:33 0 删除 编辑

mgr参数group_replication_recovery_get_public_key和group_replication_recovery_public_key_path的介绍:

这俩参数起作用的前提是:

1)group_replication_recovery_use_ssl=off

如下所示group_replication_recovery通道没有开启SSL

CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='rpl_pass' FOR CHANNEL 'group_replication_recovery';

2) 帐户使用caching_sha2_password插件进行身份验证(这是MySQL 8.0中的默认插件)

如果用于复制的用户使用了 caching_sha2_password身份验证插件,并且没有启用安全连接( 在group_replication_recovery 启用SSL支持),MySQL 将使用 RSA 密钥对进行密码的交换,可以把主节点的公钥手动拷贝到从节点的服务器中,也可以设置成:自动为请求加入组的节点提供公钥。

介绍下MySQL8.0默认的密码认证插件

caching_sha2_password作为8.0默认的密码认证插件,其安全性强于mysql_native_password,性能优于sha256_password;但由于客户端和驱动的兼容性问题,建议还是采用mysql_native_password作为默认的密码认证插件。

如果采用caching_sha2_password作为默认的密码认证插件,那么在建立连接时,一定要指定RSA公钥,否则会报错“ERROR 2061 (HY000): Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.”,具体如下:

(1)mysql/mysqlbinlog/mysqldump/mysqlpump等:通过--server-public-key-path="..."指定RSA公钥,或通过--get-server-public-key=1 自动获取;

(2)主从复制:通过MASTER_PUBLIC_KEY_PATH="..."指定RSA公钥,或通过GET_MASTER_PUBLIC_KEY=1自动获取;

(3)组复制:通过group_replication_recovery_public_key_path="..."指定RSA公钥,或通过group_replication_recovery_get_public_key=1自动获取;

关于RSA公钥和私钥,可以通过以下参数进行设置:默认自动在数据文件目录下生成公钥和私钥!

(1)caching_sha2_password_auto_generate_rsa_keys:是否自动生成RSA key,默认是on

(2)caching_sha2_password_private_key_path:RSA private key的文件名字,默认private_key.pem,默认是在数据文件目录!也可以是绝对路径!

(3)caching_sha2_password_public_key_path:RSA public key所在的位置的文件名字,默认public_key.pem,默认是在数据文件目录下!也可以是绝对路径!

0

接下来介绍下关于mgr中group_replication_recovery_get_public_key和group_replication_recovery_public_key_path参数

一、group_replication_recovery_get_public_key

开启该参数后,就会自动去mgr的dorner节点去获取公钥

0

The value of this system variable can be changed while Group Replication is running, but the change only takes effect after you stop and restart Group Replication on the group member.

此系统变量的值可以在组复制运行时更改,但只有在停止并重新启动组成员上的组复制后,更改才会生效。

group_replication_recovery_get_public_key specifies whether to request from the source the public key required for RSA key pair-based password exchange. If group_replication_recovery_public_key_path is set to a valid public key file, it takes precedence over group_replication_recovery_get_public_key. This variable applies if you are not using SSL for distributed recovery over the group_replication_recovery channel (group_replication_recovery_use_ssl=ON), and the replication user account for Group Replication authenticates with the caching_sha2_password plugin (which is the default in MySQL 8.0). For more details, see Section 18.6.3.1.1, “Replication User With The Caching SHA-2 Authentication Plugin”.

group_replication_recovery_get_public_key指定是否从源请求基于RSA密钥对的密码交换所需的公钥。如果将group_replication_recovery_public_key_path设置为有效的公钥文件,则它优先于group_replification_recovery_get_public_key。如果您没有通过group_replication_recovery通道(group_replification_recovery_use_SSL=ON)使用SSL进行分布式恢复,并且组复制的复制用户帐户使用caching_sha2_password插件进行身份验证(这是MySQL 8.0中的默认插件),则此变量适用。有关更多详细信息,请参阅第18.6.3.1.1节,“使用缓存SHA-2身份验证插件复制用户”。

二、group_replication_recovery_public_key_path

这个参数的优先级高于group_replication_recovery_get_public_key参数!

0

The value of this system variable can be changed while Group Replication is running, but the change only takes effect after you stop and restart Group Replication on the group member.

此系统变量的值可以在组复制运行时更改,但只有在停止并重新启动组成员上的组复制后,更改才会生效。

group_replication_recovery_public_key_path specifies the path name to a file containing a replica-side copy of the public key required by the source for RSA key pair-based password exchange. The file must be in PEM format. If group_replication_recovery_public_key_path is set to a valid public key file, it takes precedence over group_replication_recovery_get_public_key. This variable applies if you are not using SSL for distributed recovery over the group_replication_recovery channel (so group_replication_recovery_use_ssl is set to OFF), and the replication user account for Group Replication authenticates with the caching_sha2_password plugin (which is the default in MySQL 8.0) or the sha256_password plugin. (For sha256_password, setting group_replication_recovery_public_key_path applies only if MySQL was built using OpenSSL.) For more details, see Section 18.6.3.1.1, “Replication User With The Caching SHA-2 Authentication Plugin”.

group_replication_recovery_public_key_path指定文件的路径名,该文件包含源进行基于RSA密钥对的密码交换所需的公钥的副本端副本。文件必须为PEM格式。如果将group_replication_recovery_public_key_path设置为有效的公钥文件,则它优先于group_replification_recovery_get_public_key。如果您没有通过group_replication_recovery通道使用SSL进行分布式恢复(因此group_replification_recovery_use_SSL设置为OFF),并且组复制的复制用户帐户使用caching_sha2_password插件(在MySQL 8.0中为默认值)或sha256_password插件进行身份验证,则此变量适用。(对于sha256_password,设置group_replication_recovery_public_key_path仅适用于使用OpenSSL构建MySQL的情况。)有关更多详细信息,请参阅第18.6.3.1.1节“使用缓存SHA-2身份验证插件复制用户”。

mysql> start group replication;

mysql> set global group_replication_recovery_get_public_key=on;

mysql> start group replication;

三、参数设置建议:

1、如下三个参数保持默认即可,默认就在数据文件目录下生成公钥和私钥

(1)caching_sha2_password_auto_generate_rsa_keys:是否自动生成RSA key,默认是on

(2)caching_sha2_password_private_key_path:RSA private key的文件名字,默认private_key.pem,默认是在数据文件目录!也可以是绝对路径!

(3)caching_sha2_password_public_key_path:RSA public key所在的位置的文件名字,默认public_key.pem,默认是在数据文件目录下!也可以是绝对路径!

2、建议直接设置去源自动获取公钥

group_replication_recovery_get_public_key=on

group_replication_recovery_public_key_path保持默认

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29654823/viewspace-3000392/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
10年数据库管理员从业经历,熟悉Oracle、mysql、tidb、oceanbase、redis、 mongodb 、python等技术栈,持有11g ocm 、mysql 5.7 ocp 、tidb 5.0 ptcp、tidb 6.0 ptca、oceanbase obcp等

注册时间:2014-05-12

  • 博文量
    327
  • 访问量
    2148952