1.前言
容災(zāi) (Disaster Recovery),即容災(zāi)備份或災(zāi)備津坑,是業(yè)務(wù)連續(xù)性系統(tǒng)的一個子集妙蔗,用于保障 IT 系統(tǒng)在遭受自然災(zāi)害、人為操作失誤或蓄意破壞后的數(shù)據(jù)還原和業(yè)務(wù)恢復(fù).
Ceph RGW 多數(shù)據(jù)中心(multisite)功能旨在實現(xiàn)異地雙活疆瑰,提供了備份容災(zāi)的能力眉反。并且具有多個數(shù)據(jù)中心供用戶選擇,存放資源穆役。
主節(jié)點在對外提供服務(wù)時寸五,用戶數(shù)據(jù)在主節(jié)點落盤后即向用戶回應(yīng)“寫成功”應(yīng)答,然后實時記錄數(shù)據(jù)變化的相關(guān)日志信息耿币。備節(jié)點則實時比較主備數(shù)據(jù)差異梳杏,并及時將差異化數(shù)據(jù)拉回備節(jié)點。異步復(fù)制技術(shù)適用于遠距離的容災(zāi)方案,對系統(tǒng)性能影響較小十性。
2.介紹
單個數(shù)據(jù)中心的配置通常由一個zonegroup組成叛溢,該zonegroup包含一個zone和一個或多個ceph-radosgw實例,您可以在這些實例之間負載均衡網(wǎng)關(guān)客戶端請求劲适。在單個數(shù)據(jù)中心配置中楷掉,通常,多個網(wǎng)關(guān)實例指向單個Ceph存儲群集霞势。Kraken支持Ceph對象網(wǎng)關(guān)的多個多站點配置選項:
Multi-zone:更高級的配置由一個zonegroup和多個zone組成烹植,每個zone具有一個或多個ceph-radosgw實例。每個zone均由其自己的Ceph存儲群集支持愕贡。如果zone之一發(fā)生嚴重故障草雕,則zonegroup中的多個zone可為zonegroup提供災(zāi)難恢復(fù)。在Kraken中颂鸿,每個zone都處于活動狀態(tài)促绵,并且可以接收寫操作。除了災(zāi)難恢復(fù)外嘴纺,多個活動zone還可以用作內(nèi)容交付網(wǎng)絡(luò)的基礎(chǔ)败晴。
Multi-zone-group:又名region,Ceph對象網(wǎng)關(guān)還可以支持多個zonegroup栽渴,每個zonegroup具有一個或多個zone尖坤。在相同的realm中,在同一個zonegroup中的對象共享一個全局命名空間闲擦,在跨zonegroup和zone中具有唯一的對象ID慢味。
Multiple Realms:在Kraken中,Ceph對象網(wǎng)關(guān)支持realm的概念墅冷,realm可以是單個zonegroup或多個zonegroup以及該realm的全局唯一名稱空間纯路。multi realm提供了支持眾多配置和名稱空間的能力。
同一zonegroup中寞忿,多zone之間數(shù)據(jù)拷貝形如:
多站點配置需要至少兩個Ceph存儲群集驰唬,最好給定一個不同的群集名稱。至少兩個Ceph對象網(wǎng)關(guān)實例腔彰,每個Ceph存儲集群一個叫编。
注意:元數(shù)據(jù)在同一realm的zone之間進行同步。
實體數(shù)據(jù)只在同一zonegroup的主zone和從zone之間同步霹抛,無法跨zonegroup訪問實體數(shù)據(jù)的信息搓逾。
3.配置說明
名詞解析:
名稱 | 含義 |
---|---|
realm | 域,同一域內(nèi)的賬戶在其下屬的zone上是通用的杯拐。一個域下只能有一個主zonegroup霞篡,從的zonegroup可以是0或多個世蔗。 |
Period | 表示realm的有效期,在realm的結(jié)構(gòu)發(fā)生變化時寇损,其Period會相應(yīng)變化凸郑。 |
Zonegroup | Zone的集合裳食,等價于之前的Region矛市。一個Zonegroup下只能有一個主Zone。主Zone和從Zone可以部署在同一集群上诲祸,也可以部署在不同的集群上浊吏。 |
zone | 表示獨立的一個對象存儲區(qū)域。 |
Metadata Sync | 用戶及桶相關(guān)的元數(shù)據(jù)同步救氯,因元數(shù)據(jù)更新只能在主zonegroup的主zone上進行找田,所以同步只能由從的zone發(fā)起。 |
一個realm代表了全局唯一的命名空間着憨,這個命名空間由一個或者多個zonegroup墩衙,zonegroup可以包含一個或多個zone.</br></br>
每個realm都有與之對應(yīng)period(表示一個realm的有效期)。每個period及時地代表了zonegroup的狀態(tài)和zone的配置甲抖。每次需要對zonegroup或者zone做修改的時漆改,需要更新period,并提交准谚。</br></br>
3.1.配置master zone
3.1.1.create realm
命令:
radosgw-admin realm create --rgw-realm={realm-name} [--default]
如果集群只有一個域挫剑,請指定--default標志。如果指定了--default柱衔,則radosgw-admin將默認使用此領(lǐng)域樊破。如果未指定--default,則添加區(qū)域組和區(qū)域時需要指定--rgw-realm標志或--realm-id標志唆铐,以在添加區(qū)域組和區(qū)域時標識領(lǐng)域哲戚。
3.1.2.create a master zonegroup
一個realm必須至少具有一個zonegroup,它將用作該realm的主zonegroup艾岂。命令:
radosgw-admin zonegroup create --rgw-zonegroup={name} --endpoints={url} [--rgw-realm={realm-name}|--realm-id={realm-id}] --master --default
如果該realm只有一個zonegroup顺少,請指定--default標志。如果指定--default澳盐,則radosgw-admin在添加新zone時將默認使用此zonegroup祈纯。如果未指定--default,則添加或修改zone時叼耙,添加zone將需要--rgw-zonegroup標志或--zonegroup-id標志來標識zonegroup腕窥。
3.1.3.create a master zone
radosgw-admin zone create --rgw-zonegroup={zone-group-name} \
--rgw-zone={zone-name} \
--master --default \
--endpoints={http://fqdn}[,{http://fqdn}]
重要說明:以下步驟假設(shè)您使用的是尚未安裝數(shù)據(jù)的新安裝系統(tǒng)進行多站點配置。如果已經(jīng)使用默認區(qū)域及其池來存儲數(shù)據(jù)筛婉,請不要刪除它簇爆,否則數(shù)據(jù)將被刪除且無法恢復(fù)癞松。
3.1.4.delete default zonegroup and zone
刪除默認zone(如果存在)。確保首先將其從默認zonegroup中刪除入蛆。
# radosgw-admin zonegroup remove --rgw-zonegroup=default --rgw-zone=default
# radosgw-admin period update --commit
# radosgw-admin zone rm --rgw-zone=default
# radosgw-admin period update --commit
# radosgw-admin zonegroup delete --rgw-zonegroup=default
# radosgw-admin period update --commit
最后响蓉,刪除Ceph存儲群集中的默認池(如果存在)。
# ceph osd pool rm default.rgw.control default.rgw.control --yes-i-really-really-mean-it
# ceph osd pool rm default.rgw.data.root default.rgw.data.root --yes-i-really-really-mean-it
# ceph osd pool rm default.rgw.gc default.rgw.gc --yes-i-really-really-mean-it
# ceph osd pool rm default.rgw.log default.rgw.log --yes-i-really-really-mean-it
# ceph osd pool rm default.rgw.users.uid default.rgw.users.uid --yes-i-really-really-mean-it
3.1.5.create a system user
ceph-radosgw守護程序必須在提取域和期間信息之前進行身份驗證哨毁。在主區(qū)域中枫甲,創(chuàng)建一個系統(tǒng)用戶以促進守護程序之間的認證。
radosgw-admin user create --uid="{user-name}" --display-name="{Display Name}" --system
記下access_key和secret_key扼褪,因為secondary zone將要求它們向主區(qū)域進行身份驗證想幻。
最后拨黔,將系統(tǒng)用戶添加到主區(qū)域蹋岩。
radosgw-admin zone modify --rgw-zone={zone} --access-key={access-key} --secret={secret}
radosgw-admin period update --commit
3.1.6.UPDATE THE CEPH CONFIGURATION FILE
通過在實例條目中添加rgw_zone配置選項和主zone的名稱來更新主區(qū)域主機上的Ceph配置文件。
[client.rgw.{instance-name}]
...
rgw_zone={zone-name}
3.1.7.START THE GATEWAY
在對象網(wǎng)關(guān)主機上霜瘪,啟動并啟用Ceph對象網(wǎng)關(guān)服務(wù)
# systemctl start ceph-radosgw@rgw.`hostname -s`
# systemctl enable ceph-radosgw@rgw.`hostname -s`
3.2.配置SECONDARY ZONES
zonegroup中的zone將復(fù)制所有數(shù)據(jù)幔崖,以確保每個zone都具有相同的數(shù)據(jù)食店。創(chuàng)建SECONDARY ZONES時,請在標識為服務(wù)于SECONDARY ZONES的主機上執(zhí)行以下所有操作赏寇。
注意:要添加第三個區(qū)域吉嫩,請按照與添加SECONDARY ZONES相同的步驟進行操作。使用其他zone名稱蹋订。
重要說明:您必須在主zone內(nèi)的主機上執(zhí)行元數(shù)據(jù)操作率挣,例如用戶創(chuàng)建。主zone和SECONDARY ZONES可以接收存儲桶操作露戒,但是SECONDARY ZONES將存儲桶操作重定向到主zone椒功。如果主zone關(guān)閉,則存儲桶操作將失敗智什。
3.2.1.PULL THE REALM
使用master zone group中master的URL路徑动漾,和access keysecret,將realm配置拉到主機荠锭。要拉出非默認realm旱眯,請使用--rgw-realm或--realm-id配置選項指定領(lǐng)域。
radosgw-admin realm pull --url={url-to-master-zone-gateway} --access-key={access-key} --secret={secret}
注意:pull realm還會檢索遠程服務(wù)器的當前period配置证九,并使其也成為此主機上的删豺。period
如果此realm是默認realm或唯一realm,請將該realm設(shè)置為默認realm愧怜。
radosgw-admin realm default --rgw-realm={realm-name}
3.2.2 CREATE A SECONDARY ZONE
通過在標識為SECONDARY ZONE提供服務(wù)的主機上打開命令行界面呀页,為多站點配置創(chuàng)建SECONDARY ZONE。指定zonegrop ID拥坛,新的zone name和該zone的端點蓬蝶。不要使用--master或--default標志尘分。在Kraken中,默認情況下丸氛,所有區(qū)域都以雙活配置運行培愁。也就是說,網(wǎng)關(guān)客戶端可以將數(shù)據(jù)寫入任何區(qū)域缓窜,并且該zone會將數(shù)據(jù)復(fù)制到zonegroup內(nèi)的所有其他zone定续。如果SECONDARY ZONE不應(yīng)接受寫操作,請指定--read-only標志以在主區(qū)域和SECONDARY ZONE之間創(chuàng)建主動-被動配置雹洗。此外香罐,提供存儲在主區(qū)域組的主區(qū)域中的生成的系統(tǒng)用戶的access_key和secret_key卧波。執(zhí)行以下命令:
radosgw-admin zone create --rgw-zonegroup={zone-group-name}\
--rgw-zone={zone-name} --endpoints={url} \
--access-key={system-key} --secret={secret}\
--endpoints=http://{fqdn}:80 \
[--read-only]
重要說明:以下步驟假設(shè)使用不存儲數(shù)據(jù)的新安裝系統(tǒng)進行多站點配置时肿。如果已經(jīng)使用默認區(qū)域及其池來存儲數(shù)據(jù),請不要刪除它港粱,否則數(shù)據(jù)將丟失并且無法恢復(fù)螃成。
如果需要,請刪除默認區(qū)域查坪。
radosgw-admin zone rm --rgw-zone=default
最后寸宏,根據(jù)需要刪除Ceph存儲群集中的默認池。
# ceph osd pool rm default.rgw.control default.rgw.control --yes-i-really-really-mean-it
# ceph osd pool rm default.rgw.data.root default.rgw.data.root --yes-i-really-really-mean-it
# ceph osd pool rm default.rgw.gc default.rgw.gc --yes-i-really-really-mean-it
# ceph osd pool rm default.rgw.log default.rgw.log --yes-i-really-really-mean-it
# ceph osd pool rm default.rgw.users.uid default.rgw.users.uid --yes-i-really-really-mean-it
3.2.3 UPDATE THE CEPH CONFIGURATION FILE
通過在實例條目中添加rgw_zone配置選項和輔助區(qū)域的名稱偿曙,來更新輔助區(qū)域主機上的Ceph配置文件氮凝。
[client.rgw.{instance-name}]
...
rgw_zone={zone-name}
3.2.4 UPDATE THE PERIOD
更新主區(qū)域配置后,請更新period望忆。
# radosgw-admin period update --commit
注意更新perood會更改epoch罩阵,并確保其他zone將接收更新的配置。
3.2.5 START THE GATEWAY
在對象網(wǎng)關(guān)主機上启摄,啟動并啟用Ceph對象網(wǎng)關(guān)服務(wù):
# systemctl start ceph-radosgw@rgw.`hostname -s`
# systemctl enable ceph-radosgw@rgw.`hostname -s`
3.3檢查同步狀態(tài)
SECONDARY ZONE啟動并運行后稿壁,檢查同步狀態(tài)。同步會將在主zone中創(chuàng)建的用戶和存儲桶復(fù)制到SECONDARY ZONE歉备。
radosgw-admin sync status
注意:SECONDARY ZONE接受存儲桶操作傅是;但是,SECONDARY ZONE將存儲桶操作重定向到主zone蕾羊,然后與主zone同步以接收存儲桶操作的結(jié)果喧笔。如果主zone關(guān)閉,則在SECONDARY ZONE上執(zhí)行的存儲桶操作將失敗龟再,但對象操作應(yīng)成功书闸。
4.實踐操作
1.在主集群(master zone)創(chuàng)建一個名為default的realm
[root@node20 ~]# radosgw-admin realm create --rgw-realm=default --default
{
"id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57",
"name": "default",
"current_period": "5ca7f77e-e4e2-42cf-bb7e-bc62bd4edc42",
"epoch": 1
}
[root@node20 ~]#
2.創(chuàng)建名為cd的master zonegroup
[root@node20 ~]# radosgw-admin zonegroup create --rgw-zonegroup=cd --endpoints=http://10.0.9.20:7480 --rgw-realm=default --master --default
{
"id": "25aaab57-2bb9-4c73-9518-b0dedef9051e",
"name": "cd",
"api_name": "cd",
"is_master": "true",
"endpoints": [
"http://10.0.9.20:7480"
],
"hostnames": [],
"hostnames_s3website": [],
"master_zone": "",
"zones": [],
"placement_targets": [],
"default_placement": "",
"realm_id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57"
}
[root@node20 ~]#
3.創(chuàng)建名為chengdu的master zone
[root@node20 ~]# radosgw-admin zone create --rgw-zonegroup=cd --rgw-zone=chengdu --master --default --endpoints=http://10.0.9.20:7480
{
"id": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"name": "chengdu",
"domain_root": "chengdu.rgw.meta:root",
"control_pool": "chengdu.rgw.control",
"gc_pool": "chengdu.rgw.log:gc",
"lc_pool": "chengdu.rgw.log:lc",
"log_pool": "chengdu.rgw.log",
"intent_log_pool": "chengdu.rgw.log:intent",
"usage_log_pool": "chengdu.rgw.log:usage",
"reshard_pool": "chengdu.rgw.log:reshard",
"user_keys_pool": "chengdu.rgw.meta:users.keys",
"user_email_pool": "chengdu.rgw.meta:users.email",
"user_swift_pool": "chengdu.rgw.meta:users.swift",
"user_uid_pool": "chengdu.rgw.meta:users.uid",
"otp_pool": "chengdu.rgw.otp",
"system_key": {
"access_key": "",
"secret_key": ""
},
"placement_pools": [
{
"key": "default-placement",
"val": {
"index_pool": "chengdu.rgw.buckets.index",
"storage_classes": {
"STANDARD": {
"data_pool": "chengdu.rgw.buckets.data"
}
},
"data_extra_pool": "chengdu.rgw.buckets.non-ec",
"index_type": 0
}
}
],
"metadata_heap": "",
"realm_id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57"
}
[root@node20 ~]#
4.更新period
[root@node20 ~]#
[root@node20 ~]# radosgw-admin period update --commit
{
"id": "837c61b0-a6f4-4165-b973-c2c3aaef0e1e",
"epoch": 1,
"predecessor_uuid": "5ca7f77e-e4e2-42cf-bb7e-bc62bd4edc42",
"sync_status": [],
"period_map": {
"id": "837c61b0-a6f4-4165-b973-c2c3aaef0e1e",
"zonegroups": [
{
"id": "25aaab57-2bb9-4c73-9518-b0dedef9051e",
"name": "cd",
"api_name": "cd",
"is_master": "true",
"endpoints": [
"http://10.0.9.20:7480"
],
"hostnames": [],
"hostnames_s3website": [],
"master_zone": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"zones": [
{
"id": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"name": "chengdu",
"endpoints": [
"http://10.0.9.20:7480"
],
"log_meta": "false",
"log_data": "false",
"bucket_index_max_shards": 0,
"read_only": "false",
"tier_type": "",
"sync_from_all": "true",
"sync_from": [],
"redirect_zone": ""
}
],
"placement_targets": [
{
"name": "default-placement",
"tags": [],
"storage_classes": [
"STANDARD"
]
}
],
"default_placement": "default-placement",
"realm_id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57"
}
],
"short_zone_ids": [
{
"key": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"val": 1358787057
}
]
},
"master_zonegroup": "25aaab57-2bb9-4c73-9518-b0dedef9051e",
"master_zone": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"period_config": {
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
}
},
"realm_id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57",
"realm_name": "default",
"realm_epoch": 2
}
[root@node20 ~]#
5.創(chuàng)建名為同步用戶
[root@node20 ~]# radosgw-admin user create --uid="admin" --display-name="Admin User" --system
{
"user_id": "admin",
"display_name": "Admin User",
"email": "",
"suspended": 0,
"max_buckets": 1000,
"subusers": [],
"keys": [
{
"user": "admin",
"access_key": "POMDCNR4FX3WJS0MW7ZH",
"secret_key": "LIAmUYpP0Hd0oNYF3IzmB1Qn49DJ3i5zFaDu5YYx"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"system": "true",
"default_placement": "",
"default_storage_class": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"temp_url_keys": [],
"type": "rgw",
"mfa_ids": []
}
[root@node20 ~]#
6.修改zone的key,并更新period
[root@node20 ~]#
[root@node20 ~]# radosgw-admin zone modify --rgw-zone=chengdu --access-key=POMDCNR4FX3WJS0MW7ZH --secret=LIAmUYpP0Hd0oNYF3IzmB1Qn49DJ3i5zFaDu5YYx
{
"id": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"name": "chengdu",
"domain_root": "chengdu.rgw.meta:root",
"control_pool": "chengdu.rgw.control",
"gc_pool": "chengdu.rgw.log:gc",
"lc_pool": "chengdu.rgw.log:lc",
"log_pool": "chengdu.rgw.log",
"intent_log_pool": "chengdu.rgw.log:intent",
"usage_log_pool": "chengdu.rgw.log:usage",
"reshard_pool": "chengdu.rgw.log:reshard",
"user_keys_pool": "chengdu.rgw.meta:users.keys",
"user_email_pool": "chengdu.rgw.meta:users.email",
"user_swift_pool": "chengdu.rgw.meta:users.swift",
"user_uid_pool": "chengdu.rgw.meta:users.uid",
"otp_pool": "chengdu.rgw.otp",
"system_key": {
"access_key": "POMDCNR4FX3WJS0MW7ZH",
"secret_key": "LIAmUYpP0Hd0oNYF3IzmB1Qn49DJ3i5zFaDu5YYx"
},
"placement_pools": [
{
"key": "default-placement",
"val": {
"index_pool": "chengdu.rgw.buckets.index",
"storage_classes": {
"STANDARD": {
"data_pool": "chengdu.rgw.buckets.data"
}
},
"data_extra_pool": "chengdu.rgw.buckets.non-ec",
"index_type": 0
}
}
],
"metadata_heap": "",
"realm_id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57"
}
[root@node20 ~]#
7.刪除默認zone和zonegroup
由于環(huán)境是新環(huán)境吸申,沒有default zone/zonegroup梗劫,此操作省略享甸;可通過以下命令查看環(huán)境存在的zonegroup和zone
[root@node20 ~]# radosgw-admin zonegroup list
{
"default_info": "09a7c3d7-e45b-4510-ba78-dee84c5b5d16",
"zonegroups": [
"cd"
]
}
[root@node20 ~]# radosgw-admin zone list
{
"default_info": "3bab4fa1-c67e-4dae-bdca-53fe3162862f",
"zones": [
"chengdu"
]
}
[root@node20 ~]#
如果環(huán)境存在default zonegroup/zone,可用以下命令刪除:
radosgw-admin zonegroup remove --rgw-zonegroup=default --rgw-zone=default
radosgw-admin period update --commit
radosgw-admin zone delete --rgw-zone=default
radosgw-admin period update --commit
radosgw-admin zonegroup delete --rgw-zonegroup=default
radosgw-admin period update --commit
8.刪除默認pool
ceph osd pool delete default.rgw.control default.rgw.control --yes-i-really-really-mean-it
ceph osd pool delete default.rgw.meta default.rgw.meta --yes-i-really-really-mean-it
ceph osd pool delete default.rgw.log default.rgw.log --yes-i-really-really-mean-it
9.修改rgw配置, 增加rgw_zone = chengdu
[client.rgw.node20]
host = node20
keyring = /var/lib/ceph/radosgw/ceph-rgw.node20/keyring
log file = /var/log/ceph/ceph-rgw-node20.log
rgw frontends = civetweb port=10.0.9.20:7480 num_threads=100
rgw_zone = chengdu
10.重啟rgw,并查看pool是否創(chuàng)建
[root@node20 ceph]# systemctl restart ceph-radosgw@rgw.node20
[root@node20 ceph]# ceph osd pool ls
.rgw.root
chengdu.rgw.control
chengdu.rgw.meta
chengdu.rgw.log
[root@node20 ceph]#
在secondy zone節(jié)點進行如下配置:
1.同步realm, 并設(shè)置default為默認的realm
[root@node103 ~]# radosgw-admin realm pull --url=http://10.0.9.20:7480 --access-key=POMDCNR4FX3WJS0MW7ZH --secret=LIAmUYpP0Hd0oNYF3IzmB1Qn49DJ3i5zFaDu5YYx
{
"id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57",
"name": "default",
"current_period": "837c61b0-a6f4-4165-b973-c2c3aaef0e1e",
"epoch": 2
}
[root@node103 ~]#
2.更新period
[root@node103 ~]# radosgw-admin period pull --url=http://10.0.9.20:7480 --access-key=POMDCNR4FX3WJS0MW7ZH --secret=LIAmUYpP0Hd0oNYF3IzmB1Qn49DJ3i5zFaDu5YYx
2020-07-23 06:16:59.252 7fcb267fc6c0 1 found existing latest_epoch 1 >= given epoch 1, returning r=-17 [RGWPeriod::update_latest_epoch:1100]
{
"id": "837c61b0-a6f4-4165-b973-c2c3aaef0e1e",
"epoch": 1,
"predecessor_uuid": "5ca7f77e-e4e2-42cf-bb7e-bc62bd4edc42",
"sync_status": [],
"period_map": {
"id": "837c61b0-a6f4-4165-b973-c2c3aaef0e1e",
"zonegroups": [
{
"id": "25aaab57-2bb9-4c73-9518-b0dedef9051e",
"name": "cd",
"api_name": "cd",
"is_master": "true",
"endpoints": [
"http://10.0.9.20:7480"
],
"hostnames": [],
"hostnames_s3website": [],
"master_zone": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"zones": [
{
"id": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"name": "chengdu",
"endpoints": [
"http://10.0.9.20:7480"
],
"log_meta": "false",
"log_data": "false",
"bucket_index_max_shards": 0,
"read_only": "false",
"tier_type": "",
"sync_from_all": "true",
"sync_from": [],
"redirect_zone": ""
}
],
"placement_targets": [
{
"name": "default-placement",
"tags": [],
"storage_classes": [
"STANDARD"
]
}
],
"default_placement": "default-placement",
"realm_id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57"
}
],
"short_zone_ids": [
{
"key": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"val": 1358787057
}
]
},
"master_zonegroup": "25aaab57-2bb9-4c73-9518-b0dedef9051e",
"master_zone": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"period_config": {
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
}
},
"realm_id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57",
"realm_name": "default",
"realm_epoch": 2
}
[root@node103 ~]#
3.創(chuàng)建secondy zone
[root@node103 ~]# radosgw-admin zone create --rgw-zonegroup=cd --rgw-zone=shanghai --url=http://10.0.9.103:7480 --access-key=POMDCNR4FX3WJS0MW7ZH --secret=LIAmUYpP0Hd0oNYF3IzmB1Qn49DJ3i5zFaDu5YYx
2020-07-23 06:18:42.133 7fc06d8956c0 0 failed reading obj info from .rgw.root:zone_info.a0a652dc-4e29-4100-96e5-8a35c1354985: (2) No such file or directory [RGWSystemMetaObj::read_info:597]
2020-07-23 06:18:42.133 7fc06d8956c0 0 WARNING: could not read zone params for zone id=a0a652dc-4e29-4100-96e5-8a35c1354985 name=chengdu [RGWZoneGroup::post_process_params:277]
{
"id": "fe9e5cd4-3c4f-4cc3-aefa-3308ed20b369",
"name": "shanghai",
"domain_root": "shanghai.rgw.meta:root",
"control_pool": "shanghai.rgw.control",
"gc_pool": "shanghai.rgw.log:gc",
"lc_pool": "shanghai.rgw.log:lc",
"log_pool": "shanghai.rgw.log",
"intent_log_pool": "shanghai.rgw.log:intent",
"usage_log_pool": "shanghai.rgw.log:usage",
"reshard_pool": "shanghai.rgw.log:reshard",
"user_keys_pool": "shanghai.rgw.meta:users.keys",
"user_email_pool": "shanghai.rgw.meta:users.email",
"user_swift_pool": "shanghai.rgw.meta:users.swift",
"user_uid_pool": "shanghai.rgw.meta:users.uid",
"otp_pool": "shanghai.rgw.otp",
"system_key": {
"access_key": "POMDCNR4FX3WJS0MW7ZH",
"secret_key": "LIAmUYpP0Hd0oNYF3IzmB1Qn49DJ3i5zFaDu5YYx"
},
"placement_pools": [
{
"key": "default-placement",
"val": {
"index_pool": "shanghai.rgw.buckets.index",
"storage_classes": {
"STANDARD": {
"data_pool": "shanghai.rgw.buckets.data"
}
},
"data_extra_pool": "shanghai.rgw.buckets.non-ec",
"index_type": 0
}
}
],
"metadata_heap": "",
"realm_id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57"
}
[root@node103 ~]#
4.刪除默認default zone梳侨, defaul zonegroup和 default存儲池
5.修改rgw配置, 增加rgw_zone = shanghai
6.重啟rgw蛉威,并查看pool是否創(chuàng)建
[root@node103 ceph]# systemctl restart ceph-radosgw@rgw.node103
[root@node103 ceph]#
[root@node103 ceph]# ceph osd pool ls
.rgw.root
shanghai.rgw.control
shanghai.rgw.meta
shanghai.rgw.log
[root@node103 ceph]#
7.更新period
[root@node103 ceph]#
[root@node103 ceph]# radosgw-admin period update --commit
2020-07-23 06:21:25.195 7f156479b6c0 1 Cannot find zone id=fe9e5cd4-3c4f-4cc3-aefa-3308ed20b369 (name=shanghai), switching to local zonegroup configuration [RGWSI_Zone::do_start:137]
Sending period to new master zone a0a652dc-4e29-4100-96e5-8a35c1354985
{
"id": "837c61b0-a6f4-4165-b973-c2c3aaef0e1e",
"epoch": 2,
"predecessor_uuid": "5ca7f77e-e4e2-42cf-bb7e-bc62bd4edc42",
"sync_status": [],
"period_map": {
"id": "837c61b0-a6f4-4165-b973-c2c3aaef0e1e",
"zonegroups": [
{
"id": "25aaab57-2bb9-4c73-9518-b0dedef9051e",
"name": "cd",
"api_name": "cd",
"is_master": "true",
"endpoints": [
"http://10.0.9.20:7480"
],
"hostnames": [],
"hostnames_s3website": [],
"master_zone": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"zones": [
{
"id": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"name": "chengdu",
"endpoints": [
"http://10.0.9.20:7480"
],
"log_meta": "false",
"log_data": "true",
"bucket_index_max_shards": 0,
"read_only": "false",
"tier_type": "",
"sync_from_all": "true",
"sync_from": [],
"redirect_zone": ""
},
{
"id": "fe9e5cd4-3c4f-4cc3-aefa-3308ed20b369",
"name": "shanghai",
"endpoints": [],
"log_meta": "false",
"log_data": "true",
"bucket_index_max_shards": 0,
"read_only": "false",
"tier_type": "",
"sync_from_all": "true",
"sync_from": [],
"redirect_zone": ""
}
],
"placement_targets": [
{
"name": "default-placement",
"tags": [],
"storage_classes": [
"STANDARD"
]
}
],
"default_placement": "default-placement",
"realm_id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57"
}
],
"short_zone_ids": [
{
"key": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"val": 1358787057
},
{
"key": "fe9e5cd4-3c4f-4cc3-aefa-3308ed20b369",
"val": 888817739
}
]
},
"master_zonegroup": "25aaab57-2bb9-4c73-9518-b0dedef9051e",
"master_zone": "a0a652dc-4e29-4100-96e5-8a35c1354985",
"period_config": {
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
}
},
"realm_id": "ac48a172-ae86-4af7-8b31-b0fa03a0bb57",
"realm_name": "default",
"realm_epoch": 2
}
[root@node103 ceph]#
8.查看同步狀態(tài)
[root@node103 ceph]# radosgw-admin sync status
realm ac48a172-ae86-4af7-8b31-b0fa03a0bb57 (default)
zonegroup 25aaab57-2bb9-4c73-9518-b0dedef9051e (cd)
zone fe9e5cd4-3c4f-4cc3-aefa-3308ed20b369 (shanghai)
metadata sync syncing
full sync: 0/64 shards
incremental sync: 64/64 shards
metadata is caught up with master
data sync source: a0a652dc-4e29-4100-96e5-8a35c1354985 (chengdu)
syncing
full sync: 0/128 shards
incremental sync: 128/128 shards
data is caught up with source
[root@node103 ceph]#
5.驗證
6.維護
6.1 檢測同步狀態(tài)
[root@node103 ~]# radosgw-admin sync status
realm ac48a172-ae86-4af7-8b31-b0fa03a0bb57 (default)
zonegroup 25aaab57-2bb9-4c73-9518-b0dedef9051e (cd)
zone fe9e5cd4-3c4f-4cc3-aefa-3308ed20b369 (shanghai)
metadata sync syncing
full sync: 0/64 shards
incremental sync: 64/64 shards
metadata is caught up with master
data sync source: a0a652dc-4e29-4100-96e5-8a35c1354985 (chengdu)
syncing
full sync: 0/128 shards
incremental sync: 128/128 shards
data is caught up with source
[root@node103 ~]#
6.2 更改元數(shù)據(jù)master zone
重要:當更改zone為元數(shù)據(jù)主zone時,必須小心走哺。如果某個zone尚未完成從當前主zone的元數(shù)據(jù)同步蚯嫌,則當提升為主區(qū)域時,該區(qū)域?qū)o法提供任何剩余條目丙躏,這些更改將丟失择示。因此,建議先等待zone的radosgw-admin同步狀態(tài)趕上元數(shù)據(jù)同步晒旅,然后再將其升級為master zone栅盲。
同樣,如果當前master zone正在處理對元數(shù)據(jù)的更改废恋,而另一個zone正被提升為master zone谈秫,則這些更改很可能會丟失。為避免這種情況鱼鼓,建議關(guān)閉前一個主zone上的所有radosgw實例拟烫。升級另一個zone后,可以使用radosgw-admin時期拉取來獲取其新時期迄本,并且可以重新啟動網(wǎng)關(guān)硕淑。</br>
要將zone升級為元數(shù)據(jù)master zone,請在該zone上運行以下命令:
$ radosgw-admin zone modify --rgw-zone={zone} --master
$ radosgw-admin zonegroup modify --rgw-zonegroup={zonegroup} --master
$ radosgw-admin period update --commit
這將產(chǎn)生一個新的period嘉赎,zone {zone} 中的radosgw實例會將這個period發(fā)送到其他zone置媳。
6.3 故障轉(zhuǎn)移和災(zāi)難恢復(fù)
如果master zone發(fā)生故障,請故障轉(zhuǎn)移到secondary zone以進行災(zāi)難恢復(fù)
6.3.1 故障轉(zhuǎn)移
1.設(shè)置secondary zone為master和default zone.
# radosgw-admin zone modify --rgw-zone={zone-name} --master --default
默認情況下曹阔,Ceph對象網(wǎng)關(guān)將以雙活配置運行半开。如果將群集配置為在主動-被動配置中運行,則是secondary zone只讀zone赃份。刪除--read-only狀態(tài)以允許zone接收寫操作寂拆。例如:
# radosgw-admin zone modify --rgw-zone={zone-name} --master --default --read-only=false
2.更新period以使更改生效
# radosgw-admin period update --commit
3.最后,重新啟動Ceph對象網(wǎng)關(guān)抓韩。
systemctl restart ceph-radosgw@rgw.`hostname -s`
6.3.2 恢復(fù)
如果以前的master zone恢復(fù)纠永,還原操作:
1.從恢復(fù)的zone中,從當前的master zone中提取最新的realm配置谒拴。
radosgw-admin realm pull --url={url-to-master-zone-gateway} \
--access-key={access-key} --secret={secret}
2.將恢復(fù)的zone設(shè)為主zone和默認zone尝江。
radosgw-admin zone modify --rgw-zone={zone-name} --master --default
3.更新period以使更改生效
radosgw-admin period update --commit
4.在恢復(fù)的zone中重新啟動Ceph對象網(wǎng)關(guān)。
systemctl restart ceph-radosgw@rgw.`hostname -s`
5.如果secondary zone需要為只讀配置英上,請更新secondary zone
radosgw-admin zone modify --rgw-zone={zone-name} --read-only
6.更新period以使更改生效
radosgw-admin period update --commit
7.在中secondary zone重新啟動Ceph對象網(wǎng)關(guān)
systemctl restart ceph-radosgw@rgw.`hostname -s`
6.4 單站點系統(tǒng)遷移到多站點
要將具有默認zonegroup和zone的單個站點系統(tǒng)遷移到多站點系統(tǒng)炭序,請使用以下步驟:
1.創(chuàng)建一個realm
radosgw-admin realm create --rgw-realm=<name> --default
2.重命名默認的zone和zonegroup
# radosgw-admin zonegroup rename --rgw-zonegroup default --zonegroup-new-name=<name>
# radosgw-admin zone rename --rgw-zone default --zone-new-name us-east-1 --rgw-zonegroup=<name>
3.配置主zonegroup
radosgw-admin zonegroup modify --rgw-realm=<name> --rgw-zonegroup=<name> --endpoints http://<fqdn>:80 --master --default
4.配置主zone
# radosgw-admin zone modify --rgw-realm=<name> --rgw-zonegroup=<name> \
--rgw-zone=<name> --endpoints http://<fqdn>:80 \
--access-key=<access-key> --secret=<secret-key> \
--master --default
5.創(chuàng)建一個system user啤覆,用于認證
radosgw-admin user create --uid=<user-id> --display-name="<display-name>"\
--access-key=<access-key> --secret=<secret-key> --system
6.提交配置修改
radosgw-admin period update --commit
7.重啟rgw服務(wù)
systemctl restart ceph-radosgw@rgw.`hostname -s`