az postgres flexible-server replica
管理只读副本。
命令
名称 | 说明 | 类型 | Status |
---|---|---|---|
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 为“testserver”创建只读副本“testreplicaserver”。
az postgres flexible-server replica create --replica-name testreplicaserver -g testGroup --source-server testserver --sku-name Standard_D4ds_v5 --storage-size 256
为“testserver”创建只读副本“testreplicaserver”,其中“testreplicaserver”位于其他资源组“newTestGroup”。 此处 --resource-group 用于只读副本的资源组,并且 --source-server 必须作为资源 ID 传递。
az postgres flexible-server replica create --replica-name testreplicaserver -g newTestGroup --source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServerName} --___location testLocation
必需参数
要还原到的服务器的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
要从中还原的源服务器的名称或资源 ID。
可选参数
以 CIDR 格式创建新虚拟网络时要使用的 IP 地址前缀。 默认值为 10.0.0.0/16。
用于数据加密的用户分配标识的名称或资源 ID。
用于数据加密的主 keyvault 密钥的资源 ID。
Location。
az account list-locations
中的值。 可以使用 az configure --defaults ___location=<___location>
配置默认位置。
不等待长时间运行的操作完成。
服务器的性能层。
此参数仅适用于具有专用访问权限的服务器。 新的或现有的专用 DNS 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同资源组或订阅中的区域,请提供资源 ID。CLI 会在与虚拟网络相同的资源组中创建新的专用 DNS 区域(如果未由用户提供)。
计算 SKU 的名称。 遵循Standard_{VM 名称}的约定。 示例:Standard_B1ms。
服务器的存储容量。 最小值为 32 GiB,最大值为 16 TiB。
新子网或现有子网的名称或资源 ID。 如果要使用不同的资源组或订阅中的子网,请提供资源 ID 而不是名称。 请注意,子网将委派给 flexibleServers。 委派后,此子网不能用于任何其他类型的 Azure 资源。
以 CIDR 格式创建新子网时要使用的子网 IP 地址前缀。 默认值为 10.0.0.0/24。
空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。
服务器的计算层。 接受的值:可突发、GeneralPurpose、MemoryOptimized。
新虚拟网络或现有虚拟网络的名称或 ID。 如果要使用来自不同资源组或订阅的 vnet,请提供资源 ID。 名称必须介于 2 到 64 个字符之间。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。
不要提示确认。
要在其中预配资源的可用性区域。
全局参数
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
az postgres flexible-server replica list
列出某个给定服务器的所有只读副本。
az postgres flexible-server replica list --name
--resource-group
示例
列出主服务器“testserver”的所有只读副本。
az postgres flexible-server replica list -g testGroup -n testserver
必需参数
源服务器的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
全局参数
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --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
可选参数
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。
是将只读副本提升到独立服务器还是将其提升为主服务器。
是在提升只读副本之前同步数据还是尽快升级数据。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
不要提示确认。
全局参数
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。