ceph 對象存儲配置zone 同步 原

環境:ceph v10.2.3(jewel)、ubuntu16.04

                                     -----------us-east------rgw.node2

                                    |        (master zone)      (ceph-1 radosgw 實例)

                                    |

Movies----us----------

(realm)   (zonegroup)   |

                                     |

                                     -----------us-west------------rgw.node3

                                             ( secondary zone)     (ceph-2 radosgw 實例)

一、概念:      

    1、zone:可用區,有一個或多個對象網關實例組成。zone不可以跨集羣,配置zone不同於其他典型配置,因爲不需要在ceph.conf中配置。

    2、zonegroup:以前叫做“region”,有多個zone組成,一個zonegroup裏面有一個master zone,在同一個zonegroup中的多個zone可以同步元數據和數據,提供災難恢復能力。

    3、realm:代表一個唯一的命名空間,有一個或多個zonegroup組成。在同一個realm中的不同zonegroup只能同步元數據。在realm中有period的概念,表示zonegroup的配置狀態,修改zonegroup,必須更新period。

二、在ceph-1集羣上配置master zone

      1、創建realm

      radosgw-admin realm create --rgw-realm=movies --default

     如果沒有指定default 後面在配置zone 和zonegroup的時候要指定realm

      2、創建master zonegroup

      radosgw-admin zonegroup create --rgw-zonegroup=us --endpoints=http://10.33.0.13:80  --master --default

      3、創建master zone

      radosgw-admin zone create  --rgw-zone=us-east --master --default --endpoints=10.33.0.13:80

      4、創建一個system賬戶用於和us-west zone同步

       radosgw-admin user create --uid="synchronization-user" --display-name="Synchronization User" --system

     5、用創建system賬戶產生的access 和secret更新zone配置

     radosgw-admin zone modify --rgw-zone=us-east --access-key={access-key} --secret={secret}

    6、更新period

    radosgw-admin period update --commit

     7、配置ceph.conf

     [client.rgw.node2]

          host = node2

          rgw frontends = "civetweb port=80"

          rgw_zone=us-east

    8、搭建radosgw

       見https://my.oschina.net/u/2326998/blog/838611

三、在ceph-2集羣上配置secondary zone

       1、從master zone拉取realm

       radosgw-admin realm pull --url=http://10.33.0.13:80 --access-key={access-key} --secret={secret}

       note:這裏的access key 和secret是master zone上system 賬戶的access key和secret

      2、拉取period

      radosgw-admin period pull --url=http://10.33.0.13:80 --access-key={access-key} --secret={secret}

     note:這裏的access key和secret 同上

     3、創建secondary zone

       radosgw-admin zone create --rgw-zonegroup=us --rgw-zone=us-west \

                            --access-key={system-key} --secret={secret} \

                            --endpoints=http://10.33.0.40:80

       note:這裏的access key和secret是在master zone中system賬戶的創建的。

    4、更新period

       radosgw-admin period update --commit

       note:如果出現認證錯誤,重啓master zone的實例服務

    5、配置ceph.conf

       [client.rgw.rgw2]

        host = node3

        rgw frontends = "civetweb port=80"

        rgw_zone=us-west

    6、搭建radosgw

     見https://my.oschina.net/u/2326998/blog/838611

 

四、驗證zone之間數據同步

     1、在secondary zone節點執行

        radosgw-admin sync status

              realm 89daf245-1a59-44d4-b3f9-d8b141dfb226 (movies)

      zonegroup 398ed754-1d07-497d-ad35-84ec99c36f21 (us)

           zone b5752408-e416-4b9c-919e-924d624ea290 (us-west)

  metadata sync syncing

                full sync: 0/4 shards

                metadata is caught up with master

                incremental sync: 4/4 shards

      data sync source: 73dbf160-d57d-41b5-9870-97fe7e7e7c1a (us-east)

                        syncing

                        full sync: 0/8 shards

                        incremental sync: 8/8 shards

                        data is caught up with source

  

  可以看到數據和元數據都已同步

   2、在master zone節點上創建用戶

      radosgw-admin user create --uid="testuser" --display-name="First User"

   3、  用s3客戶端 創建桶,並put 對象

**注意 在secondary zone節點上也要創建相同的用戶纔會看到創建的桶,和上傳的對象**。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章