Can the replicas be read directly for an Azure Storage Account with LRS (Locally Redundant Storage)?

泄露秘密 提交于 2019-12-13 07:37:25

问题


An Azure Storage Account created with LRS has 3 replicas. Is there a way to read the copies of this data?


回答1:


Simple answer is no. You can't specify from which replica copy of your data you want to read.




回答2:


We can't just tack -secondary on the account name in the connection string. The AccountName={...} field in a standard connection string is used both to infer the resource URL and for signing. When using RA-GRS, you must use the -secondary endpoint to route requests, but still sign the request with the account name (without the -secondary). If you try to do an RA-GRS read (either with the client library or storage explorer), you cannot simply add -secondary in the connection string: this will route requests to the right place, but authentication will fail since they are attempting to sign the request with a "account-secondary" which does not actually exist.

So, instead of

AccountName=account-secondary;AccountKey=XXX;EndpointSuffix=blob.core.windows.net

It should be

AccountName=account;AccountKey=XXX;BlobEndpoint=https://account-secondary.blob.core.windows.net

Hope this solution works for you. Thank you.




回答3:


Just a small extension beyond @gaurav's succinct answer:

You can assume that when you do writes, followed immediately by reads, you will always get the latest data (that is, the replicas inside the region are not eventually-consistent; it's strong consistency).

The only option for reading from a non-primary, is when you configure for read-only geo-replicated storage. Then you may choose to read to (but not write from) storage in the alternate (secondary) region, by using storageaccountname-secondary instead of storageaccountname in the connection string.



来源:https://stackoverflow.com/questions/35655597/can-the-replicas-be-read-directly-for-an-azure-storage-account-with-lrs-locally

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!