你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az postgres flexible-server migration

管理 PostgreSQL 灵活服务器的迁移工作流。

命令

名称 说明 类型 状态
az postgres flexible-server migration check-name-availability

检查是否可以使用提供的迁移名称。

核心 GA
az postgres flexible-server migration create

为灵活服务器创建新的迁移工作流。

核心 GA
az postgres flexible-server migration list

列出灵活服务器的迁移。

核心 GA
az postgres flexible-server migration show

获取特定迁移的详细信息。

核心 GA
az postgres flexible-server migration update

更新特定迁移。

核心 GA

az postgres flexible-server migration check-name-availability

检查是否可以使用提供的迁移名称。

az postgres flexible-server migration check-name-availability --migration-name
                                                              [--ids]
                                                              [--name]
                                                              [--resource-group]
                                                              [--subscription]

示例

检查提供的迁移名称是否可用于迁移工作流。

az postgres flexible-server migration check-name-availability --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

必需参数

--migration-name

迁移的名称。

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

迁移目标服务器名称。

--resource-group -g

迁移目标服务器的资源组名称。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server migration create

为灵活服务器创建新的迁移工作流。

az postgres flexible-server migration create --name
                                             --properties
                                             --resource-group
                                             [--location]
                                             [--migration-mode {offline, online}]
                                             [--migration-name]
                                             [--migration-option {Migrate, Validate, ValidateAndMigrate}]
                                             [--migrationRuntimeResourceId]
                                             [--tags]

示例

在由参数标识的目标服务器上启动迁移工作流。 迁移的配置应在migrationConfig.json文件中指定。 将 --migration-mode 脱机用于脱机迁移。 示例migrationConfig.json如下所示:{ “properties”: { “SourceDBServerResourceId”: “/subscriptions/xxxxxxxx-xxxx-resourceGroups/test-single-rg/providers/Microsoft.DBforPostgreSQL/servers/pg-single-1”, “SecretParameters”: { “管理员Credentials”: { “SourceServerPassword”: “password”, “TargetServerPassword”: “password” }, “SourceServerUserName”: “testuser@pg-single-1”, “TargetServerUserName”: “fspguser” },dBsToMigrate“: [ ”postgres“ ], ”OverwriteDbsInTarget“: ”true“, ”SourceType“: ”PostgreSQLSingleServer“, ”SslMode“: ”VerifyFull“ } } }

az postgres flexible-server migration create --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver         --migration-name testmigration --properties "migrationConfig.json" --migration-mode offline

在由参数标识的目标服务器上启动迁移工作流。 迁移的配置应在migrationConfig.json文件中指定。 使用 --migration-mode online for Online(具有 CDC)迁移,此示例migrationConfig.json。 使用 migration-option Validate 验证仅验证请求 { “properties”: { “SourceDBServerResourceId”: “/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxx-resourceGroups/test-single-rg/providers/Microsoft.DBforPostgreSQL/servers/pg-single-1”, “SecretParameters”: { “管理员Credentials”: { “SourceServerPassword”: “password”, “TargetServerPassword”: “password” }, “SourceServerUserName”: “testuser@pg-single-1”, “TargetServerUserName”: “fspguser” },dBsToMigrate“: [ ”postgres“ ], ”OverwriteDbsInTarget“: ”true“ } } SourceType 和 sslmode 参数分别设置为”PostgreSQL 单一服务器“和”VerifyFull“ , 如果源资源 ID 遵循 /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx/resourceGroups/{rg-name}/providers/Microsoft.DBforPostgreSQL/servers/{single-server-name} 服务器模式。 将忽略在 CLI/SDK 中为这些参数传递的任何值。

az postgres flexible-server migration create --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver        --migration-name testmigration --properties "migrationConfig.json" --migration-mode online --migration-option Validate

在由参数标识的目标服务器上启动迁移工作流。 迁移的配置应在migrationConfig.json文件中指定。 使用 --migration-option Migrate for Migrate only 请求。

az postgres flexible-server migration create --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver         --migration-name testmigration --properties "migrationConfig.json" --migration-option Migrate

