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 stop-replication

停止複寫至讀取複本,並將其設為讀取/寫入伺服器。

核心 已取代

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]
                                           [--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

如果有的話,請在指定的位置建立具有公用或私人存取權之 '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

必要參數

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

--tier

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

--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 來取得完整偵錯記錄。

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 來取得完整偵錯記錄。

az postgres flexible-server replica stop-replication

已被取代

此命令已被取代,並將在未來版本中移除。 請改用 「postgres 彈性伺服器複本升級」。

停止複寫至讀取複本,並將其設為讀取/寫入伺服器。

az postgres flexible-server replica stop-replication [--ids]
                                                     [--name]
                                                     [--resource-group]
                                                     [--subscription]
                                                     [--yes]

範例

停止複寫至 'testReplicaServer',並將其設為讀取/寫入伺服器。

az postgres flexible-server replica stop-replication -g testGroup -n testReplicaServer

選擇性參數

--ids

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

--name -n

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

--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 來取得完整偵錯記錄。