亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 3000 | 回復(fù): 0
打印 上一主題 下一主題

[GlusterFS] GlusterFS文檔翻譯 - Understanding AFR Translator 中文化 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2008-12-15 10:22 |只看該作者 |倒序?yàn)g覽
說(shuō)明
本人能力有限,如果翻譯過(guò)來(lái)的內(nèi)容使你產(chǎn)生疑惑,請(qǐng)見(jiàn)原始文檔:
http://www.gluster.org/docs/index.php/Understanding_AFR_Translator
AFR 提供了類似 RAID-1 的功能。AFR 跨 subvolume 地復(fù)制文件和目錄。所以,如果將4個(gè) subvolume
配置為一個(gè)AFR,那么對(duì)于每個(gè)文件或者目錄就會(huì)有4個(gè)副本。AFR 給GlusterFS
提供了HA高可用。比如說(shuō),如果一個(gè)subvolume失效了(服務(wù)器死機(jī)、網(wǎng)絡(luò)中斷等等),AFR
會(huì)保證client的請(qǐng)求被轉(zhuǎn)移到其他subvolume的副本上響應(yīng)。盡管如此,你也要讀一讀下面的 split brain
章節(jié),以更好的理解一些可能在使用中潛在的問(wèn)題。
AFR
也提供了自我修復(fù)的功能,以解決文件或目錄的副本們出現(xiàn)不一致的情況。這個(gè)機(jī)制實(shí)現(xiàn)了:當(dāng)一個(gè)節(jié)點(diǎn)或者網(wǎng)絡(luò)失效后,數(shù)據(jù)能夠被修復(fù)。在修復(fù)的過(guò)程中,文件
或者目錄會(huì)被更新到最新的版本。AFR 使用了后臺(tái)文件系統(tǒng)的擴(kuò)展屬性來(lái)跟蹤文件和目錄的版本,并以此實(shí)現(xiàn)修復(fù)功能。
配置
這是一個(gè)配置的例子,他將要把所有文件和目錄同時(shí)存放在brick1、brick2和brick3上。subvolume 可以使用別的translator(storage/posix or protocol/client)
volume afr-example
  type cluster/afr
  option replicate *:3                 #  1.3.7及以前的版本需要
  subvolumes brick1 brick2 brick3
end-volume
注意: 1.3.7 以前的版本為了能夠?qū)崿F(xiàn)復(fù)制,"option replicate *html:2,*txt:1" 模式匹配功能是需要的。以后的版本將這種模式匹配功能從AFR中去除了。取而代之,會(huì)以switch.case調(diào)度器來(lái)實(shí)現(xiàn)。
read()操作將被在subvolumes之間的負(fù)載均衡中調(diào)用。舉個(gè)例子,subvolumes中有一個(gè)是本地存儲(chǔ),那么用它來(lái)處理所
與的讀操作是,效果會(huì)很好,那么在這種情況下,我們假設(shè)他是brick2,那么我們可以設(shè)置"option read-subvolume
brick2"。如果是"option read-subvolume *"
,那么將會(huì)在所有的brick中來(lái)進(jìn)行讀的調(diào)度。一個(gè)文件將總是從同一個(gè)subvolume中讀取,所以我們利用了server的caching優(yōu)勢(shì)。
修復(fù)
AFR 有修復(fù)的功能,文件和目錄的副本都有版本的記錄。AFR內(nèi)建的修復(fù)功能使用一種懶散的修復(fù)算法。懶散的修復(fù)意味著文件和目錄在他們沒(méi)有被需要的時(shí)候是不會(huì)被修復(fù)的。
擴(kuò)展屬性
為了實(shí)現(xiàn)修復(fù),AFR 使用了后臺(tái)文件系統(tǒng)的擴(kuò)展屬性來(lái)跟蹤文件和目錄的版本。所以,使用AFR translator很重要的一點(diǎn)是你要確認(rèn)你的后臺(tái)文件系統(tǒng)是否在編譯的時(shí)候加入了擴(kuò)展屬性的支持。
舉個(gè)例子:
volume afr-example
  type cluster/afr
  option replicate *:2                 # 1.3.7及以前的版本需要
  subvolumes brick1 brick2
