3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

blobxferでAzure Blob Storageにファイルを一括転送する

Posted at

blobxferというコマンドラインツールを使用することで、rsyncのような要領でローカルファイルをAzure Blob Storageへ一括転送することができます。

インストール

$ pip install blobxfer

転送

下記のようにアカウント情報と転送元・転送先を指定してblobxferコマンドを実行すると、転送元ディレクトリの内容が一括転送されます。

$ blobxfer upload \
  --storage-account ${ACCOUNT} \
  --storage-account-key ${ACCOUNT_KEY} \
  --local-path ${DEST} \
  --remote-path ${DEST}

また、--deleteオプションを指定すると、rsync --deleteした場合と同様に転送元に存在しないファイルを転送先から削除することができます。

実行例

下記はローカルのsrcディレクトリの内容をAzure Blob Storageのdestコンテナへ転送する実行例です。

$ blobxfer upload --storage-account mytestaccount --storage-account-key $KEY --local-path src --remote-path dest --delete
2018-01-07 14:23:12.651 INFO -
============================================
         Azure blobxfer parameters
============================================
         blobxfer version: 1.0.0
                 platform: Darwin-17.3.0-x86_64-i386-64bit
               components: CPython=3.6.3 azstor.blob=0.37.1 azstor.file=0.36.0 crypt=2.1.4 req=2.18.4
       transfer direction: local -> Azure
                  workers: disk=8 xfer=16 md5=0 crypto=0
                 log file: None
              resume file: None
                  timeout: connect=3.1 read=12.1
                     mode: StorageModes.Auto
                  skip on: fs_match=False lmt_ge=False md5=False
        delete extraneous: True
                overwrite: True
                recursive: True
            rename single: False
         chunk size bytes: 0
           one shot bytes: 0
         strip components: 0
         store properties: attr=False md5=False
           rsa public key: None
       local source paths: src
============================================
2018-01-07 14:23:12.652 INFO - blobxfer start time: 2018-01-07 14:23:12.652387+09:00
2018-01-07 14:23:12.653 DEBUG - spawning 8 disk threads
2018-01-07 14:23:12.679 DEBUG - spawning 16 transfer threads
2018-01-07 14:23:14.389 DEBUG - 0 files 0.0000 MiB filesize and/or lmt_ge skipped
2018-01-07 14:23:14.389 DEBUG - 57 local/remote files processed, waiting for upload completion of approx. 0.2920 MiB
2018-01-07 14:23:14.406 DEBUG - attempting to delete extraneous blobs/files from: mytestaccount;core.windows.net;dest
2018-01-07 14:23:14.475 INFO - deleted 1 extraneous blobs/files
2018-01-07 14:23:14.475 INFO - elapsed upload + verify time and throughput of 0.0003 GiB: 1.474 sec, 1.5849 Mbps (0.198 MiB/s)
2018-01-07 14:23:14.475 INFO - blobxfer end time: 2018-01-07 14:23:14.475699+09:00 (elapsed: 1.823 sec)
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?