Java 什么是zookeeper端口及其用途?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18168541/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 22:58:54  来源:igfitidea点击:

what is zookeeper port and its usage?

javaneo4jdistributed-computingapache-zookeepervoltdb

提问by agpt

I am quite new for zookeeper port through which I am coming across from past few days.
I introduced with zookeeper portkeyword at two occasion:

我对zookeeper端口很陌生,我过去几天通过它遇到。
我在两个场合引入了zookeeper port关键字:

  • while configuring neo4j db cluster (link) and
  • while running compiled voltdb catalog (link) (See Network Configuration Arguments)
  • 同时配置neo4j db集群(链接)和
  • 运行编译后的 voltdb 目录(链接)时(请参阅网络配置参数)

Then, I came across Apache Zookeeper, (which I guess is related to distributed application, I am a newbie in distributed application as well). hence question came in my mind:

然后,我遇到了Apache Zookeeper,(我猜这与分布式应用程序有关,我也是分布式应用程序的新手)。因此我想到了一个问题:

  1. is there any implementation of apache zookeeper in above 2 scenarios ?
  2. What exactly this zookeeper port do internally ?
  1. 在上述 2 个场景中是否有 apache zookeeper 的任何实现?
  2. 这个zookeeper端口到底在内部做什么?

Any help would be appreciated, Thanks.

任何帮助将不胜感激,谢谢。

采纳答案by Sandeep Das

Zookeeper is used in distributed applications mainly for configuration management and high availability operations. Zookeeper does this by a Master-Slave architecture. Neo4j and VoltDb might be using zookeeper for this purpose

Zookeeper 在分布式应用中主要用于配置管理和高可用操作。Zookeeper 通过主从架构来做到这一点。Neo4j 和 VoltDb 可能为此使用 zookeeper

Coming to the ports understanding : suppose u have 3 servers for zookeepers ... You need to mention in configuration as

进入端口理解:假设你有 3 个用于动物园管理员的服务器......你需要在配置中提到

clientPort=2181
server.1=zookeeper1:2888:3888
server.2=zookeeper2:2888:3888
server.3=zookeeper3:2888:3888

Out of these one server will be the master and rest all will be slaves.If any server goes OFF then zookeeper elects leader automatically .

其中一台服务器将是主服务器,其余服务器都是从服务器。如果任何服务器关闭,那么zookeeper 会自动选举领导者。

Servers listen on three ports: 2181 for client connections; 2888 for follower connections, if they are the leader; and 3888 for other server connections during the leader election phase .

服务器监听三个端口:2181 用于客户端连接;2888 用于追随者连接,如果他们是领导者;和 3888 用于领导选举阶段的其他服务器连接。