end-volume
文件修復(fù)
現(xiàn)在,如果我們?cè)赼fr-example里創(chuàng)建了一個(gè)名為foo.txt的文件,這個(gè)文件將會(huì)被創(chuàng)建在brick1和brick2。這個(gè)文件將擁有
兩個(gè)與它所在后臺(tái)文件系統(tǒng)相關(guān)的擴(kuò)展屬性。一個(gè)是trusted.glusterfs.createtime,另一個(gè)是
trusted.glusterfs.version。trusted.glusterfs.createtime擴(kuò)展屬性包含了文件的創(chuàng)建時(shí)間
(秒),trusted.glusterfs.version是一個(gè)數(shù)字,當(dāng)文件修改時(shí),值會(huì)自動(dòng)增加。在文件關(guān)閉時(shí)觸發(fā)。
如果brick1失效,我們修改foo.txt文件,那么version就增加了,F(xiàn)在,如果brick1又恢復(fù)了,當(dāng)我們?cè)谶@個(gè)文件上
觸發(fā)open()的動(dòng)作時(shí),AFR
會(huì)檢查他的版本號(hào)是否一致。如果不一致,會(huì)用最新版本號(hào)的文件覆蓋。當(dāng)同步完成后,open()操作就會(huì)像以前一樣來(lái)訪問(wèn)這個(gè)文件了。
如果brick1失效,我們刪除了foo.txt,而且同時(shí)建立了一個(gè)同名的文件。現(xiàn)在,如果brick1又恢復(fù)了,明顯
的,brick1上的版本號(hào)會(huì)比brick2上的版本號(hào)要大,這里就用到了擴(kuò)展屬性中的文件創(chuàng)建時(shí)間來(lái)幫助決定哪一個(gè)是最新的版本。以此,我們使用創(chuàng)建時(shí)
間和版本號(hào)來(lái)決定最終正確的副本。
這個(gè)版本屬性在close()是被觸發(fā)增加其值。版本不會(huì)在write()沒(méi)有執(zhí)行完時(shí)觸發(fā)。萬(wàn)一,create()沒(méi)有觸發(fā)close(),我們也會(huì)建立一個(gè)創(chuàng)建時(shí)間的屬性值。
目錄修復(fù)
假設(shè)brick1失效了,我們刪除foo.txt文件后brick1又回復(fù)了,現(xiàn)在我們不能建立在brick2上foo.txt,但是我們可以在
brick1上刪除foo.txt。我們以這樣的方式處理也是基于對(duì)目錄,也有與文件類似的創(chuàng)建時(shí)間和版本的屬性。當(dāng)在目錄執(zhí)行l(wèi)ookup()后,我們
會(huì)比較兩個(gè)目錄的創(chuàng)建時(shí)間和版本,檢查哪個(gè)文件需要被刪除,并更新目錄各副本的版本。每次當(dāng)一個(gè)目錄或者他的subvolume中的一個(gè)被修改(一個(gè)文件
或者一個(gè)子目錄被建立、刪除),我們都會(huì)增加該目錄的版本號(hào)。
lookup()是在文件和目錄被訪問(wèn)前的一個(gè)內(nèi)核調(diào)用。在GlusterFS里,默認(rèn)的,在文件或目錄在過(guò)去的一秒鐘內(nèi)被訪問(wèn)過(guò),lookup()不會(huì)再次被觸發(fā)。
擴(kuò)展屬性,使用getfattr命令可以從后臺(tái)文件里看到(getfattr -n trusted.glusterfs.version )
修復(fù)功能的缺陷
因?yàn)樾迯?fù)機(jī)制依賴時(shí)間戳來(lái)決定哪一個(gè)subvolume有最新的文件或目錄版本,這使得在所有的節(jié)點(diǎn)保持時(shí)間同步是很重要的。一個(gè)方法是使用NTP。如果節(jié)點(diǎn)的時(shí)間不能同步,就會(huì)使得AFR工作不正常。
強(qiáng)制自我修復(fù)
通常情況下,AFR不會(huì)強(qiáng)制的修復(fù)自己,而是以懶散的方式工作。這樣,他不會(huì)自動(dòng)的去修復(fù)所有的數(shù)據(jù)差異情況。但是取而代之的,他會(huì)在文件被打開(kāi)的時(shí)候去執(zhí)行修復(fù)。因此,如果你想要手動(dòng)的達(dá)到數(shù)據(jù)副本間的移植,可以用下面的方法:
$ find /mnt/glusterfs -type f -exec head -n 1 {} \;
還有一個(gè)更快的修復(fù)方法:
$ find /mnt/glusterfs -type f -print0 | xargs -0 head -c1 >/dev/null
Split Brain(大腦分裂)
當(dāng)集群中一些數(shù)據(jù)設(shè)置不同的節(jié)點(diǎn)讀寫(xiě)時(shí)就會(huì)造成Split
brain的作用,這些節(jié)點(diǎn)都相信他們正在寫(xiě)入的是正確的、權(quán)威的數(shù)據(jù)。想象一下這種情況:有一個(gè)簡(jiǎn)單的集群兩個(gè)server A &
B,兩個(gè)client Foo & Bar。如果這個(gè)集群的網(wǎng)絡(luò)突然被阻斷隔離了,F(xiàn)oo只能看到server
A,Bar只能看到server B,這就成了Split
brain的情形。這會(huì)導(dǎo)致當(dāng)數(shù)據(jù)寫(xiě)入ServerA和ServerB時(shí)不再一致。當(dāng)網(wǎng)絡(luò)恢復(fù)以后,在每一個(gè)節(jié)點(diǎn)上文件或者目錄都會(huì)被嘗試恢復(fù)到最高的版
本號(hào),這會(huì)最終導(dǎo)致數(shù)據(jù)可能有效,也可能無(wú)效。同樣,如果一個(gè)文件或者目錄在節(jié)點(diǎn)被分割的情況下,寫(xiě)入了同樣多的次數(shù),那么他在各自節(jié)點(diǎn)上的版本也會(huì)同
樣,這會(huì)使得它不會(huì)接受任何修復(fù)操作,從而使得每個(gè)subvolume上的數(shù)據(jù)變得不可治愈了。
這里有一些其它的情況會(huì)導(dǎo)致AFR發(fā)生'split
brain'的癥狀,盡管沒(méi)有遇到任何網(wǎng)絡(luò)或者節(jié)點(diǎn)失效。通常情況下,沒(méi)有一種機(jī)制能夠保證每一個(gè)AFR的subvolume按同樣的順序處理從
client過(guò)來(lái)的操作。這就可能導(dǎo)致兩個(gè)不同的寫(xiě)入端,同時(shí)寫(xiě)入同一個(gè)文件的同一部分,但是可以成功的以不同順序在不同subvolume上寫(xiě)入。這潛
在的能夠?qū)е虏煌砩系耐粋(gè)文件不一致。GlusterFS v1.5的版本將會(huì)關(guān)注這個(gè)現(xiàn)象。
已經(jīng)存在的數(shù)據(jù)
當(dāng)你想要把已有數(shù)據(jù),并且已經(jīng)鏡像的兩個(gè)subvolume進(jìn)行變更至AFR時(shí),會(huì)遇到這樣的問(wèn)題。無(wú)論如何,不建議。要知道更多的信息,請(qǐng)看:(
http://www.gluster.org/docs/index.php/AFR_with_Existing_Data
)
例子
一個(gè)Brick和一個(gè)Mirror
Master Brick:
### Export volume "brick" with the contents of "/home/export" directory.
volume brick
  type storage/posix                   # POSIX FS translator
  option directory /home/export        # Export this directory
