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集群存储 ... 
随机推荐
- hadoop2.6.0集群搭建
			p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ... 
- [国嵌攻略][136][DM9000网卡驱动深度分析]
			网卡初始化 1.分配描述结构,alloc_etherdev 2.获取平台资源,platform_get_resource 2.1.在s3c_dm9k_resource中有相关的资源 2.2.add地址 ... 
- [国嵌攻略][045-046][一跃进入C大门]
			[一跃进入C大门] 跳转方式 1.相对跳转:b或bl指令,通过计算两个地址之间的差值来给pc赋值相对跳转 2.绝对跳转:ldr指令,通过给pc直接赋值,完成绝对跳转 代码编写 1.在汇编代码中直接使用 ... 
- linux下yum命令出现Loaded plugins: fastestmirror
			yum install的时候提示:Loaded plugins: fastestmirror fastestmirror是yum的一个加速插件,这里是插件提示信息是插件不能用了. 不能用就先别用呗,禁 ... 
- phpmailer的SMTP ERROR: Failed to connect to server: 10
			请问,我在win7上学习使用phpmailer时,出现这种错误怎么处理啊? SMTP ERROR: Failed to connect to server: (0) SMTP connect() fa ... 
- asp.net -mvc框架复习(6)-基于MVC实现简单计算器
			1.创建好文件夹 2.视图层代码编写 <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dyn ... 
- PostgreSQL 的 distinct on 的理解
			摘录自:http://www.cnblogs.com/gaojian/archive/2012/09/05/2671381.html 对于 select distinct on , 可以利用下面的例子 ... 
- Hystrix请求命令 HystrixCommand、HystrixObservableCommand
			Hystrix有两个请求命令 HystrixCommand.HystrixObservableCommand. HystrixCommand用在依赖服务返回单个操作结果的时候.又两种执行方式 -ex ... 
- linux下安装python3
			不建议卸载python2 可能会导致系统内其他软件无法使用 1.下载 wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0a1.tar.x ... 
- scrapy_移除内容中html标签
			如何移除所获取内容中多余的html标签? 通过w3lib模块和re模块 #!/usr/bin/python3 # -*- coding: UTF-8 -*- __author__ = 'beimenc ... 
