개요

Azure Blob Storage는 Microsoft Azure의 오브젝트 스토리지 서비스. AWS S3에 대응하는 Azure의 비정형 데이터 저장소.


Blob 유형

유형용도
Block Blob일반 파일, 미디어, 백업 (가장 많이 사용)
Append Blob로그 파일 (추가만 가능)
Page BlobVM 디스크 (VHD), 랜덤 읽기/쓰기

액세스 계층

계층특징비용
Hot자주 접근하는 데이터저장 비용 높음, 액세스 비용 낮음
Cool가끔 접근 (30일+ 보관)저장 비용 중간
Cold드물게 접근 (90일+ 보관)저장 비용 낮음
Archive거의 접근 안 함 (180일+ 보관)저장 비용 최저, 읽기 시간 수 시간

blobfuse2 (FUSE 마운트)

Azure Blob Storage를 로컬 파일시스템처럼 마운트하는 도구.

# baseConfig.yaml 예시
allow-other: true
logging:
  level: log_warning
 
components:
  - libfuse
  - file_cache
  - attr_cache
  - azstorage
 
azstorage:
  type: block
  account-name: mystorageaccount
  account-key: <account-key>
  endpoint: https://mystorageaccount.blob.core.windows.net
  container: mycontainer
# 마운트
blobfuse2 mount /mnt/blob --config-file=config.yaml
 
# 마운트 해제
blobfuse2 unmount /mnt/blob

Python SDK

from azure.storage.blob import BlobServiceClient
 
conn_str = "DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;"
client = BlobServiceClient.from_connection_string(conn_str)
 
# 업로드
blob_client = client.get_blob_client(container="mycontainer", blob="file.txt")
with open("local.txt", "rb") as f:
    blob_client.upload_blob(f, overwrite=True)
 
# 다운로드
with open("download.txt", "wb") as f:
    f.write(blob_client.download_blob().readall())

관련 항목