Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> ฐานข้อมูล

ทำความเข้าใจ Oracle RAC Node Weighting: คู่มือปฏิบัติจริง

บทนำ

ใน Oracle RAC Environment Instances/Servers ติดต่อกันผ่าน High-speed Interconnects บน Private Network หาก Instance Members Ping/Connect ไม่ได้ผ่าน Private Interconnect Servers ที่ Physically Up (และ DB Instances บน Server เหล่านั้น) อาจเข้าสู่สภาวะ Split-brain

Oracle Cluster (ก่อน RAC 12c Release 2) Split-brain จาก Network/Disk Issues → Node ที่มี Node Number ต่ำสุด Survive แต่ RAC 12c Release 2 เปลี่ยน Algorithm เลือก Candidate Nodes ให้ Evict เมื่อ Split-brain สร้าง Sub-clusters ขนาดเท่ากัน

บทความนี้ครอบคลุมการเปลี่ยนแปลง Node Eviction Algorithm ใน RAC 12c Release 2 ตาม Node Weighting Feature ใหม่

Node Weighting Algorithm

Node Weighting = Feature ใหม่ใน RAC 12c Release 2 พิจารณา Workload ใน Cluster ระหว่าง Fencing Split-brain → Clusterware ใช้ Rules เลือก Surviving Cohort อาจ Evict Node ที่รัน Critical Resources Feature นี้ Assign Weight ให้ Nodes บาง Node ป้องกันไม่ให้ Terminated จาก Cluster

Tag ใหม่: CSS_CRITICAL ตั้งบน Levels/Components ต่างๆ เพื่อ Mark ว่า "Critical" Cluster พยายาม Preserve ใน Failure ตอน Clusterware ตัดสินใจ Evict Node ใน Split-brain CSS_CRITICAL Tag ถูกเคารพ (ตราบใดที่ไม่มี Technical Reason ห้าม Survival - Node ต้องมี Critical Component อย่างน้อย 1 ตอน Failure) Concept: ให้ Majority of Work ยังคงทำงานได้ หากสิ่งอื่นเท่าเท่ากัน

Node-weighting Algorithm Tasks

  • Assign Weight ให้ Database Instances/Services: Set -css_critical yes กับ srvctl add database หรือ srvctl add service แก้ไขด้วย srvctl modify database และ srvctl modify service
  • Assign Weight ให้ Non ora.* Resources: ใช้ -attr CSS_CRITICAL=yes กับ crsctl add resource และ crsctl modify resource
  • Assign Weight ให้ Server: Set -css_critical yes กับ crsctl set server

ตัวอย่าง Assign Weight:

$ srvctl modify database –d  css_critical yes
$ srvctl modify service –db  -service  css_critical yes

หาไม่ได้ Assign Weight Algorithm พิจารณา:

  • Node ไหนมี Services สร้างมากที่สุด?
  • มี Singleton Services สำหรับ Instance ไหม?
  • Node เป็น Flex ASM Instance ที่ Configured ไหม?
  • มี Public Network Failure ไหม?
  • Node Type: Hub หรือ Leaf?

Test Case

2-Node Cluster ใช้ bond2 เป็น Private Interconnect

$ oifcfg getif
bond0 147.167.80.0 global public
bond2 10.168.33.32 global cluster_interconnect

$ olsnodes -s -n
node1 1 Active
node2 2 Active

$ crsctl set server css_critical yes
$ crsctl get server css_critical
CRS-5092: Current value of the server attribute CSS_CRITICAL is yes.

Stop bond2 จำลอง Communication Failure:

# ifdown bond2
$ olsnodes -s -n
node1 1 Active
node2 2 Inactive

OCSSD.trc Output แสดง Node1 มี Weight Stamp สูงกว่า Node2 → Node1 Survive

สรุป

ตั้งแต่ RAC 12c Release 2 Algorithm ใหม่ตัดสินใจ Evict/Retain Nodes ใน Split-brain:

  • Sub-clusters ขนาดต่างกัน → เหมือนเวอร์ชันก่อนหน้า
  • Sub-clusters ขนาดเท่ากัน → เปลี่ยน Logic:
    • Node Weights เท่ากัน → Sub-cluster ที่ Node Number ต่ำสุด Survive (2-Node: Node ต่ำสุด Survive)
    • Node Weights ไม่เท่ากัน → Sub-cluster ที่ Weight สูงกว่า Survive (2-Node: Node ต่ำสุด Evict เพราะ Weight ต่ำกว่า)

Server Weight-based Node Eviction ให้ Control มากขึ้นกว่า Oracle Clusterware Failure Recovery Mechanism เลือกได้ว่า Cluster Nodes ไหนควร Terminate/Evict ใน Split-brain