溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

CTDB中main loop怎么配置

發(fā)布時(shí)間:2022-01-05 09:15:02 來(lái)源:億速云 閱讀:150 作者:iii 欄目:云計(jì)算

本篇內(nèi)容介紹了“CTDB中main loop怎么配置”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

main_loop

kill -o daemon is still running
ping local daemon
if election_timeout out
get debug_level
get relevant tunables
get runstate
get recovery lock file from the server
get nodemap
flags
if self_ban
if stop banned frozen
Retrieve capabilities from all connected nodes
validate_recovery_master --> force_election
verify ip public ip {

ips.pnn == self && dont have ip
ips.pnn != self && have ip
} tell recmaster takeover_run


down here only run with recmaster
flags right
active nodes agree we are recmaster --> force_election get vnnmap
need recovery --> do_recovery
verify all active nodes not in recover mode --> do_recovery
hold recovery lock --> do_recovery
get remote_nodemaps --> do_recovery
num_lmasters
vnnmap->size != num_lmasters --> do_recovery
nodemap node also in vnnmap --> do_recovery
all nodes have same vnnmap
if need_takeover_run do_takeover_run


<span id="force_election"></span>

force_election

election_handler

rec = self ctdb = rec->ctdb
pnn == self out

ctdb_election_win

states
longest running
biggest pnn

release recover lock file
let recmaster = that


<h2 id="do_recovery"></h2> # do_recovery > we are rec > need_recovery = true > begin > self_ban > recover_lock_file F_SETLK 為 F_WRLCK > get list of all databases dbmap > create missing local db > create missing remote db > update use same lock files > [db_recovery_parallel](#db_recovery_parallel) > [do_takeover_run](#do_takeover_run) > send message reconfigured > need_recovery = false > end > wait rerecovery_timeout


<span id='db_recovery_parallel'></span>

db_recovery_parallel

envvar CTDB_RECOVERY_HELPER
dir CTDB_HELPER_BINDIR == /usr/libexec/ctdb/
file ctdb_recovery_helper
pipe libsocket
args[0] = fd[1]
args[1] = daemon.name = CTDB_SOCKET = /var/run/ctdb/ctdb.socket
args[2] = random !=1
exec /usr/libexec/ctdb/ctdb_recovery_helper
<log-fd> <output-fd> <ctdb-socket-path> <generation>
1 1 /var/run/ctdb/ctdbd.socket 2


<span id='do_takeover_run'></span>

do_takeover_run

is_in_progress done
begin
srvid = 0 pnn = -1
list_of_connected_nodes
disable takeover_runs 60s
ctdb_takeover_run
reenable takeover_runs
ok
end

<span id='ctdb_takeover_run'></span>

ctdb_takeover_run

  • 分配 ipalloc_state的內(nèi)存,包括每個(gè)節(jié)點(diǎn)數(shù)組

  • 填充 ipalloc_state的ip分配算法

  • 本地填充 ipalloc_state NoIPFailback 參數(shù)--這是一個(gè)真正的集群范圍的配置,只有master使用此值

  • 取所有連接的節(jié)點(diǎn)的 NoIPTakeover 和 NoIPHostOnAllDisabled --這各動(dòng)作是分開(kāi)執(zhí)行的,所以在單元測(cè)試過(guò)程中可以偽造

  • 填充 ipalloc_state 的 NoIPTakover

  • 填充 ipalloc_state 的 NoIPHost ,衍生出節(jié)點(diǎn) flags 和 NoIPHostOnAllDisabled

  • 檢索和填充 ipalloc_state 已知和可用的IP列表

  • 如果沒(méi)有可用IP地址,則提前退出

  • 構(gòu)建列表(已知的IPs,當(dāng)前指定的節(jié)點(diǎn))

  • 填充節(jié)點(diǎn)列表以強(qiáng)制重新平衡 - 內(nèi)部結(jié)構(gòu),目前沒(méi)有辦法獲取,只有使用LCP2算法 增加了新的IP地址的節(jié)點(diǎn)

  • 運(yùn)行IP分配算法

  • 發(fā)送 RELEASE_IP 到所有節(jié)點(diǎn)的 取消不應(yīng)有的ips

  • 發(fā)送 TAKE_IP 到所有節(jié)點(diǎn)的 配置應(yīng)有ips

  • 發(fā)送 IPREALLOCATED 所有節(jié)點(diǎn)(向后兼容的 hack )

ipalloc_state_init

三種算法 ipalloc_lcp2 ==> 默認(rèn)
ipalloc_deterministic ==> pnn = i % numnodes ipalloc_nondeterministic ==> min以pnn=0為基準(zhǔn),輪詢 已有ip<min的則可收ip

<span id='ipalloc_lcp2'></span>

ipalloc_lcp2

unassign_unsuitable_ips 不匹配的ip的pnn = -1
lcp2_init
lcp2_allocate_unassigned

^運(yùn)算 計(jì)算出從高到低不同=distance ipv4 32 + 32 + dis + 32 = 0 ~ 128 sum = ip 到其他每個(gè)ip distance平方和 minnode || mindstdsum rebalance_candidates
lcp2_failback
均衡所有l(wèi)cp2_imbalances

“CTDB中main loop怎么配置”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI