2007年08月28日

9i RAC 筆記(1)

Oracle RAC 檔案系統簡介

raw:9i/10g/11g支援
在一般檔案系統中存在著所謂 buffer cache 來提高 IO 處理效率,當使用者存取硬碟資料時,會先將資料放入此暫存空間,再提供 user process 進行讀取 / 寫入。這樣的 IO 過程對一般資料存取時或許是不錯的方式,但是在資料庫的存取應用下,反而會成為一個 IO 瓶頸。
因為 Oracle 本身已經提供了 SGA 負責資料暫存管理,因此這樣的架構下會產生所謂的 double buffering 。況且針對資料存取處理上, Oracle 記憶體中提供的資料暫存演算法肯定比 OS 所提供的資料暫存處理方式來的有效率。
簡單來說,如果我們要讀取一個表格中的某個 block ,他必須先從 disk 讀取後存放在檔案系統中 buffer cache 後,再複製到屬於 Oracle 的 DB buffer cache 內進行屬於真正資料庫所需的資料操作。寫入資料的時候,也必須要先從 Oracle data buffer 寫入檔案系統 cache buffer ,然後再批次寫入 disk 。在大量處理資料時,整個系統的資源可能因為多餘的資料搬移而因此消耗殆盡。
因此,在 IO 效能考慮下,在建置資料庫系統時,可選擇使用 raw device 來 bypass file system cache buffer ,但在 raw device 上進行管理是相對的不方便,因為os無法直接操作到 raw 裏面的資料,而是要由 oracle 的操作介面來處理,為加管理上面的難度。

asm:10g/11g支援
簡 單的說可視為raw的加強版,之前的raw裏的檔案操作都要經過SQL語法來能才能操作。所以asm就提供了像os的操作指令,可讓os人員進行簡單的操作、查看檔案大小。並且也提供了像  raid 的功能,可用多棵分割區來加強資料的安全性,online增加空間,加入新的分割區後會自動把空間平均打散到每個分割區上;dba管理者也可不必指定 datafile放那裏,設定什名字,刪除tablespace時要注意實体檔案是否真忘了刪除等等這些好處。

ocfs1/2:9iR2/10g/11g支援
是一個clusteraware 的文件架構,在每個RAC node上都有 instance運行,並通過網絡通信+lock的機制,確保不同的node對同一個存儲區域的讀寫是在控制下進行並且所有的node通過 ocfs2 instance知道誰寫了/誰讀了。
ps:9i並不是全部的版本都有支援,也可使用協力廠商的cluster file system來取代



lvm1/2: (Logical Volume Mamager)
以前linux單一分割區給於初始大小後,將無法再調整,只有刪除再進行分割,這對於24x7的企業環境來說停止運作就是金錢的損失,所以在kernel 2.4之後就支援lvm的格式,可動態的調整每個partition的大小。

