Share via


az mysql flexible-server import

管理 MySQL 彈性伺服器的匯入工作流程。

命令

名稱 Description 類型 狀態
az mysql flexible-server import create

為彈性伺服器建立新的匯入工作流程。

核心 GA

az mysql flexible-server import create

為彈性伺服器建立新的匯入工作流程。

此命令用於下列兩個用途:若要將外部 MySQL 伺服器移轉至 Azure MySQL 彈性伺服器,其備份會儲存在 Azure Blob 容器上。 若要將 Azure MySQL 單一伺服器移轉至 Azure MySQL 彈性伺服器。 如需網路設定的詳細資訊,請參閱

az mysql flexible-server import create --data-source
                                       --data-source-type {azure_blob, mysql_single}
                                       --name
                                       --resource-group
                                       [--address-prefixes]
                                       [--admin-password]
                                       [--admin-user]
                                       [--auto-scale-iops {Disabled, Enabled}]
                                       [--backup-identity]
                                       [--backup-key]
                                       [--backup-retention]
                                       [--data-source-backup-dir]
                                       [--data-source-sas-token]
                                       [--geo-redundant-backup {Disabled, Enabled}]
                                       [--high-availability {Disabled, SameZone, ZoneRedundant}]
                                       [--identity]
                                       [--iops]
                                       [--key]
                                       [--location]
                                       [--mode {Offline, Online}]
                                       [--private-dns-zone]
                                       [--public-access]
                                       [--sku-name]
                                       [--standby-zone]
                                       [--storage-auto-grow {Disabled, Enabled}]
                                       [--storage-size]
                                       [--subnet]
                                       [--subnet-prefixes]
                                       [--tags]
                                       [--tier]
                                       [--version]
                                       [--vnet]
                                       [--yes]
                                       [--zone]

範例

觸發從 azure mysql 單一伺服器的匯入。

az mysql flexible-server import create --data-source-type mysql_single \
  --data-source test-single-server --resource-group test-rg \
  --location northeurope --name testserver \
  --sku-name Standard_B1ms --tier Burstable --public-access 0.0.0.0 \
  --storage-size 32 --tags "key=value" --version 5.7 --high-availability ZoneRedundant \
  --zone 1 --standby-zone 3 --storage-auto-grow Enabled --iops 500

從 azure mysql 單一伺服器觸發在線匯入。

az mysql flexible-server import create --data-source-type mysql_single \
  --data-source test-single-server --mode "Online" --resource-group test-rg \
  --location northeurope --name testserver \
  --sku-name Standard_B1ms --tier Burstable --public-access 0.0.0.0 \
  --storage-size 32 --tags "key=value" --version 5.7 --high-availability ZoneRedundant \
  --zone 1 --standby-zone 3 --storage-auto-grow Enabled --iops 500

觸發儲存在 Azure Blob 容器中的來源備份匯入。

az mysql flexible-server import create --data-source-type "azure_blob" \
  --data-source "https://teststorage.blob.windows.net/backupcontainer" \
  --resource-group test-rg --name testserver --version 5.7 --location northeurope \
  --admin-user "username" --admin-password "password" \
  --sku-name Standard_D2ds_v4 --tier GeneralPurpose --public-access 0.0.0.0 \
  --storage-size 32 --tags "key=value" --high-availability ZoneRedundant \
  --zone 1 --standby-zone 3 --storage-auto-grow Enabled --iops 500

從儲存在 Azure Blob 容器中的來源備份觸發匯入。 (容器根目錄中沒有備份檔。而是出現在backupdata/data/)

az mysql flexible-server import create --data-source-type "azure_blob" \
  --data-source "https://teststorage.blob.windows.net/backupcontainer" \
  --data-source-backup-dir "backupdata/data/" \
  --resource-group test-rg --name testserver --version 5.7 --location northeurope \
  --admin-user "username" --admin-password "password" \
  --sku-name Standard_D2ds_v4 --tier GeneralPurpose --public-access 0.0.0.0 \
  --storage-size 32 --tags "key=value" --high-availability ZoneRedundant \
  --zone 1 --standby-zone 3 --storage-auto-grow Enabled --iops 500

