博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
azure blob_Azure Blob存储–将数据库文件放置在云中
阅读量:2510 次
发布时间:2019-05-11

本文共 8456 字,大约阅读时间需要 28 分钟。

azure blob

Do you know that since SQL Server 2012 you can have your entire database stored in Azure, even if you have your server on-premises? This article will introduce you to this capability, showing the basic steps to allow your instance to be in contact with your Azure Blob Storage Account.

您是否知道从SQL Server 2012开始,即使您的服务器是本地服务器,也可以将整个数据库存储在Azure中? 本文将向您介绍此功能,并显示允许您的实例与Azure Blob存储帐户联系的基本步骤。

We already started a series of articles exploring all the possibilities in order to have a Hybrid scenario, mixing SQL Server and Azure. In the previous article, we talked about the possibility of perform backup to the cloud, directly or using the Managed Backups feature, which automates the FULL and transaction log operations, based on rules.

我们已经开始了一系列文章,探讨了所有可能性,以实现混合方案,将SQL Server和Azure混合在一起。 在上一篇文章中,我们讨论了直接执行备份到云或使用托管备份功能(基于规则自动执行FULL和事务日志操作)的备份的可能性。

In order to backup database files to Azure, we need to have an active Azure Blob Storage account. In this article we are going to take advantage of the same feature, but with another objective: store database files in Azure.

为了将数据库文件备份到Azure,我们需要有一个活动的Azure Blob存储帐户。 在本文中,我们将利用相同的功能,但还有另一个目标:将数据库文件存储在Azure中。

Yes, you can have you server, in your datacenter, under your control, within the reach of your hands, but the database files are in Azure…

是的,您可以在自己的控制范围内,在数据中心内控制服务器,但数据库文件在Azure中…

有人问“我为什么要这样做?”的那一刻。 ( That moment when someone asks “why I would do this?” )

Well, there are few reasons… To start, don’t think in this feature like “I will put mdf, ndf and ldf files in Azure Blob Storage, and that’s it”. No. The main idea is not that… Of course you can do this, but this is a feature that opens a new horizon.

嗯,有几个原因……首先,不要想像“我将mdf,ndf和ldf文件放入Azure Blob存储中,就是这样”之类的功能。 否。主要思想不是……当然可以做到这一点,但这是一个打开新视野的功能。

Having your files in Azure you will inherit all the advantages of store files in the cloud:

将文件放在Azure中,您将继承云中存储文件的所有优点:

  • Durable & highly available – Azure Blob storage automatically replicates your data, maintaining 3 copies within a single region.耐用且高度可用 – Azure Blob存储自动复制您的数据,在一个区域内维护3个副本。
  • Geo-redundancy – This option creates 3 additional in another Azure site for higher availability and disaster recovery, complementing the previous data replication.地理冗余 –此选项在另一个Azure站点中另外创建3个,以提供更高的可用性和灾难恢复,以补充先前的数据复制。
  • Unlimited” space – Well, there’s a limit, of 500 TB per Azure Blob Account. You can have up to 50 accounts per azure subscription.无限”空间 –嗯,每个Azure Blob帐户有500 TB的限制。 每个Azure订阅最多可以有50个帐户。
  • You pay for what you use – Check the price per GB 您为使用的内容付费 -在.检查每GB的价格。

We are going to see all the possibilities, but let’s start from the very basic…

我们将看到所有可能性,但让我们从最基本的内容开始……

You can place your entire database in the Azure Blob Storage, but is this for you? It depends. Remember that you will be adding a new failure point in the system, probably your internet connection. And here is another problem, is the performance acceptable? How critical is your database?

您可以将整个数据库放在Azure Blob存储中 ,但是这适合您吗? 这取决于。 请记住,您将在系统中添加一个新的故障点,可能是您的Internet连接。 这是另一个问题,性能可以接受吗? 您的数据库有多重要?

You see, this is not for everyone. I cannot define a rule, but smaller and not highly accessed databases are the better candidates for this. The best is always test!

