az postgres flexible-server replica
管理讀取複本。
命令
| 名稱 | Description | 類型 | 狀態 |
|---|---|---|---|
| az postgres flexible-server replica create |
建立伺服器的讀取複本。 |
Core | GA |
| az postgres flexible-server replica list |
列出指定伺服器的所有讀取複本。 |
Core | GA |
| az postgres flexible-server replica promote |
停止複寫讀取複本,並將其升級為獨立伺服器或主伺服器。 |
Core | GA |
az postgres flexible-server replica create
建立伺服器的讀取複本。
az postgres flexible-server replica create --name
--resource-group
--source-server
[--acquire-policy-token]
[--backup-federated-client-id]
[--change-reference]
[--federated-client-id]
[--identity]
[--key]
[--location]
[--no-wait]
[--performance-tier]
[--private-dns-zone]
[--sku-name]
[--storage-size]
[--storage-type {PremiumV2_LRS}]
[--subnet]
[--tags]
[--tier]
[--vnet]
[--yes]
[--zone]
範例
為指定區域與地點建立一個讀取副本「testreplica」,並於指定區域與地點提供公開或私有存取權限。
az postgres flexible-server replica create --name testreplica -g testGroup --source-server testserver --zone 3 --location testLocation
為「testserver」建立一個讀取副本「testreplica」,並利用現有網路資源進行私有存取。
az postgres flexible-server replica create --name testreplica -g testGroup \
--source-server testserver --zone 3 --location testLocation \
--vnet newVnet --subnet newSubnet \
--private-dns-zone testdns.postgres.database.azure.com \
--tags "key=value"
若有,請為指定地點的「testserver」建立一個讀取副本「testreplica」,並可存取公開或私人存取權限。 因為區域未通過,所以它會自動在與來源伺服器不同的複本位置中挑選區域,如果有的話,否則會在複本位置中挑選與來源伺服器相同的區域,否則會將區域設定為 [無],亦即沒有喜好設定
az postgres flexible-server replica create --name testreplica -g testgroup --source-server testserver --location testLocation
為 testserver 建立一個讀取複本 'testreplica',並自訂 --storage-size 和 --sku。
az postgres flexible-server replica create --name testreplica -g testgroup --source-server testserver --sku-name Standard_D4ds_v5 --storage-size 256
建立一個讀取副本 'testreplica' 來表示 'testserver',其中 'testreplica' 屬於另一個資源群組 'newTestGroup'。 此處 --resource-group 是讀取副本的資源群組,--source-server 必須作為資源識別碼傳遞。
az postgres flexible-server replica create --name testreplicaserver -g newTestGroup --source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServer} --location testLocation
必要參數
讀取複本的名稱。
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
還原來源伺服器的名稱或資源識別碼。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
地理備份聯邦身份的客戶端 ID。
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
聯邦身份的客戶端 ID。
使用者為資料加密所指派的身份名稱或資源識別碼。
資料加密時主要金鑰庫金鑰的資源識別碼。
Location. 值的來源:az account list-locations。 您可以使用 az configure --defaults location=<location>來設定預設位置。
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
伺服器的效能層級。
此參數僅適用於擁有私有存取權的伺服器,且在使用 --vnet 或 --子網路時是必須的。 現有私有 DNS 區域的名稱或資源識別碼。 你可以使用同一資源群組、不同資源群組或不同訂閱的私有 DNS 區域。 如果您想使用不同資源群組或訂閱的區域,請提供該資源識別碼。
計算 SKU 的名稱。 遵循Standard_{VM 名稱}的慣例。 範例:Standard_B1ms。
伺服器的儲存容量。 最小值為 32 GiB,最大值為 16 TiB。
讀取副本的儲存類型。 允許的值是PremiumV2_LRS。 預設是讀取副本會與主要伺服器的儲存類型相符。
| 屬性 | 值 |
|---|---|
| 接受的值: | PremiumV2_LRS |
現有子網的名稱或識別碼。 如果您想使用來自不同資源群組或訂閱的子網路,請提供其資源識別碼而非名稱。
以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。
伺服器的計算層。 接受的值:高載、GeneralPurpose、MemoryOptimized。
現有虛擬網路的名稱或識別碼。 如果你想使用來自不同資源群組或訂閱的 vnet,請提供資源識別碼。 此名稱的長度必須介於 2 到 64 個字元之間。 名稱必須以字母或數字開頭,以字母、數字或底線結尾,且只能包含字母、數字、底線、句號 (.) 或連字號。
請勿提示確認。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
要在其中佈建資源的可用性區域。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server replica list
列出指定伺服器的所有讀取複本。
az postgres flexible-server replica list [--ids]
[--name]
[--resource-group]
[--subscription]
範例
列出主伺服器 『testerver』 的所有讀取複本。
az postgres flexible-server replica list -g testgroup -n testserver
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server replica promote
停止複寫讀取複本,並將其升級為獨立伺服器或主伺服器。
az postgres flexible-server replica promote [--acquire-policy-token]
[--change-reference]
[--ids]
[--name]
[--promote-mode {standalone, switchover}]
[--promote-option {forced, planned}]
[--resource-group]
[--subscription]
[--yes]
範例
停止複製到 'testreplica',並提升它成為獨立的讀寫伺服器。
az postgres flexible-server replica promote -g testgroup -n testreplica
停止複製到 'testreplica',並推廣它成為獨立讀寫伺服器,並強制同步資料。
az postgres flexible-server replica promote -g testgroup -n testreplica --promote-mode standalone --promote-option forced
停止複製到「testreplica」,並升級到主伺服器並計畫同步資料。你推廣的複本必須指定讀取器虛擬端點,否則推廣時會收到錯誤。
az postgres flexible-server replica promote -g testgroup -n testreplica --promote-mode switchover --promote-option planned
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
讀取複本的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
是要將讀取複本升級為獨立伺服器,還是將它升級為主伺服器。
| 屬性 | 值 |
|---|---|
| 預設值: | standalone |
| 接受的值: | standalone, switchover |
是否要在升級讀取複本之前同步處理數據,還是儘快升級數據。
| 屬性 | 值 |
|---|---|
| 預設值: | planned |
| 接受的值: | forced, planned |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿提示確認。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |