Oracle Data Guard(四)Oracle Active Data Guard支持Oracle分片

一、Oracle Active Data Guard支持Oracle分片

  oracle sharding允許您跨多個獨立的Oracle數據庫水平分區數據,並將數據庫連接請求路由到包含適當數據的數據庫。Oracle Data Guard和Oracle Sharding是集成的技術。
  分片將數據分割成多個不共享任何物理資源的獨立數據庫(shard)。分片通常與數據複製相結合,如Oracle data Guard提供的數據複製。Oracle Data Guard提供整個Oracle數據庫的快速單主機複製。在Oracle Data Guard配置中,有一個可更新的主數據庫和一個或多個備用數據庫,這些數據庫可以打開進行只讀訪問。複製可以提高分片數據庫的性能和可擴展性,並提供高可用性和災難恢復。分片數據庫中的複製拓撲是使用GDSCTL create shardcatalog命令上的-repl選項指定的。默認的複製拓撲是Oracle Data Guard。
  Oracle分片支持兩種分片方法:系統管理和複合。分片方法是用GDSCTL命令createshardcatalog指定的。
  屬於一個shardgroup的shard通常位於同一個數據中心。整個shardgroup可以完全複製到相同或不同數據中心中的一個或多個shardgroup。

1.1 系統管理的分片

  在系統管理的分片中,複製的邏輯單元是一組稱爲分片組的分片。在系統管理的分片中,分片組包含存儲在分片數據庫中的所有數據。通過使用一致性哈希(一致性哈希是可伸縮分佈式系統中常用的分區策略)進行分區,將數據自動分佈在各個碎片上。分區算法將數據均勻且隨機地分佈在各個分片上。下圖說明了如何將Oracle Data Guard複製與系統管理的分片一起使用。有一個主要的碎片組-碎片組1和兩個備用碎片組-碎片組2和碎片組3。
在這裏插入圖片描述
  碎片組1由Oracle Data Guard主數據庫(碎片1、2、3)組成。碎片組2由本地備用數據庫(碎片4、5、6)組成,它們位於同一數據中心中,並配置用於同步複製。Shardgroup 3由位於不同數據中心並配置用於異步複製的遠程備用數據庫(碎片7、8、9)組成。默認複製拓撲爲Oracle Data Guard。要以只讀模式在配置中打開每個備用數據庫,必須啓用Oracle Active Data Guard。這是使用-deploy_as ACTIVE_STANDBYGDSCTL add shardgroup命令上的選項完成的。

  上圖中顯示的分片數據庫由三組複製的分片組成:{1,4,7},{2,5,8}和{3,6,9}。每組複製的分片均作爲啓用了快速啓動故障轉移的Oracle Data Guard代理配置進行管理。

  要部署複製只需要指定分片組的屬性(區域,角色等)並將分片添加到其中即可。Oracle分片會自動配置Oracle Data Guard,併爲每組複製的分片啓動快速啓動故障轉移觀察器。它還提供只讀工作負載,基於角色的全局服務以及複製滯後和基於位置的路由的負載平衡。

  要部署上圖所示的配置,請執行以下GDSCTL命令:

CREATE SHARDCATALOG –database host00:1521:shardcat –region dc1, dc2

ADD GSM -gsm gsm1 -listener 1571 –catalog host00:1521:shardcat –region dc1
ADD GSM -gsm gsm2 -listener 1571 –catalog host00:1521:shardcat –region dc2

ADD SHARDGROUP -shardgroup shardgroup1 -region dc1 -deploy_as primary 
ADD SHARDGROUP -shardgroup shardgroup2 -region dc1 -deploy_as standby 
ADD SHARDGROUP -shardgroup shardgroup3 -region dc2 -deploy_as standby 

CREATE SHARD -shardgroup shardgroup1 -destination host01 -credential oracle_cred  -netparamfile /home/oracle/netca_dbhome.rsp 
CREATE SHARD -shardgroup shardgroup1 -destination host02 -credential oracle_cred  -netparamfile /home/oracle/netca_dbhome.rsp 
CREATE SHARD -shardgroup shardgroup1 -destination host03 -credential oracle_cred  -netparamfile /home/oracle/netca_dbhome.rsp 
……
CREATE SHARD -shardgroup shardgroup3  -destination host09 -credential oracle_cred -netparamfile /home/oracle/netca_dbhome.rsp 
DEPLOY

1.2 複合分片

  複合分片結合了系統管理的分片和用戶管理的分片的功能。在複合分片中,複製的邏輯單元是稱爲分片組的一組分片(與系統管理的分片一樣)。同樣在複合分片中,分片數據庫由多個分片空間組成(如在用戶管理的分片中一樣),但是,每個分片空間(而不是複製的分片)都包含複製的分片組,如下圖所示。
在這裏插入圖片描述
要部署上圖所示的配置,請執行以下GDSCTL命令:

CREATE SHARDCATALOG -sharding composite –database host00:1521:cat –region dc1, dc2, dc3

ADD GSM -gsm gsm1 -listener 1571 –catalog host00:1521:cat –region dc1
ADD GSM -gsm gsm2 -listener 1571 –catalog host00:1521:cat –region dc2
ADD GSM -gsm gsm3 -listener 1571 –catalog host00:1521:cat –region dc3

ADD SHARDSPACE -shardspace shardspace_a 
ADD SHARDSPACE -shardspace shardspace_b

ADD SHARDGROUP -shardgroup shardgroup_a1 –shardspace shardspace_a -region dc1 
-deploy_as primary 
ADD SHARDGROUP -shardgroup shardgroup_a2 –shardspace shardspace_a -region dc1     -deploy_as standby 			
ADD SHARDGROUP -shardgroup shardgroup_a3 –shardspace shardspace_a -region dc3     -deploy_as standby 
ADD SHARDGROUP -shardgroup shardgroup_b1 –shardspace shardspace_a -region dc1 
-deploy_as primary 
ADD SHARDGROUP -shardgroup shardgroup_b2 –shardspace shardspace_a -region dc1     -deploy_as standby 			
ADD SHARDGROUP -shardgroup shardgroup_b3 –shardspace shardspace_a -region dc2     -deploy_as standby 

CREATE SHARD -shardgroup shardgroup_a1 -destination host01 –credential orcl_cred  -netparamfile /home/oracle/netca_dbhome.rsp 
……
CREATE SHARD -shardgroup shardgroup_b3 -destination host09 -credential orcl_cred      -netparamfile /home/oracle/netca_dbhome.rsp 

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