简体   繁体   English

Azure Service Bus Premium-地理恢复-丢弃的消息

[英]Azure Service Bus Premium - Geo-Recovery - dropped messages

I have a Premium Service Bus namespace in one region, and have created another one in another region, as a secondary. 我在一个区域中具有Premium Service Bus名称空间,并在另一个区域中创建了另一个名称空间作为辅助资源。 I have enabled Geo-Recovery on the primary, and have configured the pairing with the secondary. 我已在主数据库上启用了Geo-Recovery,并已配置了与辅助数据库的配对。 I ran a test to continuously send messages to a Topic, and I have a receiving application subscribed to it. 我运行了一个测试以连续向主题发送消息,并且有一个接收应用程序已订阅该主题。 The sender will send "Sending message: Message {number in sequence}" and receiver will display "Received message: SequenceNumber:{SB assigned sequence number} Body:Message {number in sequence}". 发送方将发送“发送消息:消息{序列号}”,接收方将显示“接收消息:序列号:{SB分配的序列号}正文:消息{序列号}”。 However, when I tried to initiate a Failover to the secondary through the Portal, I noticed that though the sender kept on sending messages, the receiver dropped some messages while completing the failover. 但是,当我尝试通过门户向辅助服务器发起故障转移时,我注意到尽管发件人继续发送消息,但接收者在完成故障转移时仍丢弃了一些消息。 Please see below: 请看下面:

Logs from Sender: 发件人的日志:

Sending message: Message 244
Sending message: Message 245
Sending message: Message 246
Sending message: Message 247
Sending message: Message 248
Sending message: Message 249
Sending message: Message 250
Sending message: Message 251
Sending message: Message 252
Sending message: Message 253
Sending message: Message 254
Sending message: Message 255
Sending message: Message 256
Sending message: Message 257
Sending message: Message 258
Sending message: Message 259
Sending message: Message 260

Logs from Receiver: 来自接收方的日志:

Received message: SequenceNumber:255 Body:Message 244
Received message: SequenceNumber:256 Body:Message 245
Received message: SequenceNumber:257 Body:Message 246
Received message: SequenceNumber:258 Body:Message 247
Message handler encountered an exception Microsoft.Azure.ServiceBus.UnauthorizedException: Connection rejected after GeoDRFailOver. TrackingId:7bb0b78d-2bf5-4807-8bcb-c831b00c6692, SystemTracker:AmqpGatewayProvider, Timestamp:2019-08-12T17:42:38
   at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<OnReceiveAsync>d__86.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<>c__DisplayClass64_0.<<ReceiveAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.ServiceBus.RetryPolicy.<RunOperation>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Azure.ServiceBus.RetryPolicy.<RunOperation>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<ReceiveAsync>d__64.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<ReceiveAsync>d__62.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.ServiceBus.MessageReceivePump.<MessagePumpTaskAsync>d__11.MoveNext().
Exception context for troubleshooting:
- Endpoint: rjpremium.servicebus.windows.net
- Entity Path: topic1/Subscriptions/sub1
- Executing Action: Receive
Received message: SequenceNumber:1 Body:Message 254
Received message: SequenceNumber:2 Body:Message 255
Received message: SequenceNumber:3 Body:Message 256
Received message: SequenceNumber:4 Body:Message 257
Received message: SequenceNumber:5 Body:Message 258
Received message: SequenceNumber:6 Body:Message 259
Received message: SequenceNumber:7 Body:Message 260

The messages between 247 and 254 are dropped. 247和254之间的消息将被丢弃。 Though the sender sent all those, the receiver never received those messages. 尽管发送方发送了所有这些消息,但是接收方从未收到这些消息。 If I enable Geo-Recovery, ae these messages should also be received by the receiver? 如果启用地理恢复,那么接收者也应该接收这些消息吗?

When using geo-disaster recovery feature of the Azure Service Bus (Premium), you have to pair the primary and the secondary namespaces first. 使用Azure Service Bus(Premium)的地理灾难恢复功能时,必须首先将主要和辅助名称空间配对。 When that's done, you get an alias to be used from that point in time and on. 完成后,您将获得一个别名,从该时间点开始使用。 The alias ensures applications connected to the primary namespace continue to function when failover takes place. 别名可确保发生故障转移时,连接到主要名称空间的应用程序继续运行。 Make sure you use the issued alias in your sender and receiver applications. 确保在发送方和接收方应用程序中使用颁发的别名。 For details, see the documentation . 有关详细信息,请参阅文档

First, quoting from the docs (and as Sean Feldman also points out in parallel) 首先,引用文档 (正如肖恩·费尔德曼(Sean Feldman)也同时指出的那样)

"Geo-Disaster recovery currently only ensures that the metadata (Queues, Topics, Subscriptions, Filters) are copied over from the primary namespace to secondary namespace when paired." “地理灾难恢复当前仅确保配对时将元数据(队列,主题,订阅,过滤器)从主名称空间复制到辅助名称空间。”

That means messages are not (yet) copied. 这意味着尚未(尚未)复制邮件。

Second, GeoDR is for rare scenarios where you have to move out of the region because something there is somehow completely broken. 其次,GeoDR适用于极少数情况,您必须搬出该地区,因为那里的某些东西完全被破坏了。 That means it's very unlikely that your test scenario above reflects any reality. 这意味着上述测试场景不太可能反映任何现实。 You will be confronted with a crisis situation where you have an outage and then make a very deliberate effort to abandon the region and do a failover not only of Service Bus but everything else you have there. 您将面临危机情况,您将发生断电,然后要非常刻意地放弃该地区并进行故障转移,不仅是Service Bus,而且还有那里的所有其他设备。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM