文件首頁
MySQL Shell 8.4
下載本手冊
PDF (美國 Letter) - 2.2Mb
PDF (A4) - 2.3Mb


MySQL Shell 8.4  /  ...  /  預先檢查 InnoDB Cluster 使用的執行個體配置

7.4.1 預先檢查 InnoDB Cluster 使用的執行個體配置

在從伺服器執行個體建立生產環境部署之前,您需要檢查每個執行個體上的 MySQL 是否已正確設定。 dba.configureInstance() 函數會在設定執行個體時執行此操作,但您可以選擇使用 dba.checkInstanceConfiguration(instance) 函數。這會檢查執行個體是否滿足第 7.1 節「InnoDB Cluster 需求」中列出的需求,而不會變更執行個體上的任何配置。

您用來連線至執行個體的使用者必須具有適當的權限,例如在手動設定 InnoDB Cluster 管理員帳戶中設定的權限。以下示範如何在執行中的 MySQL Shell 中發出此命令

mysql-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 部署所需的任何配置變更的資訊。報告的 config_error 區段中的 action 欄位會告知您,執行個體上的 MySQL 是否需要重新啟動才能偵測到對組態檔所做的任何變更。