共用方式為


az postgres flexible-server replica

管理讀取複本。

命令

名稱 Description 類型 狀態
az postgres flexible-server replica create

建立伺服器的讀取複本。

核心 GA
az postgres flexible-server replica list

列出指定伺服器的所有讀取複本。

核心 GA
az postgres flexible-server replica promote

停止複寫讀取複本,並將其升級為獨立伺服器或主伺服器。

核心 GA

az postgres flexible-server replica create

建立伺服器的讀取複本。

az postgres flexible-server replica create --replica-name
                                           --resource-group
                                           --source-server
                                           [--address-prefixes]
                                           [--identity]
                                           [--key]
                                           [--location]
                                           [--no-wait]
                                           [--performance-tier]
                                           [--private-dns-zone]
                                           [--sku-name]
                                           [--storage-size]
                                           [--subnet]
                                           [--subnet-prefixes]
                                           [--tags]
                                           [--tier]
                                           [--vnet]
                                           [--yes]
                                           [--zone]

範例

如果可用,請在指定的區域和位置中建立具有公用或私人存取權之 'testerver' 的讀取複本 'testreplicaserver'。

az postgres flexible-server replica create --replica-name testreplicaserver -g testGroup --source-server testserver --zone 3 --location testLocation

使用具有私人存取權之 'testerver' 的新子網建立讀取複本 'testreplicaserver'。

az postgres flexible-server replica create --replica-name testreplicaserver -g testGroup \
  --source-server testserver --zone 3 --location testLocation \
  --vnet newVnet --subnet newSubnet \
  --address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24 \
  --private-dns-zone testDNS.postgres.database.azure.com \
  --tags "key=value"

如果有的話,針對具有指定位置之公用或私人存取的 'testerver' 建立讀取複本 'testreplicaserver'。 因為區域未通過,所以它會自動在與來源伺服器不同的複本位置中挑選區域,如果有的話,否則會在複本位置中挑選與來源伺服器相同的區域,否則會將區域設定為 [無],亦即沒有喜好設定

az postgres flexible-server replica create --replica-name testreplicaserver -g testGroup --source-server testserver --location testLocation

使用自定義 --storage-size 和 --sku 建立 'testerver' 的讀取複本 'testreplicaserver'。

az postgres flexible-server replica create --replica-name testreplicaserver -g testGroup --source-server testserver --sku-name Standard_D4ds_v5 --storage-size 256

為 'testerver' 建立讀取複本 'testreplicaserver',其中 'testreplicaserver' 位於不同的資源群組 'newTestGroup'。 這裡 --resource-group 適用於讀取複本的資源群組,而 --source-server 必須以資源標識符的形式傳遞。

az postgres flexible-server replica create --replica-name testreplicaserver -g newTestGroup         --source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServerName} --location testLocation

必要參數

--replica-name

要還原的伺服器名稱。

--resource-group -g

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

--source-server

要從中還原的來源伺服器名稱或資源標識碼。

選擇性參數

--address-prefixes

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

--identity

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

--key

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

--location -l

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

--no-wait

請勿等候長時間執行的作業完成。

預設值: False
--performance-tier

伺服器的效能層級。

--private-dns-zone

此參數僅適用於具有私人存取權的伺服器。 新的或現有私人 DNS 區域的名稱或識別碼。 您可以使用來自相同資源群組、不同資源群組或不同訂閱的私人 DNS 區域。 如果您想要使用來自不同資源群組或訂閱的區域,請提供資源識別碼。如果使用者未提供,CLI 會在與虛擬網路相同的資源群組內建立新的私人 DNS 區域。

--sku-name

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

--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。

--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。

az postgres flexible-server replica list

列出指定伺服器的所有讀取複本。

az postgres flexible-server replica list --name
                                         --resource-group

範例

列出主伺服器 『testerver』 的所有讀取複本。

az postgres flexible-server replica list -g testGroup -n testserver

必要參數

--name -n

來源伺服器的名稱。

--resource-group -g

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

全域參數
--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。

az postgres flexible-server replica promote

停止複寫讀取複本,並將其升級為獨立伺服器或主伺服器。

az postgres flexible-server replica promote [--ids]
                                            [--name]
                                            [--promote-mode {standalone, switchover}]
                                            [--promote-option {forced, planned}]
                                            [--resource-group]
                                            [--subscription]
                                            [--yes]

範例

停止復寫至 'testreplicaserver',並將其升級為獨立讀取/寫入伺服器。

az postgres flexible-server replica promote -g testGroup -n testreplicaserver

停止復寫至 'testreplicaserver',並將它升級為具有強制數據同步的獨立讀取/寫入伺服器。

az postgres flexible-server replica promote -g testGroup -n testreplicaserver --promote-mode standalone --promote-option forced

停止復寫至 'testreplicaserver',並將它升級為具有計劃性數據同步的主伺服器。您升級的複本必須指派讀取器虛擬端點,否則您會收到升級時發生錯誤。

az postgres flexible-server replica promote -g testGroup -n testreplicaserver --promote-mode switchover --promote-option planned

選擇性參數

--ids

一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--name -n

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

--promote-mode

是要將讀取複本升級為獨立伺服器,還是將它升級為主伺服器。

接受的值: standalone, switchover
預設值: standalone
--promote-option

是否要在升級讀取複本之前同步處理數據,還是儘快升級數據。

接受的值: forced, planned
預設值: planned
--resource-group -g

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

--subscription

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

--yes -y

請勿提示確認。

預設值: False
全域參數
--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。