In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "zk cluster service startup to achieve data exchange between Leader and Follower", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "zk Cluster Edition service startup to achieve data interaction between Leader and Follower" bar!
Start-up process of cluster service
LeaderElection algorithm
Complete the acquisition of your own voting and voting algorithm
Cluster is unique. Zookeeper will first act according to its own server id (sid).
The latest zxid (lastloggedZxid) and the current server epoch (currentEpoch)
To generate an initialization vote
During initialization, each service votes for itself, and then, according to the configuration of zoo.cfg
Create the corresponding Leader election algorithm implementation
Three default algorithms (Leaderelection,AuthFastLeaderElection,FastLeaderElection) are provided in the zk configuration. Specified by the electionalg attribute of zoo.cfg. FastLeaderElection is supported by default.
During the initialization phase, the network iUnix layer QuorumCnxManager needed for the election will be created, waiting for connections from other services.
@ Overridepublic synchronized void start () {if (! getView (). ContainsKey (myid)) {throw new RuntimeException ("My id" + myid + "not in the peer list");} / load database loadDataBase (); / / start service connection factory startServerCnxnFactory (); try {adminServer.start ();} catch (AdminServerException e) {LOG.warn ("Problem starting AdminServer", e) System.out.println (e);} / / start electing startLeaderElection (); startJvmPauseMonitor (); super.start ();} public synchronized void startLeaderElection () {try {if (getPeerState () = = ServerState.LOOKING) {/ / think it is leader currentVote = new Vote (myid, getLastLoggedZxid (), getCurrentEpoch ()) } catch (IOException e) {RuntimeException re = new RuntimeException (e.getMessage ()); re.setStackTrace (e.getStackTrace ()); throw re;} this.electionAlg = createElectionAlgorithm (electionType);}
Leader and Follower start the interaction process
At this point, I believe you have a deeper understanding of "zk cluster service startup to achieve data interaction between Leader and Follower". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.