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集群存储 ...
随机推荐
- SSAS属性中更改AllowedBrowsingFolders的值后才能更改其它文件夹的值
首先 以管理员身份运行 打开SQL Server Management Studio (SSMS). 在Sql Server Analysis Service中的属性中有很多文件夹属性,决定了存放CU ...
- mysql按照天统计报表,当天没有数据,填0
1.问题复现: 按照天数统计每天的总数,如果其中有几天没有数据,那么group by 返回会忽略那几天,如何填充0?如下图,统计的10-3~10-10 7天的数据,其中只有8号和10号有数据,这样返回 ...
- HAUTOJ 1283 YK的书架
题目描述 YK新买了2n+1本相同的书,准备放在家里的3层书架上(每一层放书的数量>=0且<=n).不过YK摆放他的书有些特殊的要求,即任意两层摆放的书的数目之和,严格大于另一层的 ...
- Version 1.7.0_80 of the JVM is not suitable for this product.Version: 1.8 or greater is required.
Eclipse启动失败,设置eclipse启动jdk有2种方法 第一种: 直接安装eclipse对应的jdk版本,并设置环境变量 第二种: 修改eclipse配置文件eclipse.ini 在plug ...
- LNMP下FTP服务器的安装和使用(Pureftpd和Proftpd)
FTP是网站文件维护中使用比较多的,目前LNMP一键安装包中有Pureftpd和Proftpd服务器安装脚本,LNMP默认不安装任何FTP服务器,需要用户自行安装(1.2开始不再提供proftpd的安 ...
- vim 的各种用法,很实用哦,都是本人是在工作中学习和总结的
(一)初级个性化配置你的vim 1.vim是什么? vim是Vi IMproved,是编辑器Vi的一个加强版,一个极其强大并符合IT工程师(程序员.运维)习惯的编辑器.如果你是一名职业的SE,那么一定 ...
- Java泛型范例
class Point<T>{ // 此处可以随便写标识符号,T是type的简称 private T var ; // var的类型由T指定,即:由外部指定 public T getVar ...
- c#套料程序设计
上的套料基本上都没有源码,开放的sdk都没有,这让很多想做套料,但是又成本太高了. 另外,大部分套料都是c++实现的,效率高,本人尝试用c#做一个套料程序,发现效率也不低,当然会比c++差点. 以下是 ...
- extends Thread 与 implements Runnable 的区别
http://blog.csdn.net/zhikun518/article/details/7526298 1.通过实现Runnable接口创建线程 (1).定义一个类实现Runnable接口,重写 ...
- 爬虫_vs_反爬虫
爬虫中有哪些专业术语? 爬虫:自动获取网站数据的程序,关键是批量的获取 反爬虫:使用技术手段防止爬虫程序的方法 误伤:反爬虫技术将普通用户识别为爬虫,效果再好也不能用(禁止ip) 成本:反爬虫需要人力 ...