Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure main loop in CTDB

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to configure main loop in CTDB". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

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

Force_electionelection_handler

Rec = self ctdb = rec- > ctdb

Pnn = = self out

Ctdb_election_win

States

Longest running

Biggest pnn

Release recover lock file

Let recmaster = that

# 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

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

1 1 / var/run/ctdb/ctdbd.socket 2

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

Ctdb_takeover_run

Allocate memory for ipalloc_state, including an array of each node

Ip allocation algorithm filled with ipalloc_state

Populate the ipalloc_state NoIPFailback parameter locally-this is a true cluster-wide configuration, and only master uses this value

Fetch the NoIPTakeover and NoIPHostOnAllDisabled of all connected nodes-this action is performed separately, so it can be forged during unit testing

NoIPTakover populated with ipalloc_state

Populate the NoIPHost of ipalloc_state to derive nodes flags and NoIPHostOnAllDisabled

Retrieve and populate the list of IP known and available to ipalloc_state

If no IP address is available, exit early

Build list (known IPs, currently specified node)

Populate the node list to force rebalancing-there is currently no way to obtain the internal structure, only nodes with new IP addresses have been added using the LCP2 algorithm

Run the IP allocation algorithm

Send RELEASE_IP to all nodes to cancel undeserved ips

Configurations that send TAKE_IP to all nodes should have ips

Send IPREALLOCATED all nodes (backward compatible hack)

Ipalloc_state_init

Three algorithms ipalloc_lcp2 = = > default

Ipalloc_deterministic = > pnn= I% numnodes ipalloc_nondeterministic = = > min is based on pnn=0 and polls existing ip

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report