简体   繁体   English

如何使用反向代理机制模拟 Azure Cosmos DB 和 Azure Redis 区域故障场景?

[英]How to simulate Azure Cosmos DB and Azure Redis regional failure scenarios using reverse proxy mechanism?

To simulate regional failure, using Fiddler below custom rules has been created under "OnBeforeResponse" function.为了模拟区域故障,在“OnBeforeResponse”function 下创建了自定义规则下方的 Fiddler。

I can able to intercept http calls to Azure storage account successfully and able to inject failed response where as https calls to Azure Cosmos DB calls I can't able to intercept why? I can able to intercept http calls to Azure storage account successfully and able to inject failed response where as https calls to Azure Cosmos DB calls I can't able to intercept why? Am I missing anything?我错过了什么吗?

I can't even able to intercept Azure redis related calls but I can understand the reason that Redis is not using HTTP communication but why I cant able to intercept https calls to Azure Cosmos DB calls, no idea and needs expertise opinion. I can't even able to intercept Azure redis related calls but I can understand the reason that Redis is not using HTTP communication but why I cant able to intercept https calls to Azure Cosmos DB calls, no idea and needs expertise opinion.

Also need advice on how to intercept Redis calls and to inject artificial failure response code?还需要有关如何拦截 Redis 调用和注入人工故障响应代码的建议? to simulate Azure Redis regional failure situation.模拟Azure Redis区域故障情况。

         static function OnBeforeResponse(oSession: Session) {
                if (m_Hide304s && oSession.responseCode == 304) {
                    oSession["ui-hide"] = "true";
                }
    
                // az storage account call manipulated response
                if (oSession.hostname == "mystorageaccount.blob.core.windows.net")
                {
                    oSession.responseCode = 503;
                }
    
                // az cosmos db account call manipulated response -- not working
                if (oSession.hostname == "mydocdb.documents.azure.com")
                {
                    oSession.responseCode = 503;
                }
                // az redis call manipulated response -- not working
                if (oSession.hostname == "myrediscache.redis.cache.windows.net")
                {
                    oSession.responseCode = 503;
                }       

通过 fiddler 捕获的示例网络流量:

PS: At the moment we are using cosmos db SDK v2 whether cosmos db SDK v2 by default uses HTTP or TCP? PS: At the moment we are using cosmos db SDK v2 whether cosmos db SDK v2 by default uses HTTP or TCP? as per fiddler it is HTTP.根据提琴手,它是 HTTP。

I don't know what Redis does but you can do failover testing in Cosmos by manually failing a region over to your secondary region.我不知道 Redis 做了什么,但您可以通过手动将区域故障转移到辅助区域来在 Cosmos 中进行故障转移测试。 This can be done in the portal or with PS, CLI, Templates or using Azure Management SDK.这可以在门户中或使用 PS、CLI、模板或使用 Azure 管理 SDK 来完成。

Can learn more here, Perform a manual failover on a Cosmos DB account可以在此处了解更多信息, 对 Cosmos DB 帐户执行手动故障转移

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以使用 Java SDK 通过反向代理连接到 Azure Cosmos DB? - Is it possible to connect to Azure Cosmos DB via a reverse proxy using Java SDK? Azure Cosmos DB实施失败 - Azure Cosmos DB Implementation Failure 如何使用 Azure 逻辑应用将数据插入 Azure Cosmos DB? - How to insert data into Azure Cosmos DB using Azure Logic apps? 冲突如何影响多主复制方案中的 Azure Cosmos DB 更改源? - How do conflicts affect the Azure Cosmos DB Change Feed in multi-master replication scenarios? 使用Azure Web App作为反向代理 - Using azure webapp as reverse proxy 如何使用nodejs sdk更改azure cosmos db容器的吞吐量? - how to change throughput of azure cosmos db container using nodejs sdk? 如何使用 Azure Cosmos DB Spark 仅将不存在的记录写入 Cosmos DB? - How to write only non existing records to Cosmos DB from using Azure Cosmos DB Spark? 如何使用 Azure 门户在 Cosmos DB 中创建单个分区集合 - How to create single partitioned collection in Cosmos DB using Azure portal 如何在 Azure Cosmos DB 中使用多个属性对数据进行分区 - How to partition data using multiple properties in Azure Cosmos DB 如何使用Powershell复制Azure Cosmos DB存储过程 - How to copy Azure Cosmos DB stored procedure using Powershell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM