参考:

https://www.cnblogs.com/lsdb/p/7297731.html

https://zookeeper.apache.org/doc/r3.4.13/zookeeperStarted.html#sc_RunningReplicatedZooKeeper

前提

JDK 6及其以上

安装

下载安装文件并上传到各目标机器

将下载好的 zookeeper-x.x.x.tar.gz 分别上传到目标机器,如 /usr/local/src ,当前下载的版本为3.4.9

我的目标机器

在各目标机器分别解压

在各目标机器创建软连接

在各目标机器创建配置文件

写入各目标机器的myid

(分别写入不同的myid, myid中的内容对应相关的server.x,即写入相应的ip的server的x值.如:192.168.10.130的myid配置成3)

打开各目标机器相应端口

分别启动

查看状态

相关配置解释(官方链接)

initLimit

  initLimit is timeouts ZooKeeper uses to limit the length of time the ZooKeeper servers in quorum have to connect to a leader.

syncLimit

  syncLimit limits how far out of date a server can be from a leader.

tickTime

  the basic time unit in milliseconds used by ZooKeeper.(In this example, the timeout for initLimit is 5 ticks at 2000 milleseconds a tick, or 10 seconds. => initLimit timeout = initLimit * tickTime)

server.x=ip:port1:port2

  Finally, note the two port numbers after each server name: " 2888" and "3888". Peers use the former port to connect to other peers. Such a connection is necessary so that peers can communicate, for example, to agree upon the order of updates. More specifically, a ZooKeeper server uses this port to connect followers to the leader. When a new leader arises, a follower opens a TCP connection to the leader using this port. Because the default leader election also uses TCP, we currently require another port for leader election. This is the second port in the server entry.

dataLogDir 

  The dataLogDir parameters indicates a different directory to use for the transaction logs.

myid

  The entries of the form server.X list the servers that make up the ZooKeeper service. When the server starts up, it knows which server it is by looking for the file myid in the data directory. That file has the contains the server number, in ASCII.

在一台机器上部署复制模式的zookeeper(人们口中的伪集群)

Note

If you want to test multiple servers on a single machine, specify the servername as localhost with unique quorum & leader election ports (i.e. 2888:3888, 2889:3889, 2890:3890 in the example above) for each server.X in that server's config file. Of course separate dataDirs and distinct clientPorts are also necessary (in the above replicated example, running on a single localhost, you would still have three config files).

Please be aware that setting up multiple servers on a single machine will not create any redundancy. If something were to happen which caused the machine to die, all of the zookeeper servers would be offline. Full redundancy requires that each server have its own machine. It must be a completely separate physical server. Multiple virtual machines on the same physical host are still vulnerable to the complete failure of that host.

最新文章

  1. 练习一:SQLite基本操作
  2. Oracle数据库入门——pctfree和pctused详解
  3. Nginx反向代理 负载均衡
  4. wp8 入门到精通 LINQ to SQL
  5. BS开发平台,一小时搞定功能强大的统计分析页面
  6. (转载)PureMVC 练习时的注意事项
  7. linux nadianshi
  8. 微信jssdk已无力吐槽
  9. Sass与Compress实战:第六章
  10. Android WebView编程的那些坑(一)
  11. DVWA 黑客攻防实战(十五) 绕过内容安全策略 Content Security Policy (CSP) Bypass
  12. 火狐开发----Web开发者工具
  13. javaEE完整体系结构
  14. git 创建新分支并推送到远程分支
  15. Codeforces.100633J.Ceizenpok's formula(扩展Lucas)
  16. Spring Hibernate Transaction示例
  17. mina2中的session
  18. 201621123018《java程序设计》第12周作业总结
  19. 『PyTorch』第十六弹_hook技术
  20. MonoDevelop 设置

热门文章

  1. Thymeleaf(一)---引入js/css文件
  2. 027、MySQL字符串替换函数,文本替换函数,字符串填充函数
  3. mpvue + Vant weapp + 微信云服务 打造小程序应用
  4. 一道算法题加深我对C++中map函数的理解
  5. python中pip的安装问题
  6. UVA - 10891 Game of Sum (区间dp)
  7. 官网英文版学习——RabbitMQ学习笔记(九)总结
  8. MySql索引原理分析
  9. 【LeetCode】不同二叉搜索树
  10. android 动画基础绘——view 动画(二)[补]