默认迁移选项为 ValidateAndMigrate。 必须为 PostgreSQLSingleServer 以外的迁移传递 SoureType 和 SslMode。 json 文件中的迁移参数应如下所示:{ “properties”: { “SourceDBServerResourceId”: “20.66.25.58:5432@postgres”, “SecretParameters”: { “管理员Credentials”: { “SourceServerPassword”: “password”, “TargetServerPassword”: “password” }, “SourceServerUserName”: “postgres”, “TargetServerUserName”: “fspguser” }, “dBsToMigrate”: [ “ticketdb”,“timedb”,“inventorydb” ], “OverwriteDbsInTarget”: “true”, “SourceType”: “OnPremises”, “SslMode”: “Prefer” } }

az postgres flexible-server migration create --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver         --migration-name testmigration --properties "migrationConfig.json"

在参数标识的目标服务器上启动启用了专用终结点的迁移工作流。 迁移的配置应在migrationConfig.json文件中指定。 使用 --migrationRuntimeResourceId 定义负责在源服务器和目标服务器之间迁移数据的迁移运行时服务器。

az postgres flexible-server migration create --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name testmigration --properties "migrationConfig.json" --migrationRuntimeResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testGroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/testsourcemigration

必需参数

--name -n

迁移目标服务器名称。

--properties -b

请求属性。 使用双引号或无引号将 json filepath 作为参数传入。

--resource-group -g

迁移目标服务器的资源组名称。

可选参数

--location -l

位置。 az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--migration-mode

脱机或联机(使用 CDC)迁移。

接受的值: offline, online
默认值: offline
--migration-name

迁移的名称。

--migration-option

支持的迁移选项。 默认值为 ValidateAndMigrate。

接受的值: Migrate, Validate, ValidateAndMigrate
默认值: ValidateAndMigrate
--migrationRuntimeResourceId -r

对于专用终结点迁移,此 ID 负责在源服务器和目标服务器之间迁移数据。

--tags

空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server migration list

列出灵活服务器的迁移。

az postgres flexible-server migration list --name
                                           --resource-group
                                           [--filter {Active, All}]

示例

列出目标灵活服务器的当前活动迁移。

az postgres flexible-server migration list --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --filter Active

列出目标灵活服务器的所有(活动/已完成)迁移。

az postgres flexible-server migration list --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --filter All

必需参数

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

迁移目标服务器的资源组名称。

可选参数

--filter

指示返回所有迁移还是仅返回活动迁移。 有效值为:Active 和 All。

接受的值: Active, All
默认值: Active
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server migration show

获取特定迁移的详细信息。

az postgres flexible-server migration show --migration-name
                                           [--ids]
                                           [--name]
                                           [--resource-group]
                                           [--subscription]

示例

获取目标灵活服务器的特定迁移的详细信息。

az postgres flexible-server migration show --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name testmigration

必需参数

--migration-name

迁移的名称。

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

迁移目标服务器名称。

--resource-group -g

迁移目标服务器的资源组名称。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server migration update

更新特定迁移。

az postgres flexible-server migration update --migration-name
                                             [--cancel]
                                             [--cutover]
                                             [--ids]
                                             [--name]
                                             [--resource-group]
                                             [--setup-replication]
                                             [--subscription]

示例

允许迁移工作流在源上设置逻辑副本 (replica)。 请注意,此命令将重启源服务器。

az postgres flexible-server migration update --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name testmigration --setup-replication

剪切迁移中涉及的所有数据库的数据迁移。 完成此操作后,不会将迁移中的所有数据库的后续更新迁移到目标。 只能为 migration_mode=Online 触发直接转换迁移。

az postgres flexible-server migration update --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name testmigration --cutover

取消迁移中涉及的所有数据库的数据迁移。 只能取消“InProgress”迁移

az postgres flexible-server migration update --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name testmigration --cancel

必需参数

--migration-name

迁移的名称。

可选参数

--cancel

取消所有数据库的数据迁移。

--cutover

剪切迁移中所有数据库的数据迁移。 完成此操作后,不会将所有数据库的后续更新迁移到目标。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

--name -n

迁移目标服务器名称。

--resource-group -g

迁移目标服务器的资源组名称。

--setup-replication

允许迁移工作流在源上设置逻辑副本 (replica)。 请注意,此命令将重启源服务器。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。