在从服务器实例创建生产部署之前,您需要检查每个实例上的 MySQL 是否已正确配置。该dba.configureInstance()
函数作为配置实例的一部分执行此操作,但您可以选择使用该
函数。这会检查实例是否满足
第 7.1 节“InnoDB 集群要求”中列出的要求,
而无需更改实例上的任何配置。这不会检查实例上的任何数据,请参阅
检查实例状态了解更多信息。
dba.checkInstanceConfiguration(
instance
)
用于连接到实例的用户必须具有适当的权限,例如在 手动配置 InnoDB 集群管理员帐户中配置的权限。下面演示了在正在运行的 MySQL Shell 中发出此命令:
Press CTRL+C to copymysql-js> dba.checkInstanceConfiguration('icadmin@ic-1:3306') Please provide the password for 'icadmin@ic-1:3306': *** Validating MySQL instance at ic-1:3306 for use in an InnoDB cluster... This instance reports its own address as ic-1 Clients and other cluster members will communicate with it through this address by default. If this is not correct, the report_host MySQL system variable should be changed. Checking whether existing tables comply with Group Replication requirements... No incompatible tables detected Checking instance configuration... Some configuration options need to be fixed: +--------------------------+---------------+----------------+--------------------------------------------------+ | Variable | Current Value | Required Value | Note | +--------------------------+---------------+----------------+--------------------------------------------------+ | enforce_gtid_consistency | OFF | ON | Update read-only variable and restart the server | | gtid_mode | OFF | ON | Update read-only variable and restart the server | | server_id | 1 | | Update read-only variable and restart the server | +--------------------------+---------------+----------------+--------------------------------------------------+ Please use the dba.configureInstance() command to repair these issues. { "config_errors": [ { "action": "restart", "current": "OFF", "option": "enforce_gtid_consistency", "required": "ON" }, { "action": "restart", "current": "OFF", "option": "gtid_mode", "required": "ON" }, { "action": "restart", "current": "1", "option": "server_id", "required": "" } ], "status": "error" }
对您计划用作集群一部分的每个服务器实例重复此过程。运行后生成的报告
dba.checkInstanceConfiguration()
提供了有关在 InnoDB Cluster 部署中使用该实例所需的任何配置更改的信息。报告部分中的action
字段
config_error
告诉您实例上的 MySQL 是否需要重新启动以检测对配置文件所做的任何更改。