暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

RGW endpoint绑定多域名

Ceph开源社区 2018-10-17
1106

RGW多域名配置说明

  • L版本的ceph.conf中的rgw_dns_name字段只支持单个域名,如果你使用下面的配置格式都是错误的

    rgw_dns_name = demo1.s3.cephbook.com,demo2.s3.cephbook.com
    or
    rgw_dns_name = demo1.s3.cephbook.com demo2.s3.cephbook.com

  • 多个域名的配置需要将其他域名加入到zonegroup配置的hostnames列表中

To configure virtual hosted buckets, you can either set rgw_dns_name = cname.domain.com in ceph.conf, or add cname.domain.com to the list of hostnames in your zonegroup configuration. See Ceph Object Gateway - Multisite Configuration for more on zonegroups.

参考:https://github.com/ceph/ceph/blob/d038e1da7a6c9b31ba4463b8ebedb9908981a55e/doc/radosgw/s3/commons.rst#bucket-and-host-name

源码描述

https://github.com/ceph/ceph/blob/2a72d893d20a8459c0a1695b57c51727b20d2dae/src/rgw/rgw_rest.cc#L204

void rgw_rest_init(CephContext *cct, RGWRados *store, RGWZoneGroup& zone_group)
{
 ...
   hostnames_set.insert(cct->_conf->rgw_dns_name);
  hostnames_set.insert(zone_group.hostnames.begin(), zone_group.hostnames.end());
  hostnames_set.erase(""); // filter out empty hostnames
  ldout(cct, 20) << "RGW hostnames: " << hostnames_set << dendl;
  /* TODO: We should have a sanity check that no hostname matches the end of
   * any other hostname, otherwise we will get ambigious results from
   * rgw_find_host_in_domains.
   * Eg: 
   * Hostnames: [A, B.A]
   * Inputs: [Z.A, X.B.A]
   * Z.A clearly splits to subdomain=Z, domain=Z
   * X.B.A ambigously splits to both {X, B.A} and {X.B, A}
   */


也就是说RGW的域名数量=rgw_dns_name+zone_group.hostnames

实例讲解

在multisite场景中,一般都是单个zonegroup下挂有多个zone的模型,通过master zone与slave zone的元数据和数据同步来实现“多活”,此时就会用到多个域名的配置。域名的规划如下:

  • 客户端通过使用唯一的s3.cephbook.com与整个RGW后端服务进行通信,从而避免在故障发生时需要在多个endpoint之间进行切换。

  • 客户端对s3.cephbook.com的解析,可以采用智能DNS解析系统,根据用户IP解析到最近的zone入口IP。

  • 后端zone发生故障的情况下,通过切换s3.cephbook.com对应的后端入口IP去实现故障入口的快速切换。(这里面有很多细节,主要考虑TTL的刷新影响。)

  • zone1和zone2在进行元数据以数据的同步时,使用单独的域名zone1.cephbook.com和zone2.cephbook.com,从而实现集群内部同步流量与正常的业务流量的分流治理。


ceph.conf 配置

[client.zone2]
        host = demo
        keyring = /var/lib/ceph/radosgw/ceph-zone2/keyring
        log file = /var/log/ceph/radosgw.zone2.log
    rgw_zone=zone2
        rgw dns name = s3.cephbook.com 
        ......

zonegroup配置

[root@demo supdev]# radosgw-admin zonegroup get
{
    "id""68f1dcf5-0470-4a48-8cd2-51c837a2cafb",
    "name""cn-bj",
    "api_name""cn-bj",
    "is_master""true",
    "endpoints": [
        "http://s3.cephbook.com:80"
    ],
    "hostnames": ["zone2.cephbook.com","zone1.cephbook.com"],
    "hostnames_s3website": [],
    "master_zone""9563e299-0675-4725-8032-39ef55fa7fce",
    "zones": [
        {
            "id""9563e299-0675-4725-8032-39ef55fa7fce",
            "name""zone1",
            "endpoints": [
                "http://zone1.cephbook.com:80"
            ],
            "log_meta""true",
            "log_data""true",
            "bucket_index_max_shards"16,
            "read_only""false",
            "tier_type""",
            "sync_from_all""true",
            "sync_from": []
        },
        {
            "id""afd874cd-f976-4007-a77c-be6fca298b71",
            "name""zone2",
            "endpoints": [
                "http://zone2.cephbook.com:80"
            ],
            "log_meta""true",
            "log_data""true",
            "bucket_index_max_shards"16,
            "read_only""false",
            "tier_type""",
            "sync_from_all""true",
            "sync_from": []
        }
    ],
    "placement_targets": [
        {
            "name""default-placement",
            "tags": []
        }
    ],
    "default_placement""default-placement",
    "realm_id""6a0ab888-f4e9-4b7b-9b52-cc957b9b2a8c"
}



欢迎订阅秦牧羊公众号cephbook,干货满满,专业老司机教你搞"对象"存储!


Ceph中国社区

是国内唯一官方正式授权的社区,

为广大Ceph爱好者提供交流平台!

↓↓↓

开源-创新-自强

官方网站:www.ceph.org.cn

合作邮箱:devin@ceph.org.cn

投稿地址:tougao@ceph.org.cn

长期招募热爱翻译人员,

参与社区翻译外文资料工作。

文章转载自Ceph开源社区,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论