zookeeper集群配置
来源:互联网 发布:网络购物被骗怎么办 编辑:程序博客网 时间:2024/06/05 20:13
下载安装
从官网下载最新版本的zookeeper
相关地址:http://mirror.bit.edu.cn/apache/zookeeper/current/
# wget --quiet http://mirror.bit.edu.cn/apache/zookeeper/current/zookeeper-3.4.10.tar.gz# tar -xf zookeeper-3.4.10.tar.gz# cd zookeeper-3.4.10
进入conf目录,将默认的zoo_sample.cfg改成zoo.cfg,执行命令:
bin/zkServer.sh start
启动即可
zkServer命令相关参数:
Usage: bin/zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}
集群配置
集群节点必须是奇数个
- 将解压出来的zookeeper目录拷贝三份,如:zookeeper1,zookeeper2,zookeeper3。
- 分别创建并修改配置文件
zoo0x.cfg
,dataDir和clientPort不能相同。 - 分别在三个dataDir目录中创建文件myid,存放对应服务节点数字,如:server.1存储1。
- 分别修改完成后,即可运行
bin/zkServer.sh
启动zookeeper服务节点。
配置文件参考:
vim /opt/zookeeper01/conf/zoo01.cfg# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.#dataDir=/tmp/zookeeper01dataDir=/data/product/zookeeper01/datadir# the port at which the clients will connectclientPort=2181# listen ip address#clientPortAddress=localhost# the maximum number of client connections.# increase this if you need to handle more clients#maxClientCnxns=60## Be sure to read the maintenance section of the # administrator guide before turning on autopurge.## http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance## The number of snapshots to retain in dataDir#autopurge.snapRetainCount=3# Purge task interval in hours# Set to "0" to disable auto purge feature#autopurge.purgeInterval=1server.01=localhost:2887:3887 server.02=localhost:2888:3888server.03=localhost:2889:3889
集群服务配置说明
server.A=B:C:D
- A 是一个数字,表示这个是第几号服务器;
- B 是这个服务器的IP地址(或者是与IP地址做了映射的主机名);
- C 第一个端口用来集群成员的信息交换,表示这个服务器与集群中的Leader服务器交换信息的端口;
- D 是在leader挂掉时专门用来进行选举leader所用的端口。
关于日志
默认情况下zookeeper的日志是根据执行bin/zkServer.sh start
命令时所在的路径,在当前路径下创建一个文件名为:zookeeper.out
的文件并将日志内容写入其中
修改日志保存到固定路径的文件下:
1,修改启动脚本bin/zkServer.sh,增加:
ZOO_LOG_DIR="$ZOOBINDIR/../logs"
2,修改vim bin/zkEnv.sh
42 if [ "x$ZOOCFG" = "x" ] 43 then 44 ZOOCFG="zoo02.cfg"
客户端链接集群
spring: cloud: zookeeper: connect-string: localhost:2181,localhost:2182,localhost:2183
注意:如果使用 Spring Cloud Zookeeper Config 模块,必须配置在 bootstrap.yml 中
注意:zookeeper集群最好保持奇数个节点,如果集群中的节点只剩下1个,集群将会失效,客户端将无法连接
阅读全文
0 0
- Zookeeper集群配置
- Zookeeper集群配置
- zookeeper集群安装配置
- ZooKeeper集群安装配置
- zookeeper集群安装配置
- Zookeeper集群配置部署
- zookeeper集群配置安装
- ZooKeeper集群配置
- zookeeper 集群配置
- zookeeper集群的配置
- zookeeper集群配置
- zookeeper集群安装配置
- ZooKeeper集群配置
- zookeeper集群配置
- zookeeper集群配置安装
- zookeeper集群配置
- zookeeper 集群配置
- Zookeeper集群环境配置
- Android studio 常见错误以及问题
- 面试(一)
- centos+Docker +Jenkins 自动化部署配置
- dispatch_semaphore (信号量)
- xml与xml在python中的使用
- zookeeper集群配置
- Java内部类详解
- vue中如何动态的绑定图片
- Win7下DVWA渗透测试平台的搭建与安装
- 阅读QtCreator需要知道的qmake
- OpenCl_CPU加速矩阵运算
- 集线器(Hub)和交换机(Switch)的区别
- 解决Winform中鼠标滚轮无法操作Panel滚动条的问题
- 由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本,请添加处理程序