- 論壇徽章:
- 4
|
本帖最后由 happy_fish100 于 2022-08-16 11:25 編輯
FastCFS今天發(fā)布了v3.5,支持多數(shù)派數(shù)據(jù)復(fù)制,在網(wǎng)絡(luò)不穩(wěn)定或者系統(tǒng)繁忙等情況下,仍可保證數(shù)據(jù)一致性和可靠性。FastCFS v3.5從機制上保證了數(shù)據(jù)一致性,在實際使用中我們該如何進行軟硬件配置呢?
三副本既可以防leader腦裂,還可以采用多數(shù)派數(shù)據(jù)復(fù)制算法,保證數(shù)據(jù)一致性。對于訪問量較大的企業(yè),可以直接使用三副本。對于3副本或5副本等奇數(shù)副本數(shù),F(xiàn)astCFS默認(rèn)配置就是選舉過半數(shù)和數(shù)據(jù)復(fù)制過半數(shù),因此三副本情況下無需修改配置文件。fstore的cluster.conf配置片段如下:
[leader-election]
# the quorum for leader election
# set quorum to majority to avoid brain-split
# value list:
## any: no requirement
## majority: more than half
## auto: set to majority when the number of nodes is odd,
## otherwise set to any
# default value is auto
quorum = auto
[data-replication]
# the quorum for data replication
# set quorum to majority for strict data consistency and high data security
# value list:
## any: no requirement
## majority: more than half
## auto: set to majority when the number of nodes is odd,
## otherwise set to any
# default value is auto
quorum = auto
對于訪問量不大的企業(yè),出于性價比考慮,通常會使用兩副本。FastCFS v3.4實現(xiàn)了公共選舉節(jié)點,兩副本引入公共選舉節(jié)點也可實現(xiàn)選舉過半防腦裂。fstore的cluster.conf中公共選舉節(jié)點相關(guān)配置示例如下:
[leader-election]
# 其他配置項
# if enable vote node when the number of servers is even
# the default value is false
vote_node_enabled = true
# the cluster config filename of the vote node
# this parameter is valid when vote_node_enabled is true
vote_node_cluster_filename = ../vote/cluster.conf
如果存在網(wǎng)絡(luò)不穩(wěn)定或者系統(tǒng)負(fù)載高等異常情況,不采用數(shù)據(jù)復(fù)制過半數(shù)機制就無法完全保證數(shù)據(jù)一致性。針對兩副本,v3.5.1支持寫入數(shù)據(jù)過半數(shù)自適應(yīng)模式:如果兩個節(jié)點都可用,則采用過半數(shù)確認(rèn)機制,否則寫入一個節(jié)點即可。友情提示:默認(rèn)配置即支持本模式。
另外,服務(wù)停機后重啟事關(guān)數(shù)據(jù)一致性,需要給大家說明一下。以三副本為例,如果服務(wù)先后停機一段時間后重啟,需要先啟動停機時間最短的服務(wù),最后啟動停機時間最長的服務(wù),為了避免數(shù)據(jù)不一致的情況發(fā)生,啟動順序千萬不能搞反了;或者同時啟動三個節(jié)點上的服務(wù)也是可以的。注:fdir和fstore服務(wù)通過restart正常重啟是沒有問題的。
FastCFS v3.5是保證數(shù)據(jù)一致性和可靠性的一個里程碑版本,歡迎大家測試和使用。
|
|