您知道,这并不适合所有人。 我无法定义规则,但是较小的数据库和访问量不高的数据库是更好的选择。 最好的永远是测试!

But as said before, don’t look to this feature like this… This is flexible! There are other two interesting options that we can take advantage:

但是,如前所述,不要像这样使用此功能…这很灵活! 我们可以利用其他两个有趣的选项:

  • Use this solution in a hybrid database as archival solution.
  • 混合数据库中将此解决方案用作存档解决方案
  • low-cost disaster recovery solution.低成本的灾难恢复解决方案

We will approach those items in this article.

我们将在本文中介绍这些项目。

我从哪个版本开始具有此功能? ( From which version I have this capability? )

You can store both data and log files in Azure since SQL Server 2012 Cumulative Update 2.

自SQL Server 2012累积更新2起,您可以在Azure中存储数据和日志文件。

有哪些先决条件? ( What are the prerequisites? )

Here are the steps to follow, in order to be able to store files in Azure:

为了能够在Azure中存储文件,请按照以下步骤操作:

  1. Have an Azure Blob Storage Account

    Using your Azure subscription, click on the “+ New” button, in the left-bottom of the Azure Portal, and follow the options: “Data Service”➜”Storage”➜”Quick Create”. Fill all the information and click on “Create Storage Account”:

    有一个Azure Blob存储帐户

    使用Azure订阅,单击Azure门户左下角的“ +新建”按钮,然后按照以下选项进行操作:“数据服务”➜“存储”➜“快速创建”。 填写所有信息,然后单击“创建存储帐户”:

    After a successful creation, you will be able to find your account in the “Storage” menu:

    创建成功后,您将可以在“存储”菜单中找到您的帐户:

  2. Create a credential.

    This step looks easy, but it isn’t… First of all, the Credential Name should be exactly the same as the Container URL, to make story shorter, after a research, I found a method using PowerShell, explained at this blog:

    The method is basic:

    创建一个凭证。

    此步骤看起来很简单,但并非如此……首先,凭据名称应与容器URL完全相同,为了使内容更短,经过研究,我找到了使用PowerShell的方法,对此博客进行了解释:

    该方法是基本的:
    • Download the PowerShell script (see the previous link).

      下载PowerShell脚本(请参阅上一个链接)。
    • Download you Publishing Profile from the following URL:
    • 从以下URL下载发布配置文件: :
    • Execute the following command, as Administrator, from the PowerShell Console:

      从PowerShell控制台以管理员身份执行以下命令:

      .\SASPolicyTokens.ps1 -PublishSettingsFile “C:\pprofile\publishing_profile.publishsettings” -SubscriptionName “Visual Studio Professional with MSDN” -StorageAccountName “TestAcct” -ContainerName “dbfiles” -NumContainers 1 -StoredAccessPolicy “SQLPolicy” -StartTime “3/1/2015” -ExpiryTime “3/1/2016” -LogFilePath “C:\pprofile\creds.txt”

      。\ SASPolicyTokens.ps1 -PublishSettingsFile“ C:\ pprofile \ publishing_profile.publishsettings” -SubscriptionName“带有MSDN的Visual Studio Professional” -StorageAccountName“ TestAcct” -ContainerName“ dbfiles” -NumContainers 1 -StoredAccessPolicy“ SQLPolicy” -StartTime“ 3/1” / 2015” -ExpiryTime“ 2016/3/1” -LogFilePath“ C:\ pprofile \ creds.txt”

    • The command will generate a txt file, with the commands to be executed on SQL Server. The command is going to create the required credentials.

      该命令将生成一个txt文件,其中包含要在SQL Server上执行的命令。 该命令将创建所需的凭据。
  3. Now that you are done with the credentials challenge, you can create/attach the database pointing to that container.

    既然完成了凭据挑战,您就可以创建/附加指向该容器的数据库。

    Here is a sample code to create a Hybrid database:

    以下是创建混合数据库的示例代码:

     CREATE DATABASE [HybridDatabase] ON  PRIMARY ( NAME = N'HybridDatabase', FILENAME = N'https://YourAccount.blob.core.windows.net/YourContainer/HybridDatabase.mdf' ) LOG ON ( NAME = N'HybridDatabase_log', FILENAME = N'https:// YourAccount.blob.core.windows.net/ YourContainer /HybridDatabase_log.ldf')GO 

    If your credentials are well created, this command will run with success… Make sure that your firewall is not blocking the connection!!

    如果您的凭据创建正确,则此命令将成功运行…确保您的防火墙没有阻止连接!

    Now you know the basics! You are already able to store an entire database using the Azure Blob Storage. In the next part of this article I will explain the already referred scenarios:

    现在您已经了解了基础知识! 您已经能够使用Azure Blob存储存储整个数据库。 在本文的下一部分中,我将解释已经提到的方案:

    • Hybrid database as archival solution

      混合数据库作为归档解决方案
    • Low-cost disaster recovery solution

      低成本灾难恢复解决方案

    Keep in touch, because, in the second part, is where you will find the real reason to use this capability 🙂

    保持联系,因为在第二部分中,您将找到使用此功能的真正原因🙂

    工具类 ( Tools )

    Before finish this first part, I’d like to introduce two free tools that will make your life easier… If you already used the Azure Blob Storage before, you know that manage a big amount of files is not easy, using the Azure Portal… After a research, I found a free tool called “Azure Storage Explorer”. This tool is Windows based, light and has all that we need to manage our files…awesome! You can download the tool in the following URL:

    在完成第一部分之前,我想介绍两个免费的工具,这些工具可以使您的生活更轻松……如果您以前已经使用过Azure Blob存储,则知道使用Azure门户管理大量文件并不容易……经过研究,我找到了一个名为“ Azure Storage Explorer”的免费工具。 这个工具是基于Windows的轻量级工具,具有我们管理文件所需的一切……太棒了! 您可以通过以下网址下载该工具:

    But you may say: “My friend, this is a production server, I won’t install that thing there!”. Well, ok… Good news for you! There is a web-based version of this tool “Azure Web Storage Explorer”. Just connect to the following link, authenticate and enjoy!

    但是您可能会说:“我的朋友,这是生产服务器,我不会在那儿安装那东西!”。 好吧,好吧……对您来说是个好消息! 该工具有一个基于Web的版本“ Azure Web Storage Explorer”。 只需连接到以下链接,进行认证即可享受!

    That’s it for now. I hope that this first part has been clear. I invite you to read the second part in order to see all the options that this capability brought to contribute in a hybrid database solution deployment.

    现在就这样。 我希望第一部分已经明确。 我邀请您阅读第二部分,以查看此功能为混合数据库解决方案部署做出贡献的所有选项。

