Windows Azure Storage (25) Azure Append Blob
《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的更多相关文章
- Windows Azure Storage (17) Azure Storage读取访问地域冗余(Read Access – Geo Redundant Storage, RA-GRS)
<Windows Azure Platform 系列文章目录> 细心的用户会发现,微软在国外和国内的数据中心建设都是成对的,比如香港数据中心(Asia East)和新加坡的数据中心(Sou ...
- Windows Azure Storage (22) Azure Storage如何支持多级目录
<Windows Azure Platform 系列文章目录> 熟悉Azure平台的读者都知道,Azure Blob有三层架构.如下图:(注意blob.core.chinacloudapi ...
- Azure Storage用法:使用Blob Storage
Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table. 笔者在C# 消息队列-Microsoft Azure ...
- 【Azure Developer】使用 Python SDK连接Azure Storage Account, 计算Blob大小代码示例
问题描述 在微软云环境中,使用python SDK连接存储账号(Storage Account)需要计算Blob大小?虽然Azure提供了一个专用工具Azure Storage Explorer可以统 ...
- Azure Storage 系列(六)使用Azure Queue Storage
一,引言 在之前介绍到 Azure Storage 第一篇文章中就有介绍到 Azure Storage 是 Azure 上提供的一项存储服务,Azure 存储包括 对象.文件.磁盘.队列和表存储.这里 ...
- 技术博客:Azure Functions + Azure Storage 开发
Azure GitHub wiki 同步发布 传送门 Azure Functions 通过 Functions(一个事件驱动型无服务器计算平台,还可以解决复杂的业务流程问题)更加高效地进行开发.在本地 ...
- Microsoft Azure Storage Exployer使用指南
概述 Microsoft Azure Storage Exployer 是微软官方推荐的一款管理Azure Storage 客户端工具,客户使用完全免费.支持Windows.Mac和Linux.用户使 ...
- Azure Storage架构介绍
Windows Azure Storage由三个重要部分或者说三种存储数据服务组成,它们是:Windows Azure Blob.Windows Azure Table和Windows Azure Q ...
- ES(3): ES Cluster Extended Azure Storage
Azure VM的磁盘空间远远不能满足ES集群存储需求(还需除掉VM的临时盘),同时也未找着ES配置 block blob storage 存储的组件,因此下文介绍通过挂载附加盘的方式增加ES集群存储 ...
随机推荐
- ASP.NET没有魔法——ASP.NET MVC路由
之前的文章中介绍了My Blog文章维护功能的开发,开发过程中使用Area的方法建立了用于维护文章的Controller.View和Model.但是无论代码怎么变对于浏览器来说都是通过一个url地址去 ...
- 如何为图片添加热点链接?(map + area)
所谓图片热点链接就是为图片指定一个或多个区域以实现点击跳转到指定的页面.简单来说就是点击某一区域就能跳转到相应的页面,而无需点击整个图片才能跳转. 说到图片热点链接,我首先想到了map + area, ...
- 久未更 ~ 四之 —— Vsftpd出现 Failed to start Vsftpd ftp daemon错误
> > > > > 久未更 系列一:Failed to start Vsftpd ftp daemon错误 配置 vsftpd.conf文件后 重启ftp服务 出现 Fa ...
- Java客户端API
添加依赖 <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookee ...
- // 关闭调试模式 define('APP_DEBUG', false);
调试模式的优势在于: 开启日志记录,任何错误信息和调试信息都会详细记录,便于调试: 关闭模板缓存,模板修改可以即时生效: 记录SQL日志,方便分析SQL: 关闭字段缓存,数据表字段修改不受缓存影响: ...
- 将js进行到底:node学习笔记2
node重要API之FS--CLI编程初体验 所谓的"fs"就是file system! 当下几乎任何一门编程语言都会提供对文件系统读写的API,比如c语言的open()函数. 而 ...
- 基于TI CC2650的IPv6 over BLE(BLEach) demo
虽然BLE 5.0协议理论上已经开始支持IPv6了,但是目前市面上还没有可用的实现IPv6通信的BLE产品. 最近在网上看到一个开源的基于contiki系统,在CC2650上实现的IPv6 over ...
- Android一个包含表格的图标库
之前有写过一个图表lib,但是开发的速度,大多很难跟上产品需求变化的脚步,所以修改了下原先的图表库,支持图表下面能整合table显示对应的类目,用曲线替换了折线,支持多曲线的显示,增加了显示的动画,, ...
- JXLS使用方法(文件上传读取)xlsx文件读取
1.官方文档:http://jxls.sourceforge.net/reference/reader.html 2.demo git地址:https://bitbucket.org/leonate/ ...
- 【fail2ban】使用fail2ban进行攻击防范
使用fail2ban进行攻击防范 转自:https://kyle.ai/blog/6215.html 最近总有一些无聊的人,会来扫描一下我的服务器,看有没有啥漏洞可以利用的... 可以看到类似这样的4 ...