- 論壇徽章:
- 0
|
說(shuō)明
本人能力有限,如果翻譯過(guò)來(lái)的內(nèi)容使你產(chǎn)生疑惑,請(qǐng)見(jiàn)原始文檔:
http://www.gluster.org/docs/index.php/GlusterFS_Translators_v1.3
性能相關(guān)的translators
當(dāng)client端和server端都加載時(shí),性能相關(guān)的translators會(huì)工作的很好。記住:'io-threads' 工作的級(jí)別要比所有性能相關(guān)的translator要低才會(huì)有預(yù)想的效果。
Read Ahead Translator (預(yù)讀)
基于預(yù)設(shè)值,read-ahead
會(huì)順序地預(yù)取一些塊。當(dāng)你的應(yīng)用忙于處理一些數(shù)據(jù)的時(shí)候,GlusterFS能夠預(yù)讀下一批等待處理的數(shù)據(jù)。這樣能夠使的讀取操作更加流暢和迅速。而且,
工作起來(lái)像一個(gè)讀的集合器一樣(read-aggregator),也就是說(shuō),將大量的、零散的讀取操作集合成少量的、大一些的讀操作,這樣,減小了網(wǎng)絡(luò)
和磁盤(pán)的負(fù)載。page-size 描述了塊的大小。page-count 描述了預(yù)讀塊的總數(shù)量。
volume readahead
type performance/read-ahead
option page-size 128kB # 256KB is the default option
option page-count 4 # 2 is default option
option force-atime-update off # default is off
subvolumes
end-volume
注意: 這個(gè)translator比較適合于應(yīng)用在IB-verbs transport環(huán)境里。在百兆和千兆以太網(wǎng)接口、沒(méi)有read-ahead的環(huán)境下,能夠達(dá)到這種連接的最高速度。
Write Behind Translator (后寫(xiě))
通常情況下,寫(xiě)操作會(huì)比讀要慢。通過(guò)使用"aggregated background write"技術(shù),write-behind
translator
相當(dāng)顯著地改善了寫(xiě)的性能。更確切地說(shuō),大量小的寫(xiě)操作被集中起來(lái),形成少量的、大一些的寫(xiě)操作,并且進(jìn)行后臺(tái)寫(xiě)處理(non-blocking)。后寫(xiě)
方式在client端上聚合了寫(xiě)操作,減小了必須傳遞的網(wǎng)絡(luò)包數(shù)量。在server端,它幫助服務(wù)器優(yōu)化寫(xiě)的磁盤(pán)尋道時(shí)間。
aggregate-size
該選項(xiàng)決定了在匯聚寫(xiě)操作之前塊的大小。參照你的連接速度、RAM的大小,以及工作負(fù)載情況,你可以調(diào)整這個(gè)值。默認(rèn)的,該值為128KB,能夠比較好的
滿足大多數(shù)應(yīng)用情況。無(wú)限制的增加和減小這個(gè)值可能會(huì)帶來(lái)性能上的降低。你可以逐漸調(diào)整和分析,慢慢找出一個(gè)最優(yōu)化的結(jié)果。
flush-behind 該選項(xiàng)也同樣是為了提升處理大量小文件的性能。在這個(gè)選項(xiàng)里close()/flush()能夠被堆到后臺(tái),允許客戶端去處理下一個(gè)請(qǐng)求。默認(rèn)值是off。
volume writebehind
type performance/write-behind
option aggregate-size 1MB # default is 0bytes
option flush-behind on # default is 'off'
subvolumes
end-volume
注意: 通常情況下,protocol translator對(duì)于一個(gè)請(qǐng)求或者轉(zhuǎn)發(fā)的數(shù)據(jù)包有一個(gè)4MB的上限。因此,如果你在client端用了上面的write-behind(大多數(shù)會(huì)如此),并且aggregate-size大于4MB,他也不會(huì)發(fā)出大的數(shù)據(jù)包。
Threaded I/O Translator
AIO增加了異步(后臺(tái))讀寫(xiě)的功能。通過(guò)加載這個(gè)translator,你可以利用server的空閑時(shí)間去處理新的任務(wù)。當(dāng)server在
DMA方式處理讀或者寫(xiě)操作的時(shí)候,CPU、內(nèi)存或者網(wǎng)絡(luò)并沒(méi)有被使用。這個(gè)translator可以將資源更好的利用起來(lái)去處理和增加當(dāng)前的I/O性
能。
volume iothreads
type performance/io-threads
option thread-count 4 # deault is 1
option cache-size 32MB #64MB
subvolumes
end-volume
注意:
io-threads translator 只有在unify之上或者在Server protocol之下才會(huì)有效果。如果在unify和namespace brick之間,因?yàn)闆](méi)有文件io的處理,所以不會(huì)有效果。
'thread-count'小于或等于你的CPU數(shù)量。
IO-Cache Translator
IO-Cache translator 如果在client端被加載,能夠幫助減小server的負(fù)載(如果client正在讀一些文件,而且這個(gè)文件在兩次讀操作期間沒(méi)有被修改)。舉個(gè)例子,在編譯內(nèi)核時(shí)所需要訪問(wèn)的頭文件。
volume io-cache
type performance/io-cache
option cache-size 64MB # default is 32MB
option page-size 1MB #128KB is default option
option priority *.h:3,*.html:2,*:1 # default is '*:0'
option force-revalidate-timeout 2 # default is 1
subvolumes
end-volume
Booster Translator
同樣的,GlusterFS是一個(gè)userspace文件系統(tǒng),它使用FUSE模塊去get the fops,許多使用者會(huì)問(wèn)"難道沒(méi)有一種方法能夠消除使用fuse這種上層結(jié)構(gòu)嗎?"。
盡管使用FUSE作為上層的理由很小,就像網(wǎng)絡(luò)的上層結(jié)構(gòu),但是,他對(duì)處理大的文件I/O會(huì)很有幫助。因此Gluster團(tuán)隊(duì)提供了Booster
translator作為處理文件I/O的一種方法。使用booster
translator,可以帶來(lái)更高的吞吐。它能夠在client或者server端被加載。
注意: booster translator需要預(yù)先加載"glusterfs-booster.so".
volume booster
type performance/booster
# option transport-type tcp # Default is 'unix', which is only used when booster is loaded on client side.
# when used on server side, it does take all the options of client protocol and server protocol.
subvolumes
end-volume
注意: 通常情況下,這個(gè)沒(méi)有考慮過(guò)小文件,一旦我們使用booster測(cè)試了,我們會(huì)推薦應(yīng)用在這種場(chǎng)景里。
集群\聚合相關(guān)的Translators
Automatic File Replication Translator (AFR)
AFR
提供了與RAID-1相似的功能。AFR將文件和目錄進(jìn)行復(fù)制,存放到subvolume里。所以,如果AFR有4個(gè)subvolume,他就會(huì)把文件和
目錄復(fù)制4份。AFR提供了HA高可用。當(dāng)一個(gè)subvolume失效(比如,服務(wù)器宕機(jī)、網(wǎng)絡(luò)失效等),AFR會(huì)繼續(xù)服務(wù),從其他副本中響應(yīng)請(qǐng)求。
AFR同時(shí)也提供了自我恢復(fù)的功能。假設(shè)失效的AFR節(jié)點(diǎn)重新恢復(fù)了,將會(huì)從其他節(jié)點(diǎn)自動(dòng)同步到最新的數(shù)據(jù)。AFR使用擴(kuò)展特性,后臺(tái)跟蹤文件和目錄的版本已完成自我恢復(fù)功能。
注意: 以前支持的"option replicate *html:2,*txt:1" 匹配方式已經(jīng)從AFR里取消。由Unify的switch.case調(diào)度器替代。
volume afr-example
type cluster/afr
subvolumes brick1 brick2 brick3
# option debug on # turns on detailed debug messages in log by default is debugging off
# option self-heal off # turn off self healing default is on
# option read-subvolume brick2 # by default reads are scheduled from all subvolumes
end-volume
這個(gè)配置例子描述:將所有的文件和目錄在brick1、brick2、brick3上同時(shí)存放。subvolume可以是其他類(lèi)型(storage/posix or protocol/client).
注意: AFR需要在底層文件系統(tǒng)支持extended attribute。
參考 "GlusterFS文檔翻譯 - Understanding AFR Translator 中文化" 了解更多volume的配置文件和設(shè)計(jì)樣例。
Stripe Translator
striping translator根據(jù)你的設(shè)計(jì),將文件進(jìn)行條帶化處理,并存放到給定的塊大。J(rèn)是128K)的subvolumes(或者他的子節(jié)點(diǎn))上。
注意: Stripe需要在底層文件系統(tǒng)支持extended attribute。
volume stripe
type cluster/stripe
option block-size *:1MB
subvolumes brick1 brick2 brick3 brick4
end-volume
Unify Translator
Unify translator合并了多個(gè)存儲(chǔ)bricks形成一個(gè)大的快速的存儲(chǔ)空間。你可以綁定你首選的I/O調(diào)度器到unify volume。你可以有多種I/O調(diào)度器選擇,這個(gè)要看你的應(yīng)用環(huán)境。
參見(jiàn) (
http://www.gluster.org/docs/index.php/Understanding_Unify_Translator
) 了解更多有關(guān)于unify translator的信息。
volume unify
type cluster/unify
subvolumes brick1 brick2 brick3 brick4 brick5 brick6 brick7 brick8
option namespace brick-ns # should be a node which is not present in 'subvolumes'
option scheduler rr # simple round-robin scheduler
end-volume
注意:
'1.3.0-pre5'之前的版本,unify translator有一個(gè)選項(xiàng)叫'option namespace'。它可以被當(dāng)作一個(gè)empty export,它可以被重建出必要的數(shù)據(jù),就像unify也有自我恢復(fù)功能一樣。
GlusterFS Schedulers
Scheduler依靠負(fù)載、有效性和其他因素,決定了如何在聚合的文件系統(tǒng)中去分布一個(gè)新的create操作。下面是一個(gè)可供你選擇的I/O schedulers列表...
ALU Scheduler
ALU即"Adaptive Least Usage"。它是GlusterFS里最高級(jí)的調(diào)度器。他通過(guò)多個(gè)緯度的計(jì)算來(lái)負(fù)載均衡訪問(wèn)。通過(guò)配置,他會(huì)調(diào)整自己的I/O模式。當(dāng)配置適當(dāng)時(shí),它能夠在現(xiàn)有文件系統(tǒng)上發(fā)揮很好的負(fù)載均衡效果。
ALU scheduler由多種算法子調(diào)度器組成。每一個(gè)子掉調(diào)度器反映出每個(gè)subvolume的某一方面的負(fù)載情況:* disk-usage - volume的disk空間占用情況
- read-usage - volume的讀操作數(shù)量
- write-usage - volume的寫(xiě)操作數(shù)量
- open-files-usage - volume當(dāng)前打開(kāi)的文件數(shù)量
- disk-speed-usage - disk的工作速度,這個(gè)值是固定的,非常有用。
ALU scheduler需要知道以上哪些子調(diào)度器要使用,以什么樣的順序來(lái)使用。這個(gè)依賴"option alu.order"的配置。
每一個(gè)子調(diào)度器都需要知道兩件事:什么時(shí)候啟動(dòng)(the entry-threshold)?多長(zhǎng)時(shí)間去等待(the exit-threshold)?
舉個(gè)例子:當(dāng)unify了3個(gè)100GB的磁盤(pán),通過(guò)disk-usage來(lái)保持精確的平衡是沒(méi)有必要的。替代的,如果有1GB的空閑空間,要決策哪一個(gè)
來(lái)提供時(shí),就可以用到read-usage調(diào)度器。disk-usage調(diào)度器處理告訴處理在只有當(dāng)某一閾值的差異是多少時(shí)通過(guò),比如1GB。假設(shè)當(dāng)這個(gè)
條件滿足時(shí),他會(huì)將后續(xù)的數(shù)據(jù)都寫(xiě)入到最少使用的volume里。他這樣處理,當(dāng)?shù)陀趀ntry-threshold閥值是不明智的,因?yàn)檫@將非?斓卦
次發(fā)生同樣情況。這樣的情形會(huì)引起ALU過(guò)渡的消耗在disk-usage的調(diào)度上,這對(duì)其他的子調(diào)度器是不公平的。exit-threshold的原因
定義了將要被寫(xiě)入到最閑磁盤(pán)的數(shù)據(jù)總量。
除sub-schedulers之外,ALU還含有"limits"選項(xiàng)。當(dāng)小于一定的閥值時(shí),它能夠停止在volume上建立新文件的動(dòng)作。舉個(gè)例子:設(shè)置"option alu.limits.min-free-disk 5GB"將會(huì)在空間不足5GB的情況下停止對(duì)這個(gè)volume的調(diào)度。
實(shí)際的值要參照你的實(shí)際使用環(huán)境來(lái)定義。比如是否你有些文件增長(zhǎng)很迅速,你想要在快速增長(zhǎng)的文件在建立之前提早停止該文件在磁盤(pán)上的創(chuàng)建動(dòng)
作。相對(duì)于read-usage的負(fù)載均衡,如果你不是很關(guān)注disk-usage的均衡,你可以定一個(gè)大一些的disk-usage調(diào)度閥值和一個(gè)小一
些的read-usage閥值。
至于閥值的設(shè)定大小,允許設(shè)置空間大小的百分比。舉個(gè)例子:"option alu.limits.min-free-disk 5%".
volume bricks
type cluster/unify
subvolumes brick1 brick2 brick3 brick4 brick5
option alu.read-only-subvolumes brick5 # 這里把brick5設(shè)置成了只讀,新的文件將不會(huì)存進(jìn)去。
option scheduler alu # 使用ALU調(diào)度器
option alu.limits.min-free-disk 5% # 當(dāng)空間小于5%的時(shí)候不要再放新的文件。
option alu.limits.max-open-files 10000 # 當(dāng)超過(guò)10000個(gè)文件被打開(kāi)始,不要再放新的文件。
# 當(dāng)要決定把文件放到哪里時(shí),首先評(píng)估磁盤(pán)的disk-usage情況,然后是read-usage、write-usage、open files,以及最后一項(xiàng)disk-speed-usage.
option alu.order disk-usage:read-usage:write-usage:open-files-usage:disk-speed-usage
option alu.disk-usage.entry-threshold 2GB # 如果volume之間的差異超過(guò)2GB時(shí)啟動(dòng)。
option alu.disk-usage.exit-threshold 60MB # 當(dāng)差異不足1988MB時(shí)不要停止寫(xiě)入到最閑磁盤(pán)
option alu.open-files-usage.entry-threshold 1024 # 如果打開(kāi)文件的差異達(dá)到1024時(shí)啟動(dòng)
option alu.open-files-usage.exit-threshold 32 # 當(dāng)差異不足992時(shí)不要停止寫(xiě)入到最閑磁盤(pán)
# option alu.read-usage.entry-threshold 20% # 當(dāng)read-usage差異達(dá)到20%時(shí)啟動(dòng)
# option alu.read-usage.exit-threshold 4% # 當(dāng)差異增長(zhǎng)到16%(20% - 4%)不要停止
# option alu.write-usage.entry-threshold 20% # 當(dāng)write-usage差異到20%時(shí)啟動(dòng)
# option alu.write-usage.exit-threshold 4% # 當(dāng)差異增長(zhǎng)到16%時(shí)不要停止
# option alu.disk-speed-usage.entry-threshold # 不要設(shè)定這個(gè),磁盤(pán)速度是固定的!。
# option alu.disk-speed-usage.exit-threshold # 不要設(shè)定這個(gè),磁盤(pán)速度是固定的。。
option alu.stat-refresh.interval 10sec # 每10秒鐘刷新一次決策數(shù)據(jù)
# option alu.stat-refresh.num-file-create 10 # 每創(chuàng)建10個(gè)文件時(shí)刷新一次決策數(shù)據(jù)
end-volume
NUFA Scheduler
與非對(duì)稱(chēng)文件系統(tǒng)調(diào)度類(lèi)似的NUMA (
http://en.wikipedia.org/wiki/Non-Uniform_Memory_Access
) 內(nèi)存設(shè)計(jì)。它主要應(yīng)用在需要運(yùn)行文件系統(tǒng)server和client的集群的HPC高性能計(jì)算環(huán)境中。在大多數(shù)環(huán)境里,NUFA調(diào)度器使得本地文件系統(tǒng)優(yōu)先于其他節(jié)點(diǎn)執(zhí)行文件新建操作。
volume posix1
type storage/posix # POSIX FS translator
option directory /home/export # Export this directory
end-volume
volume bricks
type cluster/unify
subvolumes posix1 brick2 brick3 brick4
option scheduler nufa
option nufa.local-volume-name posix1
option nufa.limits.min-free-disk 5%
end-volume
注意: NUFA目前已經(jīng)可以支持更多的本地volume選項(xiàng)。
Random Scheduler
隨機(jī)調(diào)度器使用隨機(jī)數(shù)發(fā)生器選擇brick來(lái)創(chuàng)建文件。
volume bricks
type cluster/unify
subvolumes brick1 brick2 brick3 brick4
option scheduler random
option random.limits.min-free-disk 5%
end-volume
Round-Robin Scheduler
Round-Robin (RR)
調(diào)度器輪轉(zhuǎn)的創(chuàng)建文件。每一個(gè)client都將有它自己的RR循環(huán)。當(dāng)你的大部分文件的大小和I/O訪問(wèn)方法相近的時(shí)候,這個(gè)調(diào)度器是一個(gè)非常好的選擇。
RR調(diào)度器在調(diào)度前會(huì)檢查server的硬盤(pán)空間,所以你能夠知道什么時(shí)候應(yīng)該添加更多的brick了。默認(rèn)的,當(dāng)create操作發(fā)生時(shí),min-
free-disk的值是5%,每10秒鐘檢查一次。
volume bricks
type cluster/unify
subvolumes brick1 brick2 brick3 brick4
option scheduler rr
option rr.read-only-subvolumes brick4 # brick4只讀
option rr.limits.min-free-disk 5% # Unit in %
option rr.refresh-interval 10 # 10秒鐘檢查一次brick10s
end-volume
Switch Scheduler
Switch調(diào)度器在GlusterFS里是最后一個(gè)被加上的,他按照文件名字符串來(lái)匹配并調(diào)度。
volume bricks
type cluster/unify
subvolumes brick1 brick2 brick3 brick4 brick5 brick6 brick7
option scheduler switch
option switch.case *jpg:brick1,brick2;*mpg:brick3;*:brick4,brick5,brick6
option switch.read-only-subvolumes brick7
end-volume
上面是一個(gè)在unify環(huán)境里啟用的例子。在這里,如果文件名含有jpg的話,就會(huì)被存放到brick1和brick2,如果含有mpg的話,就會(huì)
存放到brick3,其他文件將會(huì)存放到brick4、brick5、brick6。brick7被設(shè)置為只讀的subvolume,它里面的數(shù)據(jù)只能用
來(lái)讀取。
Debug translators
用來(lái)調(diào)試文件系統(tǒng)的translators。
trace
Trace
translator是為了處理更廣泛細(xì)致的跟蹤調(diào)試信息。調(diào)試信息被寫(xiě)道GlusterFS的log文件里,該文件默認(rèn)存放在/var/log
/gluster/glusterfs.log。跟蹤調(diào)試一個(gè)volume可以被插入或置頂在任何一個(gè)你想要調(diào)試的volume里。所有的請(qǐng)求和訪問(wèn)都會(huì)
被記錄下來(lái)。
### 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
### Trace storage/posix translator.
volume trace
type debug/trace
subvolumes brick
# option include open,close,create,readdir,opendir,closedir
# option exclude lookup,read,write
end-volume
注意: 如果想要通過(guò)這個(gè)translator來(lái)跟蹤少量的幾個(gè)訪問(wèn),要使用"option include ",如果想跟蹤大多數(shù)的訪問(wèn),但也想排出一小部分,要使用"option exclude ".
擴(kuò)展功能的Translators
filter
高級(jí)過(guò)濾translator機(jī)遇文件名或者文件屬性。通常情況下它只支持只讀的export選項(xiàng)。
volume brick-readonly
type features/filter
subvolumes brick
end-volume
posix-locks
這個(gè)translator提供了storage不依賴的POSIX record locking support (fcntl
locking)。代表性的,你想要在server端加載這個(gè)translator,只需要在POSIX storage
translator之上。使用這個(gè)translator你可以獲得提示性locking和強(qiáng)制性locking的支持。
volume locks
type features/posix-locks
subvolumes brick
end-volume
注意:考慮沒(méi)有打開(kāi)強(qiáng)制性locking bits的文件(+setgid, -group
execution)。假設(shè)那個(gè)文件現(xiàn)在被具有write-behind
xlator特點(diǎn)的client端的一個(gè)操作打開(kāi)。為了避免不一致,當(dāng)一個(gè)文件激活強(qiáng)制性locking,write-behind
xlator不會(huì)緩存關(guān)于他的任何信息。假設(shè)另一個(gè)client現(xiàn)在激活了這個(gè)文件的強(qiáng)制性locking。之前的client不會(huì)知道這個(gè)更
新,write-behind可能錯(cuò)誤的報(bào)告寫(xiě)入成功,而實(shí)際上寫(xiě)的操作因?yàn)楸籰ock而失敗了。
這看起來(lái)不太容易解決。圍繞這個(gè)問(wèn)題,有個(gè)建議是你在一個(gè)文件打開(kāi)的時(shí)候不要激活強(qiáng)制位。
trash
這個(gè)translator提供了一個(gè)'libtrash'類(lèi)似的功能(或者有些人稱(chēng)之為recyclebin)。這個(gè)translator用在server端是最好的。
volume trash
type features/trash
option trash-dir /.trashcan
subvolumes brick
end-volume
fixed-id
這個(gè)translator提供了一個(gè)功能,在所有的調(diào)用通過(guò)這一層時(shí)將修改UID和GID。
volume fixed
type features/fixed-id
option fixed-uid 1000
option fixed-gid 100
subvolumes brick
end-volume
Storage translators
posix
GlusterFS依靠基于磁盤(pán)文件系統(tǒng)(比如ext2, ext3, xfs, reiserfs, etc)來(lái)執(zhí)行塊設(shè)備的管理。這個(gè)POSIX的translator將GlusterFS服務(wù)器綁定到底層的文件系統(tǒng)上。
volume posix1
type storage/posix # POSIX FS translator
option directory /home/export # Export this directory
end-volume
Berkeley DB
針對(duì)解決在一個(gè)目錄里的數(shù)百萬(wàn)或者數(shù)十億的小文件問(wèn)題,或者,這些文件沒(méi)有被存放于每一個(gè)目錄中,他們會(huì)被保存在一個(gè)內(nèi)部的數(shù)據(jù)庫(kù)文件(glusterfs-storage.db)里。這里會(huì)有一個(gè)目錄樹(shù),每個(gè)目錄有一個(gè)數(shù)據(jù)庫(kù)。這個(gè)數(shù)據(jù)庫(kù)的恢復(fù)和處理都交給BDB完成。
volume bdb
type storage/bdb
option directory /tmp/bdb-export # Export Point, also HOME for DB_ENV
#option transaction off # default is on
#option cache on # default is off
#option access-mode btree # default will be hash
option checkpoint-timeout 10 # default is 30seconds
#option file-mode 0644 # default is 0644
#option dir-mode 0755 # default is 0755
option lru-limit 200 # default is 100
#option errfile /tmp/bdberrlog # default is /dev/null?
#option logdir /tmp/dbd-logdir # default is in 'option directory '
end-volume
External Links
需要條件
- GlusterFS需要至少版本在4.7.25以上的BerkeleyDB(也可以用舊的版本,但是oracle自己建議用最新的版本,同樣GlusterFS團(tuán)隊(duì)也遇到了一些被證實(shí)不可用的老版本的問(wèn)題)
協(xié)議Translators
server
Server translator允許你在網(wǎng)絡(luò)上export一個(gè)volumes。這個(gè)translator實(shí)現(xiàn)了不同種類(lèi)的內(nèi)部連接的傳輸模塊。
### Add network serving capability to above brick.
volume server
type protocol/server
option transport-type tcp/server # 使用TCP/IP傳輸
# option transport-type ib-sdp/server # 使用Infiniband傳輸
# option transport-type ib-verbs/server # 使用Infiniband Verbs傳輸
# option ib-verbs-work-request-recv-size 1048576 # 如果read-ahead的大小高等于這個(gè)值,則性能將更高
# option ib-verbs-work-request-recv-count 16
# option ib-verbs-work-request-send-size 1048576 # 如果write-behind的大小高等于這個(gè)值,則性能將更高
# option ib-verbs-work-request-send-count 16
# option bind-address 192.168.1.10 # 默認(rèn)監(jiān)聽(tīng)所有interfaces
# option listen-port 6996 # 默認(rèn)為6996
# option client-volume-filename /etc/glusterfs/glusterfs-client.vol
subvolumes brick1 brick2
option auth.ip.brick1.allow 192.168.* # 這些IP地址允許訪問(wèn)"brick1"
option auth.ip.brick2.allow 192.168.* # 這些IP地址允許訪問(wèn)"brick2"
end-volume
對(duì)應(yīng)于server protocol可以使用這些傳輸模塊:
- tcp/server: 基于TCP/IP的互聯(lián)
- ib-sdp/server: 基于Infiniband Sockets Direct協(xié)議的傳輸接口
- ib-verbs/server: Infiniband Verbs傳輸接口
驗(yàn)證模塊
為了允許多個(gè)IP地址、子網(wǎng)的訪問(wèn),可以使用逗號(hào)來(lái)隔離,向下面一樣:
option auth.ip.brick1.allow 192.168.1.10,192.168.1.20,192.168.2.*
注意: 1.3.7以上的版本有效
為了更高一些的存儲(chǔ)數(shù)據(jù)安全考慮,而且,GlusterFS作為一個(gè)網(wǎng)絡(luò)文件系統(tǒng),很有必要在連接前驗(yàn)證client的身份。目前,GlusterFS支持驗(yàn)證模塊,他有以下兩種方式驗(yàn)證方式:
auth.ip
這個(gè)模塊基于IP地址來(lái)驗(yàn)證連接的client身份。提供的選項(xiàng)有:
option auth.ip..allow # 用逗號(hào)來(lái)分隔
這個(gè)選項(xiàng)只在protocol/server類(lèi)型的volume需要。
auth.login
這個(gè)模塊基于用戶名和密碼來(lái)驗(yàn)證
在protocol/server里的選項(xiàng)有:
option auth.login..allow # seperated by comma
option auth.login..password
在protocol/client里的選項(xiàng)有:
option username
option password
client
Client translator允許你從GlusterFS的server附加一些遠(yuǎn)程的volume。
### 增加client的功能,并附加掛載一個(gè)遠(yuǎn)程server1的subvolume
volume client1
type protocol/client
option transport-type tcp/client # 使用TCP/IP傳輸
# option transport-type ib-sdp/client # 使用Infiniband傳輸
# option transport-type ib-verbs/client # 使用Infiniband Verbs傳輸
# option ib-verbs-work-request-recv-size 1048576
# option ib-verbs-work-request-recv-count 16
# option ib-verbs-work-request-send-size 1048576
# option ib-verbs-work-request-send-count 16
option remote-host 192.168.1.10 # 遠(yuǎn)程brick的IP地址
# option remote-port 6996 # server端口默認(rèn)為6996
# option transport-timeout 30 # 每個(gè)請(qǐng)求等待server的響應(yīng)時(shí)間
option remote-subvolume brick # 遠(yuǎn)程volume的名字
end-volume
對(duì)應(yīng)于client protocol可以使用這些傳輸模塊:
- tcp/client: 基于TCP/IP的互聯(lián)
- ib-sdp/client: 基于Infiniband Sockets Direct協(xié)議的傳輸接口
- ib-verbs/client: Infiniband Verbs傳輸接口
加密Translators
rot-13
ROT-13是一個(gè)玩具translator,它用ROT-13算法來(lái)加密和解密文件內(nèi)容。ROT-13是一個(gè)非常簡(jiǎn)單的算法,他用13個(gè)位置來(lái)輪流使用字母表。例如:把A變成N,把B變成O,把Z變成M。
如果你需要一個(gè)真正的加密(新版本的GlusterFS將還有真正的加密translators),那么這種translator就不推薦了。
`encrypt-write [on|off] (on)'
是否在寫(xiě)時(shí)加密
`decrypt-read [on|off] (on)'
是否在讀時(shí)加密
例子:
volume rot-13
type encryption/rot-13
encrypt-write [on|off] (on)
decrypt-read [on|off] (on)
subvolumes brick
end-volume
Client端 Volume的配置文件樣例
這里是一個(gè)非常簡(jiǎn)單的配置文件,它使用了所有的clustering translators。你可以刪掉你不需要的,更新'subvolumes'選項(xiàng)。
volume client1
type protocol/client
option transport-type tcp/client
option remote-host 192.168.10.1
option remote-subvolume ra
end-volume
volume client2
type protocol/client
option transport-type tcp/client
option remote-host 192.168.10.2
option remote-subvolume ra
end-volume
volume client3
type protocol/client
option transport-type tcp/client
option remote-host 192.168.10.3
option remote-subvolume ra
end-volume
volume client4
type protocol/client
option transport-type tcp/client
option remote-host 192.168.10.4
option remote-subvolume ra
end-volume
volume client5
type protocol/client
option transport-type tcp/client
option remote-host 192.168.10.5
option remote-subvolume ra
end-volume
volume client6
type protocol/client
option transport-type tcp/client
option remote-host 192.168.10.6
option remote-subvolume ra
end-volume
volume client7
type protocol/client
option transport-type tcp/client
option remote-host 192.168.10.7
option remote-subvolume ra
end-volume
volume client8
type protocol/client
option transport-type tcp/client
option remote-host 192.168.10.8
option remote-subvolume ra
end-volume
volume client-ns
type protocol/client
option transport-type tcp/client
option remote-host 192.168.10.1
option remote-subvolume brick-ns
end-volume
volume stripe1
type cluster/stripe
subvolumes client1 client2
option block-size *:10KB
end-volume
volume stripe2
type cluster/stripe
subvolumes client3 client4
option block-size *:10KB
end-volume
volume stripe3
type cluster/stripe
subvolumes client5 client6
option block-size *:10KB
end-volume
volume stripe4
type cluster/stripe
subvolumes client7 client8
option block-size *:10KB,
end-volume
volume afr1
type cluster/afr
subvolumes stripe1 stripe2
option replicate *:2
end-volume
volume afr2
type cluster/afr
subvolumes stripe3 stripe4
option replicate *:2
end-volume
volume unify0
type cluster/unify
subvolumes afr1 afr2
option namespace client-ns
option scheduler rr
option rr.limits.min-disk-free 5
end-volume
volume iot
type performance/io-threads
subvolumes unify0
option thread-count 8
end-volume
volume wb
type performance/write-behind
subvolumes iot
end-volume
volume ra
type performance/read-ahead
subvolumes wb
end-volume
volume ioc
type performance/io-cache
subvolumes ra
end-volume
Server端 Volume的配置文件樣例
# Namespace posix
volume brick-ns
type storage/posix
option directory /tmp/export-ns
end-volume
volume brick
type storage/posix
option directory /tmp/export
end-volume
volume posix-locks
type features/posix-locks
option mandatory on
subvolumes brick
# subvolumes trash # 如果你需要支持trash,請(qǐng)激活這個(gè)(注意: 不建議1.3.0-pre5+版本)
end-volume
volume io-thr
type performance/io-threads
subvolumes posix-locks
end-volume
volume wb
type performance/write-behind
subvolumes io-thr
end-volume
volume ra
type performance/read-ahead
subvolumes wb
end-volume
volume server
type protocol/server
subvolumes ra brick-ns
option transport-type tcp/server
option client-volume-filename /etc/glusterfs/glusterfs-client.vol
option auth.ip.ra.allow *
option auth.ip.brick-ns.allow *
end-volume
本文來(lái)自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u2/88421/showart_1721411.html |
|