翻译自:

azure blob

转载地址:http://xfiwd.baihongyu.com/

你可能感兴趣的文章
使用Masstransit开发基于消息传递的分布式应用
查看>>
[CF808A] Lucky Year(规律)
查看>>
关于推送遇到的一些问题
查看>>
寒假作业3 抓老鼠啊~亏了还是赚了?
查看>>
Orcal Job创建实例
查看>>
Django
查看>>
批量Excel数据导入Oracle数据库(引用 自 wuhuacong(伍华聪)的专栏)
查看>>
处理移动障碍
查看>>
优化VR体验的7个建议
查看>>
2015年创业中遇到的技术问题:21-30
查看>>
《社交红利》读书总结--如何从微信微博QQ空间等社交网络带走海量用户、流量与收入...
查看>>
JDK工具(一)–Java编译器javac
查看>>
深入.NET框架与面向对象的回顾
查看>>
merge http://www.cplusplus.com/reference/algorithm/merge/
查看>>
Python-DB接口规范
查看>>
改变label中的某字体颜色
查看>>
[转]SQL SERVER 的排序规则
查看>>
SQLServer锁原理和锁的类型
查看>>
Eclipse中SVN的安装步骤(两种)和使用方法[转载]
查看>>
C语言函数的可变参数列表
查看>>