本文討論使用 Blob 記憶體作為檢查點存放區的問題。
使用 Blob 儲存體作為檢查點存放區的問題
當您使用 Blob 儲存帳戶作為檢查點存放區時,可能會遇到一些問題,例如處理延遲或在使用 SDK 時建立檢查點失敗等。
當您使用 Azure Blob 記憶體作為檢查點存放區時,請遵循這些建議:
- 針對每個取用者群組使用不同的容器。 您可以使用相同的儲存體帳戶,但每個群組各使用一個容器。
- 請勿將記憶體帳戶用於任何其他專案。
- 請勿將容器用於任何其他專案。
- 在與已部署應用程式相同的區域中建立記憶體帳戶。 如果應用程式是內部部署,請嘗試選擇最接近的區域。
在 Azure 入口網站的 [儲存體帳戶] 頁面上,於 [Blob 服務] 區段中,確定已停用下列設定。
- 階層式命名空間
- Blob 虛刪除
- 版本控制
使用 Blob 儲存體作為 Azure Stack Hub 上的檢查點存放區
如果您使用 Azure Blob 記憶體作為支援不同記憶體 Blob SDK 版本的環境中的檢查點存放區,則您必須使用程式代碼,將記憶體服務 API 版本變更為該環境所支援的特定版本。 例如,如果您在 Azure Stack Hub 2002 版上執行事件中樞,記憶體服務的最高可用版本是 2017-11-09 版。 在此情況下,您必須使用程式代碼將記憶體服務 API 版本設為 2017-11-09。 如需如何以特定記憶體 API 版本為目標的範例,請參閱 GitHub 上的這些範例:
- 。網
- Java。
- JavaScript 或 TypeScript
- Python - 同步、非同步
如果您執行使用 Blob 記憶體作為檢查點存放區的事件中樞接收者,而不以 Azure Stack Hub 支援的版本為目標,您會收到下列錯誤訊息:
The value for one of the HTTP headers is not in the correct format
Python 中的範例錯誤訊息
對於 Python,azure.core.exceptions.HttpResponseError
錯誤會傳遞到 on_error(partition_context, error)
的錯誤處理程式 EventHubConsumerClient.receive()
。 但是,方法 receive()
不會引發例外狀況。
print(error)
會列印下列例外狀況資訊:
The value for one of the HTTP headers is not in the correct format.
RequestId:f048aee8-a90c-08ba-4ce1-e69dba759297
Time:2020-03-17T22:04:13.3559296Z
ErrorCode:InvalidHeaderValue
Error:None
HeaderName:x-ms-version
HeaderValue:2019-07-07
記錄器會記錄兩個警告,例如下列警告:
WARNING:azure.eventhub.extensions.checkpointstoreblobaio._blobstoragecsaio:
An exception occurred during list_ownership for namespace '<namespace-name>.eventhub.<region>.azurestack.corp.microsoft.com' eventhub 'python-eh-test' consumer group '$Default'.
Exception is HttpResponseError('The value for one of the HTTP headers is not in the correct format.\nRequestId:f048aee8-a90c-08ba-4ce1-e69dba759297\nTime:2020-03-17T22:04:13.3559296Z\nErrorCode:InvalidHeaderValue\nError:None\nHeaderName:x-ms-version\nHeaderValue:2019-07-07')
WARNING:azure.eventhub.aio._eventprocessor.event_processor:EventProcessor instance '26d84102-45b2-48a9-b7f4-da8916f68214' of eventhub 'python-eh-test' consumer group '$Default'. An error occurred while load-balancing and claiming ownership.
The exception is HttpResponseError('The value for one of the HTTP headers is not in the correct format.\nRequestId:f048aee8-a90c-08ba-4ce1-e69dba759297\nTime:2020-03-17T22:04:13.3559296Z\nErrorCode:InvalidHeaderValue\nError:None\nHeaderName:x-ms-version\nHeaderValue:2019-07-07'). Retrying after 71.45254944090853 seconds
後續步驟
請參閱下列文章以了解分區和檢查點:平衡應用程式多個實例之間的分區負載