end-volume
volume server
  type protocol/server
  subvolumes brick
  option transport-type tcp/server     # For TCP/IP transport
  option auth.ip.brick.allow *         # access to "brick" volume
end-volume
Mirror Brick:
### Export volume "brick" with the contents of "/home/mirror-export" directory.
volume brick
  type storage/posix                   # POSIX FS translator
  option directory /home/mirror-export # Export this directory
end-volume
volume server
  type protocol/server
  subvolumes brick
  option transport-type tcp/server     # For TCP/IP transport
  option auth.ip.brick.allow *         # access to "brick" volume
end-volume
Client:
volume brick
  type protocol/client
  option transport-type tcp/client     # for TCP/IP transport
  option remote-host 192.168.1.10      # IP address of the remote brick
  option remote-subvolume brick        # name of the remote volume
end-volume
volume brick-afr
  type protocol/client
  option transport-type tcp/client     # for TCP/IP transport
  option remote-host 192.168.1.11      # IP address of the remote brick
  option remote-subvolume brick        # name of the remote volume
end-volume
### 添加AFR給brick
volume afr
  type cluster/afr
  option replicate *:2                 # required for rev
Clustered Mode
Two bricks clustered file system with AFR'ing each other. (the files are the same except for the commented IP address)
Brick 1:
### Export volume "brick" with the contents of "/home/export" directory.
volume brick
  type storage/posix                   # POSIX FS translator
  option directory /home/export        # Export this directory
