Giter Site home page Giter Site logo

azure-sdk-for-js-storage-blob-redundant's Introduction

page_type languages products description urlFragment
sample
javascript
nodejs
azure
azure-storage
How to use the Azure Storage JavaScript SDK with read-access geo-redundant.
redundant-storage-javascript

How to utilize redundant Azure Blob Storage with JavaScript

SDK Versions

In this sample, you will find the following folders:

  • v10 - references Storage Blob SDK v10
  • v12 - references Storage Blob SDK v12

Prerequisites

If you don't have a Microsoft Azure subscription, you can get a free account before you begin.

Following prerequisites are needed to run this sample and verify that files are downloaded from primary storage:

  1. Add your storage account credentials to the .env.example file and then rename it to .env.

    AZURE_STORAGE_ACCOUNT_NAME=<ReplaceWithYourStorageAccountName>
    AZURE_STORAGE_ACCOUNT_ACCESS_KEY=<ReplaceWithYourStorageAccountAccessKey>
    

    You can find this information in the Azure portal by navigating to your storage account and selecting Access keys in the Settings section.

  2. Install the required dependencies in the console window by running npm install.

Steps to test secondary storage access:

  1. Open a command prompt with administrator privileges.

  2. Get the IP address of your storage account primary endpoint domain by entering the following command, replacing STORAGEACCOUNTNAME with the name of your storage account.

    nslookup STORAGEACCOUNTNAME.blob.core.windows.net
    
  3. Get the IP address of your local host by entering ifconfig on Linux or ipconfig on Windows.

  4. Add an invalid static route for a destination host. Replace <DestinationIp> with your storage account IP address, and <GatewayIp> with your local host IP address.

    Linux

    route add <DestinationIp> gw <GatewayIp>

    Windows

    route add <DestinationIp> <GatewayIp>

This Sample shows how to do following operations of Storage Blobs

  • Create a storage account.
  • Create a container.
  • Upload a file to blockblob.
  • Enter D to download the file or Q to quit.

How it works

This sample creates a new container in blob storage and uploads a sample file into it called HelloWorld.jpg. It then checks secondary storage repeatedly until both the container and file have been replicated. The user can then enter D to download the file or Q to quit. If the file is successfully downloaded, the sample indicates whether it came from primary or secondary storage. When the user quits the sample, it deletes the container and file.

How to run the sample

To run this sample and verify that files are downloaded from primary storage, we are going to:

  1. Launch the sample from the console window by running node index.js.

  2. Wait until the sample reports that the container and file have replicated to secondary storage.

  3. When prompted, press D to download the sample file and verify that it comes from primary storage.

To test secondary storage access, we are going to:

  1. In the console window with the running sample, press D to download the sample file and verify that it comes from secondary storage.

  2. Remove the invalid static route.

    Linux

    route del <DestinationIp> gw <GatewayIp>

    Windows

    route delete <DestinationIp>
  3. In the console window with the running sample, press D to download the sample file and verify that it comes from primary storage.

  4. Press Q to quit the sample and delete the container and file from storage.

More information

azure-sdk-for-js-storage-blob-redundant's People

Contributors

dependabot[bot] avatar jongio avatar karlerickson avatar microsoftopensource avatar msftgits avatar rloutlaw avatar supernova-eng avatar tzhanl avatar zzhxiaofeng avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-sdk-for-js-storage-blob-redundant's Issues

[Action Needed] This repo is inactive

This GitHub repository has been identified as a candidate for archival

This repository has had no activity for more than 2 years. Long periods of inactivity present security and code hygiene risks. Archiving will not prevent users from viewing or forking the code. A banner will appear on the repository alerting users that the repository is archived.

Please see https://aka.ms/sunsetting-faq to learn more about this process.

Action

✍️

❗**If this repository is still actively maintained, please simply close this issue. Closing an issue on a repository is considered activity and the repository will not be archived.🔒

If you take no action, this repository is still inactive 30 days from today it will be automatically archived..

Need more help? 🖐️

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.