《Windows Azure Platform 系列文章目录

  

  在笔者之前的文章中,我们介绍了Azure Blob 有两种:Block Blob和Page Blob。

  在这里笔者介绍Blob的第三种:Append Blob。

  概念:

  1.Append Blob概念类似于Block Blob,因为都是由块组成的

  2.单个Block Blob可以包含最多50000个块,每个块最大100MB,总大小大约4.75TB (100MB * 50000)。

  3.Append Blob针对追加操作进行了优化,特别适合与日志记录方案

  4.Append Blob可以包含最多50000个块,每个块最大4MB。总大小约为195GB

  5.Append Blob不支持修改和删除,每个对Append Blob的操作,都会追加到Append Blob的末尾。

  我们这里写一个.NET的Sample Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.WindowsAzure.Storage;
using System.Configuration;
using Microsoft.WindowsAzure.Storage.Blob;
using System.IO; namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["AzureStorageConnectionString"]);
CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient(); //Container Name必须为小写
CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference("appendblobcontainer");
cloudBlobContainer.CreateIfNotExists(); CloudAppendBlob cloudAppendBlob = cloudBlobContainer.GetAppendBlobReference("helloworld.txt"); //如果不存在,则创建该文件
if(!cloudAppendBlob.Exists())
{
cloudAppendBlob.CreateOrReplace();
} var tasks = new Task[];
for (int i = ; i < ; i++)
{
var message = string.Format("Appending log number {0} to an append blob.\r\n", i); var bytes = Encoding.UTF8.GetBytes(message); var stream = new MemoryStream(bytes); tasks[i] = cloudAppendBlob.AppendBlockAsync(stream);
} Task.WaitAll(tasks); string appendBlobContent = cloudAppendBlob.DownloadText();
}
}
}

  如果我们执行代码两次,然后通过Azure Storage Explorer查看这个TXT文件,就可以看到文件被追加到Azure Append Blob里面了。

Windows Azure Storage (25) Azure Append Blob的更多相关文章

  1. Windows Azure Storage (17) Azure Storage读取访问地域冗余(Read Access – Geo Redundant Storage, RA-GRS)

    <Windows Azure Platform 系列文章目录> 细心的用户会发现,微软在国外和国内的数据中心建设都是成对的,比如香港数据中心(Asia East)和新加坡的数据中心(Sou ...

  2. Windows Azure Storage (22) Azure Storage如何支持多级目录

    <Windows Azure Platform 系列文章目录> 熟悉Azure平台的读者都知道,Azure Blob有三层架构.如下图:(注意blob.core.chinacloudapi ...

  3. Azure Storage用法:使用Blob Storage

    Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table. 笔者在C# 消息队列-Microsoft Azure ...

  4. 【Azure Developer】使用 Python SDK连接Azure Storage Account, 计算Blob大小代码示例

    问题描述 在微软云环境中,使用python SDK连接存储账号(Storage Account)需要计算Blob大小?虽然Azure提供了一个专用工具Azure Storage Explorer可以统 ...

  5. Azure Storage 系列(六)使用Azure Queue Storage

    一,引言 在之前介绍到 Azure Storage 第一篇文章中就有介绍到 Azure Storage 是 Azure 上提供的一项存储服务,Azure 存储包括 对象.文件.磁盘.队列和表存储.这里 ...

  6. 技术博客:Azure Functions + Azure Storage 开发

    Azure GitHub wiki 同步发布 传送门 Azure Functions 通过 Functions(一个事件驱动型无服务器计算平台,还可以解决复杂的业务流程问题)更加高效地进行开发.在本地 ...

  7. Microsoft Azure Storage Exployer使用指南

    概述 Microsoft Azure Storage Exployer 是微软官方推荐的一款管理Azure Storage 客户端工具,客户使用完全免费.支持Windows.Mac和Linux.用户使 ...

  8. Azure Storage架构介绍

    Windows Azure Storage由三个重要部分或者说三种存储数据服务组成,它们是:Windows Azure Blob.Windows Azure Table和Windows Azure Q ...

  9. ES(3): ES Cluster Extended Azure Storage

    Azure VM的磁盘空间远远不能满足ES集群存储需求(还需除掉VM的临时盘),同时也未找着ES配置 block blob storage 存储的组件,因此下文介绍通过挂载附加盘的方式增加ES集群存储 ...

随机推荐

  1. Android studio启动后卡在refreshing gradle project(包解决)

    这个问题几乎每个刚使用Android studio的同学都会碰到过,网上有各式各样的方法,有的说使用本地gradle,我试过多次,每次启动android studio时还是会检查更新,所以根本上解决的 ...

  2. JS——判断一个对象是否为空

    判断一个对象是否为空对象,本文给出三种判断方法: 1.最常见的思路,for...in...遍历属性,为真则为"非空数组":否则为"空数组" 2.通过JSON自带 ...

  3. oracle创建触发器及作用举例

    --创建触发器及作用举例 create or replace trigger tri before delete on emp --在删除emp表数据之前需要做的事根据自己的业务去写,before是在 ...

  4. 基础二 day4 日记

    1.list增删改查 l1 = [1,'alex',True,[1,2,3],(2,3,4),{'name':'alex'}]l1 = ['alex',True,'wusir','ritian','t ...

  5. tp系统常量定义

    (2013-03-06 14:16:31) 转载▼ 标签: it 是已经封装好的系统常量 主要是用在控制器下面的动作当中 这样能很大的提高我们的开发效率 主要有下面的一些      手册上面都有的   ...

  6. nginx.conf文件

    user  www www; worker_processes auto; error_log  /home/wwwlogs/nginx_error.log  crit; pid        /us ...

  7. Spring学习之路二——概念上理解Spring

    一.概念. Spring是一个开源框架,Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson 在其著作Expert One-On-One J2EE Develop ...

  8. Android一个包含表格的图标库

    之前有写过一个图表lib,但是开发的速度,大多很难跟上产品需求变化的脚步,所以修改了下原先的图表库,支持图表下面能整合table显示对应的类目,用曲线替换了折线,支持多曲线的显示,增加了显示的动画,, ...

  9. 2018/1/28 每日一学 单源最短路的SPFA算法以及其他三大最短路算法比较总结

    刚刚AC的pj普及组第四题就是一种单源最短路. 我们知道当一个图存在负权边时像Dijkstra等算法便无法实现: 而Bellman-Ford算法的复杂度又过高O(V*E),SPFA算法便派上用场了. ...

  10. 使用SoapUI调用Vsphere Web Service

    项目中经常需要调用Webservice进行验证测试,下面就介绍下如何使用测试工具SoapUI调用Vsphere vcenter的 Web Service VSphere的Webservice地址默认为 ...