end-volume
### Export volume "brick-afr" with the contents of "/home/afr-export" directory.
volume brick-afr
  type storage/posix                   # POSIX FS translator
  option directory /home/afr-export    # Export this directory
end-volume
volume brick-ns
type storage/posix
option directory /home/namespace
end-volume

### Add network serving capability to above brick.
volume server
  type protocol/server
  subvolumes brick brick-afr brick-ns
  option transport-type tcp/server     # For TCP/IP transport
  option auth.ip.brick.allow *         # access to "brick" volume
  option auth.ip.brick-afr.allow *     # access to "brick" volume
  option auth.ip.brick-ns.allow *     # access to "brick" volume
end-volume
Brick 2:
### Export volume "brick" with the contents of "/home/export" directory.
volume brick
  type storage/posix                   # POSIX FS translator
  option directory /home/export        # Export this directory
end-volume
### Export volume "brick-afr" with the contents of "/home/afr-export" directory.
volume brick-afr
  type storage/posix                   # POSIX FS translator
  option directory /home/afr-export    # Export this directory
end-volume
### Add network serving capability to above brick.
volume server
  type protocol/server
  subvolumes brick brick-afr
  option transport-type tcp/server     # For TCP/IP transport
  option auth.ip.brick.allow *         # access to "brick" volume
  option auth.ip.brick-afr.allow *     # access to "brick" volume
end-volume
Client:
### Add client feature and attach to remote subvolume of server1
volume brick1
  type protocol/client
  option transport-type tcp/client     # for TCP/IP transport
  option remote-host 192.168.1.10      # IP address of the remote brick
  option remote-subvolume brick        # name of the remote volume
end-volume
### Add client feature and attach to remote subvolume of brick1
volume brick1-afr
  type protocol/client
  option transport-type tcp/client     # for TCP/IP transport
  option remote-host 192.168.1.10      # IP address of the remote brick
  option remote-subvolume brick-afr    # name of the remote volume
end-volume
### Add client feature and attach to remote subvolume of brick2
volume brick2
  type protocol/client
  option transport-type tcp/client     # for TCP/IP transport
  option remote-host 192.168.1.11      # IP address of the remote brick
  option remote-subvolume brick        # name of the remote volume
end-volume
### Add client feature and attach to remote subvolume of server1
volume brick2-afr
  type protocol/client
  option transport-type tcp/client     # for TCP/IP transport
  option remote-host 192.168.1.11      # IP address of the remote brick
  option remote-subvolume brick-afr    # name of the remote volume
end-volume
### Add AFR feature to brick1
volume afr1
  type cluster/afr
  option replicate *:2                 # required for rev
               
               
               

本文來(lái)自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u2/88421/showart_1721432.html
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP