Skip to Content
Google SRE工作手册
book

Google SRE工作手册

by Betsy Beyer, Niall Richard Murphy, David K. Rensin, Kent Kawahara, Stephen Thorne
September 2020
Intermediate to advanced
526 pages
8h 23m
Chinese
China Electric Power Press Ltd.
Content preview from Google SRE工作手册
360
15
如前所述,如果你可以完全删除配置,那么这一定是你的最佳选择。尽管配置语言
可以通过使用具有默认值的模板来隐藏基础模型的复杂性,但是生成的配置数据并
无法完全隐藏,它可能会由工具处理、由人工检查或加载到配置数据库中。出于相
同的原因,请勿依赖配置语言来解决基础模型中不一致的命名、复数或错误,而是
应当将其在模型本身中修复。如果你无法解决模型中的不一致问题,那么最好在语
言级别上解决它们,从而避免出现更多的不一致的地方。
根据我们的经验,随着时间的推移,配置变更通常会成为系统中最主要的故障原因
(请参阅附录
C
中的主要故障原因列表)。验证配置变更是维持可靠性的关键步骤。
我们建议:在配置被执行后,立即验证生成的配置数据。仅通过语法验证(即检查
JSON
是否可解析)不会发现很多错误。进行通用架构验证后,检查特定于你的应用
程序领域的属性,例如,是否存在必填字段,是否存在引用的文件名,以及所提供
的值是否在允许的范围内。
你可以使用
JSONschema
http://json-schema.org/
)验证
Jsonnet
JSON
。对于使用
协议缓冲区(
http://bit.ly/2szjO1l
)的应用程序,你可以轻松地从
Jsonnet
生成这些缓
冲区的规范
JSON
形式,并且协议缓冲区实现将在反序列化期间进行验证。
不管你决定如何验证,都不要忽略无法识别的字段名称,因为它们可能意味着在配
置语言的层面上有笔误。
Jsonnet
可以屏蔽不应当出现的
::
语法输出字段。在预
提交钩子中执行相同的验证也是一个好主意。 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Python数据分析(第2版)

Python数据分析(第2版)

Posts & Telecom Press, Armando Fandango
Google系统架构解密: 构建安全可靠的系统

Google系统架构解密: 构建安全可靠的系统

Heather Adkins, Betsy Beyer, Paul Blankinship, Piotr Lewandowski, Ana Oprea, Adam Stubblefield
编写整洁的Python代码(第2版)

编写整洁的Python代码(第2版)

Posts & Telecom Press, Mariano Anaya

Publisher Resources

ISBN: 9787519845858