Zookeeper Personal understanding

Source: Internet
Author: User
Tags zookeeper

1

2

2 installation

Stand-alone mode

Unzip, bin/zkserver.sh

Configuration file change Conf/zoo_sample.cfg to Conf/zoo.cfg

Ticktime Heartbeat

Dtatdir Data and log paths

Clientprot Port

3 cluster mode

Besides changing the top three, there's a

Initlimit:follower the number of time heartbeats that the server returns to the primary node, such as

Ticktime=2000,initlimit=5, if 2000*5=10000=10s doesn't return, the connection fails.

Synclimit: Request to answer the number of heartbeats, similar to the Initlimit calculation

Server.a=b:c:d

A machine number

b IP

C Lead and machine interaction ports

D election lead hung up after the lead communication with

And then:

Myid File Store A (service name), read at startup to determine exactly which server, path is DataDir

myID which machine will be the name of the store

4 Pseudo-Cluster mode

The same machine achieves its purpose by configuring different ports

3

Package com.zookeeper.example;
Import java.util.ArrayList;

Import java.util.List;

Import Com.sun.org.apache.bcel.internal.generic.NEW;

Import sun.security.krb5.internal.NetClient;
	public class Zookeepersam {int num=20;} class zookeeper{int num;
	int searchnum;
	int indexnum;
	String leadstate;
	CGI CGI;
	Leadservicemechine Leadservicemechine;
	Bakleadservicemechine Bakleadservicemechine;
			public void Changeleadservice () {if (leadstate== "down") {Startleadservice (bakleadservicemechine);
		Changecginetandadd (CGI); }} public void Startleadservice (service service) {} public void Changecginetandadd (CGI cgi) {} public void
		Run () {Buildznode ("a");
		GetChildren ("a");
		Getchildrenlist ();
		if (Judgechange ()!=null) {}} public void Buildznode (String str) {Znode Znode = new Znode (str);
	Nodes.Add (Znode);
	} list<znode> nodes = new arraylist<znode> (); public void GetChildren (String name) {} public void Getchildrenlist () {} pUblic Znode Judgechange () {return null;
	}} class Znode{public Znode () {} public Znode (String s) {}} class cgi{} class service{net net;
Address address; } class net{} class address{} class Leadservicemechine extends service{} class Bakleadservicemechine extends Serv
	ice{} class servicemechine{String state;//5/15//state can toggle Zookeeper Zookeeper; public void Deal () {if (state== "index") {} if ("Search" ==state) {}}} class nameservice{} class Statesy ncservice{} class clustermanager{} class configuremanager{}


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.