【问题标题】:Re-create cosmos DB by using script使用脚本重新创建 cosmos DB
【发布时间】:2018-07-02 18:08:12
【问题描述】:

我有一个与特定帐户绑定的现有 cosmos DB。

我的问题是我是否可以使用脚本部署在另一个帐户中创建相同的 CosmosDB。

我研究过可以使用 Azure 资源管理器创建资源,但不确定如何获取现有 CosmosDB 的模板。

还有没有办法获取现有 CosmosDB 的 JSON 脚本?。

【问题讨论】:

标签: azure azure-cosmosdb azure-powershell azure-cli


【解决方案1】:

您实际上并没有这样的架构,您有设置和索引配置以及其他资产。

要迁移数据,请查看此工具

https://docs.microsoft.com/en-us/azure/cosmos-db/import-data

迁移数据后,只需复制并粘贴任何索引定义和其他资产(例如过程)即可。

您可能需要在迁移过程中增加 RU。

关于如何使用该工具的一些示例:

将数据从一个 Azure Cosmos DB 集合迁移到另一个 Azure Cosmos DB 集合

dt.exe /s:CosmosDB /s.ConnectionString:"AccountEndpoint=<CosmosDB Endpoint>;AccountKey=<CosmosDB Key>;Database=<CosmosDB Database>;" /s.Collection:TEColl /t:CosmosDBBulk /t.ConnectionString:" AccountEndpoint=<CosmosDB Endpoint>;AccountKey=<CosmosDB Key>;Database=<CosmosDB Database>;" /t.Collection:TESessions /t.CollectionThroughput:2500

将数据从多个 Azure Cosmos DB 集合迁移到单个 Azure Cosmos DB 集合

dt.exe /s:CosmosDB /s.ConnectionString:"AccountEndpoint=<CosmosDB Endpoint>;AccountKey=<CosmosDB Key>;Database=<CosmosDB Database>;" /s.Collection:comp1|comp2|comp3|comp4 /t:CosmosDBBulk /t.ConnectionString:"AccountEndpoint=<CosmosDB Endpoint>;AccountKey=<CosmosDB Key>;Database=<CosmosDB Database>;" /t.Collection:singleCollection /t.CollectionThroughput:2500

将 Azure Cosmos DB 集合导出到 JSON 文件

dt.exe /s:CosmosDB /s.ConnectionString:"AccountEndpoint=<CosmosDB Endpoint>;AccountKey=<CosmosDB Key>;Database=<CosmosDB Database>;" /s.Collection:StoresSub /t:JsonFile /t.File:StoresExport.json /t.Overwrite /t.CollectionThroughput:2500

【讨论】:

    猜你喜欢
    • 2021-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-09
    • 2018-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多