從儲存在 Azure Blob 容器中的來源備份觸發匯入。 (備份檔案存在於容器根記憶體和 Blob 記憶體中,可透過具有讀取和列出許可權的 sas 令牌存取。請使用 SAS 令牌在命令中傳遞 『--%』。

az mysql flexible-server import create --data-source-type "azure_blob" \
  --data-source "https://teststorage.blob.windows.net/backupcontainer" \
  --data-source-sas-token "sp=r&st=2023-07-20T10:30:07Z..."  \
  --resource-group test-rg --name testserver --version 5.7 --location northeurope \
  --admin-user "username" --admin-password "password" \
  --sku-name Standard_D2ds_v4 --tier GeneralPurpose --public-access 0.0.0.0 \
  --storage-size 32 --tags "key=value" --high-availability ZoneRedundant \
  --zone 1 --standby-zone 3 --storage-auto-grow Enabled --iops 500

必要參數

--data-source

匯入至彈性伺服器的數據源。 根據數據源類型提供數據源,如下所示。 例如,mysql_single:Azure MySQL 單一伺服器的名稱或資源識別碼。 azure_blob:Azure Blob 容器的名稱或資源標識符。 Azure Blob 容器的記憶體 URI。 範例:https://{blob_name}.blob.core.windows.net/{container_name}。 記憶體 URI 不應包含 sas 令牌。 如有需要,可以在 「data-source-sas-token」 參數中提供 sas 令牌。

--data-source-type

數據源類型。 例如,mysql_single:適用於 MySQL 的 Azure 資料庫 伺服器。 azure_blob:Azure Blob 容器中提供的來源備份。

接受的值: azure_blob, mysql_single
--name -n

伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

選擇性參數

--address-prefixes

以 CIDR 格式建立新虛擬網路時要使用的 IP 位址前置碼。 預設值為 10.0.0.0/16。

--admin-password -p

系統管理員的密碼。 最少8個字元,最多128個字元。 密碼必須包含下列其中三種字元:英文大寫字母、英文小寫字母、數字和非英數字元。

--admin-user -u

伺服器 管理員 istrator 用戶名稱。 設定之後,就無法變更。

--auto-scale-iops

啟用或停用自動調整 iops。 預設值為 Disabled。

接受的值: Disabled, Enabled
預設值: Disabled
--backup-identity

數據加密之異地備份使用者身分識別的名稱或資源識別碼。 身分識別必須位於與備份區域相同的區域中。

--backup-key

用於數據加密之異地備份密鑰保存庫金鑰的資源識別碼。 金鑰必須位於與備份區域相同的區域中。

--backup-retention

保留備份的天數。 範圍 1 到 35 天。 預設值為 7 天。

--data-source-backup-dir

儲存來源備份之目錄的相對路徑。 根據預設,備份檔會從記憶體的根目錄讀取。 此參數適用於記憶體型數據來源。 範例:azure_blob。

--data-source-sas-token

用於存取數據源的 Sas 令牌。 此參數適用於記憶體型數據來源。 範例:azure_blob。

--geo-redundant-backup

是否啟用異地備援備份。

接受的值: Disabled, Enabled
--high-availability

啟用 (ZoneRedundant 或 SameZone) 或停用高可用性功能。

接受的值: Disabled, SameZone, ZoneRedundant
預設值: Disabled
--identity

用於數據加密之使用者指派身分識別的名稱或資源識別碼。

--iops

要為此伺服器配置的 IOPS 數目。 您將根據布建的計算和記憶體,取得特定數量的免費 IOPS。 IOPS 的預設值為免費的 IOPS。 若要深入瞭解以計算和記憶體為基礎的 IOPS,請參閱 適用於 MySQL 的 Azure 資料庫 彈性伺服器中的 IOPS。

--key

數據加密之主要金鑰保存庫金鑰的資源識別碼。

--location -l

位置。​​ 來自的值: az account list-locations。 您可以使用 az configure --defaults location=<location> 設定預設位置。

--mode

匯入模式。 列舉值:[離線]。 預設值為離線。

接受的值: Offline, Online
預設值: Offline
--private-dns-zone

只有在您建立具有私人存取權的跨區域複本伺服器時,才適用此參數。 對於具有私用存取權的區域讀取複本,來源伺服器設定會進行,而且會忽略此參數。 新或現有私人 DNS 區域的名稱或標識碼。 您可以使用來自相同資源群組、不同資源群組或不同訂用帳戶的私人 DNS 區域。 如果您想要使用來自不同資源群組或訂用帳戶的區域,請提供資源識別碼。如果使用者未提供,CLI 會在與虛擬網路相同的資源群組內建立新的私人 DNS 區域。

--public-access

判斷公用存取。 輸入要包含在允許IP清單中的單一或IP位址範圍。 IP 位址範圍必須以虛線分隔,且不包含任何空格。 指定 0.0.0.0 允許從 Azure 內部署的任何資源進行公用存取,以存取您的伺服器。 將它設定為 「None」 會以公用存取模式設定伺服器,但不會建立防火牆規則。

--sku-name

計算 SKU 的名稱。 遵循Standard_{VM 名稱}的慣例。 範例:Standard_B1ms。

--standby-zone

啟用高可用性時,待命伺服器的可用性區域資訊。

--storage-auto-grow

啟用或停用記憶體的自動成長。 預設值為 Enabled。

接受的值: Disabled, Enabled
--storage-size

伺服器的儲存容量。 最小值為 32 GiB,最大值為 16 TiB。

--subnet

新或現有子網的名稱或資源標識碼。 只有在您建立具有私人存取權的跨區域複本伺服器時,才適用此參數。 對於具有私用存取權的區域讀取複本,來源伺服器設定會進行,而且會忽略此參數。 如果您想要使用來自不同資源群組或訂用帳戶的子網,請提供資源識別碼,而不是名稱。 請注意,子網將會委派給彈性伺服器。 委派之後,此子網無法用於任何其他類型的 Azure 資源。

--subnet-prefixes

以 CIDR 格式建立新子網時要使用的子網 IP 位址前綴。 預設值為 10.0.0.0/24。

--tags

以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。

--tier

伺服器的計算層。 接受的值:高載、GeneralPurpose、MemoryOptimized。

--version

伺服器主要版本。

--vnet

新或現有虛擬網路的名稱或標識碼。 只有在您建立具有私人存取權的跨區域複本伺服器時,才適用此參數。 對於具有私用存取權的區域讀取複本,來源伺服器設定會進行,而且會忽略此參數。 如果您想要使用來自不同資源群組或訂用帳戶的 vnet,請提供資源識別碼。 名稱必須介於 2 到 64 個字元之間。 名稱的開頭必須是字母或數位、以字母、數位或底線結尾,而且只能包含字母、數位、底線、句號或連字元。

--yes -y

不提示確認。

預設值: False
--zone -z

要在其中布建資源的可用性區域。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。