您的位置:首页 > 运维架构 > 网站架构

Cockroach Design 翻译 ( 三) 架构

2016-12-03 19:40 309 查看

3  Architecture(架构)

CockroachDBimplements a layered architecture. The highest level of abstraction is the SQLlayer (currently unspecified in this document). It depends directly onthe SQL
layer,which provides familiar relational concepts such as schemas, tables, columns,and indexes. The SQL layer in turn depends on the distributed
key value store, which handles thedetails of range
addressing
to provide the abstraction of asingle, monolithic key value store. The distributed KV store communicates withany number of physical cockroach nodes. Each node contains one
4000
or more stores,one per physical device.

CockroachDB采用分层架构。其最高抽像层为SQL层(目前本文档未详细描述)。CockroachDB直接通过SQL层提供熟悉的关系概念,如:模式schema、表table、列column和索引index。接下来SQL层依赖于分布式KV存储,该存储管理range处理的细节以提供一个单一全局KV存储的抽象。分布式KV存储与任意数量的cockroach物理节点通信。每个物理节点包含一个或者多个存储。

Each storecontains potentially many ranges, the lowest-level unit of key-value data.Ranges are replicated using the Raft consensus protocol. The diagram below is ablown up
version of stores from four of the five nodes in theprevious diagram. Each range is replicated three ways using raft. The colorcoding shows associated range replicas.

每个store都可能包含很多range,range是最底层的KV数据单元。Range使用Raft一致性协议进行复制。下图是上图store的放大版本,示意了上图5个节点中的4个节点的store。每个range都被使用Raft协议复制了3份。颜色编码显示了关联的range副本(译注:range及其副本使用相同颜色)。

Each physicalnode exports two RPC-based key value APIs: one for external clients and one forinternal clients (exposing sensitive operational features). Both servicesaccept batches of requests and return batches of responses. Nodes are symmetricin
capabilities
and exported interfaces; each has the samebinary and may assume any role.

每一个物理节点都提供两个基于RPC的KV
API:一个为外部客户端提供,一个为内部客户端使用(暴露易变化的操作特性)。两种服务都接受批量请求并批量返回结果。每个节点所提供的能力和接口都是对等的,每个节点都部署相同的二进制程序并可以承担任何角色。

Nodes and theranges they provide access to can be arranged with various physical networktopologies to make trade offs between reliability and performance. For example,a triplicated (3-way replica) range could have each replica located ondifferent:

l  disks within a server to tolerate disk failures.

l  servers within a rack to tolerate server failures.

l  servers on different racks within a datacenter to tolerate rackpower/network failures.

l  servers in different datacenters to tolerate large scale network orpower outages.

节点和它所提供的可访问range可以据各种物理网络拓扑结构调整,以兼顾可靠性和性能。例如,一个3副本的range其每份副本放置到不同位置(以达到不同的效果):

l  位于一台服务器上的不同磁盘上以容忍磁盘失效;

l  位于一个机架上的不同服务器上以容忍server失效;

l  位于一个数据中心内不同机架的服务器上以以容忍机架电力/网络失效;

l  位于不同数据中心的服务器上以容忍大范围断网或者停电。

Up to F failures can be tolerated, where the total number ofreplicas N= 2F + 1 (e.g. with 3x replication, one failurecan be tolerated; with 5x replication, two failures, and so on).

若要最高容忍F个失效,则需副本总数N=2F
+ 1(例如:3个副本可容忍1个失效,5个副本容忍2个失效,等等)。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息