IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    sharding database的一些概念的补充

    小荷发表于 2016-11-14 08:31:58
    love 0

    在继『Oracle sharding database的一些概念』之后,我觉得还有一些关于sharding的概念,是值得理解的。

    (1) shardgroup:

    In system-managed and composite sharding, the logical unit of replication is a group of shards called a shardgroup.

    也就是说,在逻辑上,将一组相同复制属性的shard称作shard group。如有8台主机,其中4台是shard node的primary,另外4台是shard node的standby。那么,我们可以把4台primary定义成一个shardgroup,叫primary_shardgroup,另外4台standby定义成另外一个shardgroup,叫standby_shardgroup。

    注,一个shardgroup通常是在一个data center内。

    dataguard可以级联,那么我们可以把primary做为一个shardgroup1,第一级的dataguard叫shardgroup2,第二级的dataguard叫shardgroup2.如下:
    system-managed-sharding-with-data-guard-replication

    (2). shardspace:

    A shardspace is set of shards that store data that corresponds to a range or list of key values.

    shardspace的概念伴随着综合性分片的分片方法(composite sharding method)出现的;如果是系统管理分片方法(system-managed sharding method),只有一个默认的shardspace。所以只有在composite sharding下,才有可能出现多个shardspace。

    在composite sharding下,数据首先根据list或者range,分成若干个shardspace。然后再根据一致性hash进行分片。

    注,每个shardspace包含一个或者多个复制shard for HA/DR。

    shardspace

    我们可以按照服务级别来划分shardspace,如硬件好的,作为shardspace_gold,硬件差一些的,划做shardspace_silver:

    或者也可以根据业务需要,按照地域来分不同的shardgroup,如这里的shardgroup cust_america和shardgroup cust_euro
    add-shardgroup

    (3). super sharding key

    Composite sharding enables two levels of sharding - one by list or range and another by consistent hash. This is accomplished by the application providing two keys: a super sharding key and a sharding key.

    super sharding key也是随着综合性分片的分片方法出现的。由于综合性分片是2层分片,第一层是根据list或者range进行分片,这个shard key,就叫做super_sharding_key。第二层才是根据一致性hash进行分片(基于sharding key)。

    (4). Composite sharding
    综合性分片,提供了2层的分片方法,第一层按照range 或者list,第二层根据一致性hash。

    综合性分片一般适用于:
    (4.1)在不同的地理位置,使用不同的shardspace:
    comp_shard_1

    (4.2) 在不同的服务器,或者云上面,使用不同的shardspace:
    comp_shard_2

    (5). region

    A region in the context of Oracle Sharding represents a data center or multiple data centers that are in close network proximity.

    region,地区的概念。可以指一个数据中心,也可以指一个地域。

    (6). shard director

    A shard director is a specific implementation of a global service manager that acts as a regional listener for clients that connect to an SDB. The director maintains a current topology map of the SDB. Based on the sharding key passed during a connection request, the director routes the connections to the appropriate shard.
    
    To achieve high availability, deploy multiple shard directors. In Oracle Database 12c Release 2, you can deploy up to 5 shard directors in a given region.

    shard director提供:
    a).实时维护SDB的配置信息和可用性。
    b).衡量自身所处的region和别的region间的网络延时
    c).接受来自客户端到SDB的连接,你可以把它当作region listener。
    d).管理global services
    e).实现连接负载均衡。

    注:每个region需要至少一个shard director,可以最多有五个shard director。



沪ICP备19023445号-2号
友情链接