databaseAccounts
Summary
Details
高可用性を実現するために少なくとも 2 つのリージョンを構成する
Impact: High Category: High Availability PG Verified: Verified
Description:
ダウンタイムなしでより高い SLA を実現するには、Cosmos DB でセカンダリ リージョンを有効にします。地図上に場所をピン留めするだけで簡単です。強い整合性を実現するには、障害が発生した場合に書き込みができるように少なくとも 3 つのリージョンを構成します。
Potential Benefits:
Enhances SLA and resilience
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// Azure Resource Graph Query
// Query to find Azure Cosmos DB accounts that have less than 2 regions or less than 3 regions with strong consistency level
Resources
| where type =~ 'Microsoft.DocumentDb/databaseAccounts'
| where
array_length(properties.locations) < 2 or
(array_length(properties.locations) < 3 and properties.consistencyPolicy.defaultConsistencyLevel == 'Strong')
| project recommendationId='43663217-a1d3-844b-80ea-571a2ce37c6c', name, id, tags
単一の書き込みリージョンを持つマルチリージョン アカウントのサービス管理フェイルオーバーを有効にする
Impact: High Category: Disaster Recovery PG Verified: Verified
Description:
Cosmos DB は、高い稼働時間と復元力を誇ります。それでも、問題が発生する可能性があります。サービス管理フェールオーバーを使用すると、リージョンがダウンした場合、Cosmos DB は次の利用可能なリージョンに自動的に切り替わり、ユーザーの操作は必要ありません。
Potential Benefits:
Auto failover for high uptime
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// Azure Resource Graph Query
// Query to list all Azure Cosmos DB accounts that do not have multiple write locations or automatic failover enabled
Resources
| where type =~ 'Microsoft.DocumentDb/databaseAccounts'
| where
array_length(properties.locations) > 1 and
tobool(properties.enableAutomaticFailover) == false and
tobool(properties.enableMultipleWriteLocations) == false
| project recommendationId='9cabded7-a1fc-6e4a-944b-d7dd98ea31a2', name, id, tags
マルチリージョン書き込み機能を評価する
Impact: High Category: High Availability PG Verified: Verified
Description:
マルチリージョン書き込み機能により、複数リージョンにわたって可用性の高いアプリケーションを設計できますが、一貫性要件と競合解決には細心の注意が必要です。セットアップが不適切であると、可用性が低下し、処理できない競合によりデータ破損が発生する可能性があります。
Potential Benefits:
Enhances high availability
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// Azure Resource Graph Query
// Query to find Azure Cosmos DB accounts that have multiple read locations but do not have multiple write locations enabled
Resources
| where type =~ 'Microsoft.DocumentDb/databaseAccounts'
| where
array_length(properties.locations) > 1 and
properties.enableMultipleWriteLocations == false
| project recommendationId='9ce78192-74a0-104c-b5bb-9a443f941649', name, id, tags
継続的バックアップ モードを構成する
Impact: High Category: Disaster Recovery PG Verified: Verified
Description:
Cosmos DB のバックアップは常にオンになっており、データ事故に対する保護を提供します。継続モードでは、Microsoft サポートへの連絡が必要な定期モードとは異なり、事故前の時点へのセルフサービス復元が可能であり、復元時間が長くなります。
Potential Benefits:
Faster self-serve data restore
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// Azure Resource Graph Query
// Query all Azure Cosmos DB accounts that do not have continuous backup mode configured
Resources
| where type =~ 'Microsoft.DocumentDb/databaseAccounts'
| where
properties.backupPolicy.type == 'Periodic' and
properties.enableMultipleWriteLocations == false and
properties.enableAnalyticalStorage == false
| project recommendationId='e544520b-8505-7841-9e77-1f1974ee86ec', name, id, tags
クエリ結果が完全に排出されていることを確認する
Impact: High Category: Scalability PG Verified: Verified
Description:
Cosmos DB には 4 MB の応答制限があるため、大規模なクエリやパーティションにまたがるクエリでは結果がページ分割されます。各ページには可用性が表示され、次のページへの継続トークンが提供されます。完了するまですべてのページを走査するには、コード内の while ループが必要です。
Potential Benefits:
Maximizes data retrieval efficiency
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// under-development
クライアントでシングルトン パターンを維持する
Impact: Medium Category: Scalability PG Verified: Verified
Description:
接続はクライアントに結び付けられるため、アカウントおよびアプリケーションごとに SDK クライアントの単一インスタンスを使用することが重要です。コンピューティング環境にはオープン接続の制限があり、それを超えると接続に影響します。
Potential Benefits:
Optimizes connections and efficiency
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// under-development
クライアントに再試行ロジックを実装する
Impact: Medium Category: High Availability PG Verified: Verified
Description:
Cosmos DB SDK は、再試行を通じて多くの一時的なエラーを自動的に管理します。それにもかかわらず、SDK が一般的に対処できない特定のケースを対象とした追加の再試行ポリシーをアプリケーションが実装し、より堅牢なエラー処理を確保することが重要です。
Potential Benefits:
Enhances error handling resilience
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// under-development
Cosmos DB の健全性を監視し、アラートを設定する
Impact: Medium Category: Monitoring and Alerting PG Verified: Verified
Description:
Azure Cosmos DB リソースの可用性と応答性を監視し、ワークロードに対してアラートを設定することをお勧めします。これにより、予期せぬイベントに積極的に対処できるようになります。
Potential Benefits:
Proactive issue management
Learn More:
ARG Query:
Click the Azure Resource Graph tab to view the query
// under-development