本文共 7951 字,大约阅读时间需要 26 分钟。
横向扩展 纵向扩展 数据库
Let’s continue the hybrid saga! After two articles talking about the Azure Blob Storage and what we can do using it, it’s time to check an alternative solution, that does the same of what was presented in the last article (a Hybrid Database used as archival solution for who didn’t read). This time we are not using the Azure Blob Storage, but we are still using Azure!
让我们继续混合传奇! 在讨论了有关Azure Blob存储以及我们可以使用它的方法的两篇文章之后,是时候检查另一种解决方案了,该解决方案与上一篇文章中介绍的功能相同(将混合数据库用作没有解决方案的归档解决方案)读)。 这次我们不使用Azure Blob存储,但是我们仍在使用Azure!
The feature is…Stretch Database
功能是… 拉伸数据库
Yes, this is a new feature! So new that is only available in the CTP version of SQL Server 2016. However this is available for download, for free of course, and you can start testing its implementation.
是的,这是一项新功能! 如此新,仅在SQL Server 2016的CTP版本中可用。但是,此内容可免费下载,当然,您可以开始测试其实现。
Basically the same as we presented in the other article, but with more advantages and an easy way to implement…
与我们在另一篇文章中介绍的基本相同,但是具有更多的优点和易于实现的方法……
In the of this series, we identified a challenge: keep historical data in the database, transparently to the users and applications, without compromise te performance and increase costs.
在本系列的中,我们确定了一个挑战 :将历史数据保留在数据库中,对用户和应用程序透明,而又不影响性能和增加成本。
The solution found was:
Implement table partitioning, pointing the partition with the old data to a file in Azure Blob Storage service.找到的解决方案是:
实现表分区,将带有旧数据的分区指向Azure Blob存储服务中的文件。Advantages:
Transparent, improves the performance in the access to current data and eliminates the physical disk used to store the old data.优点:
透明,可提高访问当前数据的性能,并消除用于存储旧数据的物理磁盘。Well, that solution works, but there are other points make us thing:
好的,该解决方案有效,但还有其他几点使我们变得如此:
Those problems are solved if you start using the Stretch Database! Why? I will explain…
如果您开始使用Stretch Database,这些问题将得到解决! 为什么? 我会解释…
The “Stretch Database” is a feature/service based on “Azure SQL Database”, so, no Azure Blob Storage here… When you enable this capability in the database a SQL Database will be created under you Azure subscription.
“ Stretch数据库”是基于“ Azure SQL数据库”的一项功能/服务,因此此处没有Azure Blob存储…在数据库中启用此功能后,将在Azure订阅下创建一个SQL数据库。
The first step to start using this, in fact, is enable the feature (of course!), as shown in the next image, right-click in the database, select “Tasks” and “Enable Database for Stretch”:
实际上,开始使用此功能的第一步是启用该功能(当然!),如下图所示,右键单击数据库,选择“任务”,然后选择“启用数据库进行拉伸”:
A Wizard will be opened, where you will need to authenticate to you Azure subscription and define the settings of this feature.
将打开一个向导,您需要在其中向Azure订阅进行身份验证并定义此功能的设置。
There are two possible models:
有两种可能的模型:
The second option, is closer of what we talked in the previous article, anyway, you can do the same of “Archive Table” option using Azure Blob Storage… And it is easier than implement the table partitioning.
第二个选项与我们在上一篇文章中讨论的内容更加接近,无论如何,您可以使用Azure Blob存储执行“存档表”选项的操作……而且比实现表分区更容易。
Still talking about the “Archive Rows” option, this is still not available in the current CTP, as it is still under development, but the main idea is select the eligible rows to be moved to Azure, based in some define conditions (like a where clause).
仍在谈论“存档行”选项,该选项在当前CTP中仍不可用,因为它仍在开发中,但是主要思想是根据某些定义条件(例如where子句)。
All the rows will be moved silently using a retry option, to assure that there’s no data loss. This is true for both options… Oh, this feature is also transparent for the applications and users using the database, which is awesome!
所有行将使用重试选项以静默方式移动,以确保不会丢失数据。 这对两个选项都是正确的……哦,对于使用数据库的应用程序和用户来说,此功能也是透明的,太棒了!
By using this, you may have something like the showed in the following image, for the “Archive Rows” mode:
通过使用此选项,对于“存档行”模式,您可能会具有下图所示的内容:
You that read the previous article should be thinking “Ok, but what is the advantage of this feature against the other one?”.
阅读上一篇文章的您应该思考“好吧,但是此功能相对于另一功能有什么优势?”。
We can start from the basic:
我们可以从基本开始:
First of all, the very basic: An Azure account, of course 🙂
首先,非常基本:一个Azure帐户,当然🙂
Having this, we need to enable the “Stretch” in the local instance, using the following code:
有了这个,我们需要使用以下代码在本地实例中启用“ Stretch”:
EXEC sp_configure 'remote data archive'GO_EXEC sp_configure 'remote data archive', '1'GO_RECONFIGUREGO
After that we are good to run the already referred wizard!
之后,我们很好地运行已经引用的向导!
I found the official documentation an interesting topic showing some cases were this feature fits… So if you identify yourself with one of those phrases, Stretch Database is for you!
我发现官方文档是一个有趣的主题,其中显示了一些适合该功能的情况……因此,如果您用其中一个短语标识自己,那么Stretch Database非常适合您!
Typical use cases for Stretch Database:
Stretch Database的典型用例:
But be aware that there are some limitations… The following data types are not supported:
但是请注意,存在一些限制……不支持以下数据类型:
If you have one of the following features, your table won’t be elegible as well:
如果您具有以下功能之一,那么您的表格也将无法清晰显示:
To finalize, I’d like to introduce a “new” tool, that is still under CTP as well, but it works well uf you are planning ahead a migration to SQL Server 2016… When I say “new tool”, is just because it was released in a different way, because in fact the tool is quite old 🙂 I’m talking about SQL Server 2016 Upgrade Advisor!
最后,我想介绍一个仍在CTP下的“新”工具,但是如果您正在计划迁移到SQL Server 2016,它会很好地工作……当我说“新工具”时,仅仅是因为它以不同的方式发布,因为实际上该工具已经很老了🙂我正在谈论SQL Server 2016升级顾问!
This new version brought a new interface and “scenarios”, including the Stretch Database. This way, you can analyze your database and find tables that would benefit from the Stretch Database feature. The analysis can be customized, to better fit with your needs.
这个新版本带来了新的界面和“方案”,包括拉伸数据库。 这样,您可以分析数据库并查找可以从“拉伸数据库”功能中受益的表。 可以自定义分析,以更好地满足您的需求。
This way we finish one more piece of the Hybrid series, and more is still to come! I hope you enjoyed!
这样,我们就完成了Hybrid系列的又一部作品,而且还有更多! 希望您喜欢!
翻译自:
横向扩展 纵向扩展 数据库
转载地址:http://umnwd.baihongyu.com/