而1跟2代的差別(完整內容請看 http://www.tldp.org/HOWTO/LVM-HOWTO/lvm2faq.html#AEN338)
* For 2.4 based kernels, the maximum LV size is 2TB. For some older kernels, however, the limit was 1TB due to signedness problems in the block layer. Red Hat Enterprise Linux 3 Update 5 has fixes to allow the full 2TB LVs. Consult your distribution for more information in this regard.
* For 32-bit CPUs on 2.6 kernels, the maximum LV size is 16TB.
* For 64-bit CPUs on 2.6 kernels, the maximum LV size is 8EB. (Yes, that is a very large number.)

redhat gfs :
redhat 推出的cluster file system 的文件架構
http://www.redhat.com/magazine/008jun05/features/gfs_nfs/ (GFS VS NFS)
https://www.redhat.com/mailman/listinfo/linux-cluster (GFS maillist)

cluster file system簡介:
主要需求是要做到檔案共享給多台機器使用,而能正確的處理同時間對檔案的讀寫不會發生損壞的架構。在這個原理之下你是採用那種檔案格式為何就不重要了,只要廠商能設計出符合這個原理的廠品就可了。我查到的廠品有(更多的資訊就請自行上google尋找了)
Oracle Cluster file system, OCFS
IBM General Parallel File System (GPFS).
Veritas cluster file system. VxCFS
OSCP-Certified NAS Network File System (NFS)
Red Hat Global File System (GFS)
HP  Unified Cluster Portfolio
Microsoft Cluster Service (MSCS)






rac建置的選擇
原則就只有一個,datafile只有一組,而前端多個node都要能讀的到,並且寫入時不會讓檔案損壞的情況發生
oracle自已提出的解決方案如下:(下列每個模組都可由第三方協力廠商提出替代方案,只要能符合RAC的需求就可)
9i就只有raw格式可選擇
10g中就可選 raw + asm 、ocfs1/2 + asm

為何oracle會推出ocfs這個規格?
在未推出時,cliter file system要由協力廠商協助處理,這個對客戶的建置成本會增加,所以oracle就推出自家的cliter file system的架構,在ocfs2的支援格式就可支援非oracle格式的檔案,也就是可發一般檔案在上面,但網友測試的效能並不好佳,所以很少人會用於 正式環境中
ps:linux kernerl 2.6 已有內建支援了,所以可以直接操作裏面的檔案
ocfs2還是一個處於開發初始階段的系統,雖然名字有一個2,但實際上是第一版支持general purpose的集群文件系統。

 
redhat gfs/oracle ocfs2比較
他們的功用都是讓多個節點訪問共享存儲的同一個位置,他們通過普通網絡建立不同節點上文件系統緩存的同步機制,通過集群鎖,解決多個節點的不同應用程式操作同一個文件產生的競爭關係從可能破壞文件的可能性,通過普通網絡交換節點之間的心跳狀態. 這是功能上的類似。從成熟度,性能來考慮,目前ocfs2還遠不能和gfs相提並論,能夠用ocfs2的地方都可以用gfs來替代,但是反之就不行,網路上多半不採用ocfs2。

ASM(10g力推)
是Oracle 在 linux, HP-UX, Solaris 等多個商用高端Unix平台採用的新一代存儲管理系統,在Oracle公司的產品地位,開發的投入,用戶範圍,適用的層次和領域都是ocfs2項目無法比的.
ASM在功能上,相當於 RAW+LVM. 在數據量和訪問量的線性增長關係上,表現也很出色,在實際的真實測試環境中,ASM的性能基本接近 RAW, 因為還有Volume 開銷,所以性能上有一點點地開銷,也是很容易理解的. 


RAC (Real Application Cluster)
1、什是arc?
主要用於高要求的環境,他的優點是在於可不斷的增加node,所以可以不需要一直買更強大的機器,只要不斷的掛上新的機器就可做到效能增加、分 流、備援,而達到24x7的要求。但他沒有對於datafile做到保護,因為每個node都是使用相同的datafile。ps: 也代表一個instance只對應一組datafile,但datafile可被多個instance管理,這個關念很重要,要留意

2、訴求
1、低建置成本:可由多台低價位的pc達到單一台高價位機器的效能
2、擴充容易:在規劃良好的情況跟有支援的平台下可不必停止,直接online增加node
3、高可使用性:當其中一個node掛點時,oracle自動接手處理,不會讓session中斷(9i中我只有看到支援一些情況,後面再補充)
4、透明(transparency): 對ap 程式來說,並沒有什不同,原本的ap程式不必修改就可享用到rac的好處
5、 快取管理: 可利用每台機器上的cache而進而減少i/o的動作。在rac上面有一個Global Cache Servic(GCS)來負責優化每台機器上的cache,而Global Enqueue Service(GES)來負責做每台機器上的cache的同步。
6、Row locking: orac保證不會在row(每一筆資料)會變動時,上面的block會被lock中,只會有row lock的層次的lock
7、一致性的讀取: oracle保證不會在讀取資料當時”點”不會有資料寫入那個block,在寫入那個block那個時間”點”不會有被讀出。好處有二點:
  •     、讀取資料時不必等,因為有確保讀那個block時,決不會同時發生寫入的情況
  •     、快照(Snapshot view)永遠不會有發生不同步的情況發生
8、支援rman備份,所以也不必學習新的備份方法,但有一點要小心,就是archive log file是存放在每個node上面

3、Overview of cluster Database System Components
RAC1

 

1、由這張圖可知道一個cluster由一個以上的node組成,而每台node上面的instance負責連結的東東,我們可稱為interconnect。而interconnect簡單的說,就是在每個node上面負責同步、分享每台node的資源等等。
2、The High-Speed IPC Interconnect (這裏就不翻成中文了,直接看英文應該較容易了解)
The high-speed interprocess communication (IPC) interconnect is a high-bandwidth, low latency communication facility that links the nodes in the cluster. The interconnect routes messages and other cluster communications traffic to coordinate each node's access to resources.

You can use Ethernet, a Fiber Distributed Data Interface (FDDI), or other proprietary hardware for your interconnect. Also consider installing a backup interconnect in case your primary interconnect fails. The backup interconnect enhances high availability and reduces the likelihood of the interconnect becoming a single point-of-failure.

Real Application Clusters supports user-mode and memory-mapped IPCs. These types of IPCs substantially reduce CPU consumption and IPC latency.


interprocess communication (IPC)
A high-speed operating system-dependent transport component. The IPC transfers messages between instances on different nodes

Fiber Distributed Data Interface (FDDI)
A standard of the American National Standards Institute (ANSI) for a 100 Mb per second local area network architecture. The underlying medium is often optical fiber and the topology is a dual-attached, counter-rotating token ring.
Fibre Channel

The generic term for a high speed serial data transfer architecture recently standardized by the American National Standards Institute (ANSI). The Fibre Channel architecture was developed by the Fibre Channel Industry Association (FCIA), a consortium of computer and mass storage manufacturers. The best-known Fibre Channel standard is the Fibre Channel Arbitrated Loop (FC-AL). (See also: Storage Area Network (SAN).

 


4、有關Shared Disk
 Rac中的每個node都有辦法讀取到shared disk,不然instance將無法取得datafile裏的資料,而你可使用cluster file system或用raw device來建置
   
5、software的架構
1、系統面
rac程式使用  operating system-dependent(OSD) clusterware 讓每台node上面的cluster執行緒知道發布的指令,如 instance startup和shutdown






Posted by my_work at 樂多Roodo! │00:32 │回應(0)引用(0)DB
樂多分類:網路/3C 共同主題:Oracle 工具:編輯本文
Ads by Roodo! 

引用URL

http://cgi.blog.roodo.com/trackback/4031967