次の方法で共有


Microsoft Azure Storage Emulator 3.1 with RA-GRS

We are pleased to announce the release of the Azure Storage Emulator 3.1, with support for Read Access to Geo Redundant Storage (RA-GRS). The read-only replica of the development storage account can now be accessed by using “devstoreaccount1-secondary” in the URL. For example, the following address might be used for accessing a blob using the read-only replica in the storage emulator:

https://127.0.0.1:10000/devstoreaccount1-secondary/mycontainer/myblob.txt

In the Storage Emulator, all accounts have RA-GRS enabled; there is never any lag between the primary and secondary replicas. The Get Blob Service Stats, Get Queue Service Stats, and Get Table Service Stats APIs are supported on the secondary endpoint and will always return LastSyncTime as the current time according to the underlying SQL database.

Starting with Storage Client Library 3.2, the library supports RA-GRS against the storage emulator using the familiar syntax. For example, the following code calls Get Table Service Stats in the emulator:

 CloudStorageAccount account = CloudStorageAccount.DevelopmentStorageAccount; 
 CloudTableClient client = account.CreateCloudTableClient(); 
  
 // Note that Get Service Stats is supported only on secondary endpoint 
 client.LocationMode = LocationMode.SecondaryOnly; 
 ServiceStats stats = client.GetServiceStats();

Storage Emulator 3.1 is now included in Azure SDK for .NET 2.3. Those who do not currently have SDK 2.3 will get Storage Emulator 3.1 automatically when SDK 2.3 is installed. Those who previously installed SDK 2.3 can upgrade to Storage Emulator 3.1 either by installing SDK 2.3 again or by downloading the standalone installer from the SDK 2.3 download page. Note that Storage Emulator 3.1 is not compatible with SDK versions prior to 2.3.

For more information on Azure Storage Redundancy and RA-GRS, see the blog post on this topic.

Michael Roberson

Comments

  • Anonymous
    May 11, 2014
    Nice. Is it possible to disable the primary endpoint of the emulator? I can imagine a time when it might be useful when testing how code behaves when it is not available.

  • Anonymous
    May 14, 2014
    @Mike: The emulator always accepts requests from both primary and secondary endpoints. You can simulate a down primary endpoint by configuring your primary endpoint to use a bogus port. The following code will do this for the blob endpoint in Storage Client Library 3.2: // Port 12345 is bogus StorageUri blobUriDownPrimary = new StorageUri(    new Uri("127.0.0.1/devstoreaccount1"),    new Uri("127.0.0.1/devstoreaccount1-secondary")); CloudStorageAccount account = new CloudStorageAccount(    CloudStorageAccount.DevelopmentStorageAccount.Credentials,    blobStorageUri: blobUriDownPrimary,    queueStorageUri: null,    tableStorageUri: null);