博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zookeeper本机伪集群模式配置,坑人的配置。
阅读量:6769 次
发布时间:2019-06-26

本文共 3635 字,大约阅读时间需要 12 分钟。

hot3.png

1.zookeeper解压的路径由以下可知:

/home/doctor/opt/zookeeper-3.4.6/conf

本地设置3个zookeeper,配置文件为:

 zoo2.cfg  zoo3.cfg  zoo.cfg。

zoo.cfg配置:

# The number of milliseconds of each tick

tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/home/doctor/zookeeper/d_1
# the port at which the clients will connect
clientPort=2181
# 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=1
server.1=localhost:2887:3887
server.2=localhost:2888:3888
server.3=localhost:2889:3889

zoo2.cfg配置:

# The number of milliseconds of each tick

tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/home/doctor/zookeeper/d_2
# the port at which the clients will connect
clientPort=2182
# 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=1
server.1=localhost:2887:3887
server.2=localhost:2888:3888
server.3=localhost:2889:3889

zoo3.cfg 配置:

# The number of milliseconds of each tick

tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/home/doctor/zookeeper/d_3
# the port at which the clients will connect
clientPort=2183
# 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=1
server.1=localhost:2887:3887
server.2=localhost:2888:3888
server.3=localhost:2889:3889

注意:大家都知道,关键是clientPort 不能相同。

其次,让我启动失败的配置那就是:dataDir=/home/doctor/zookeeper/d_x (d_1,d_2,d_3)

里面的配置。

大家应该知道在此文件下需要建立myid文件,里面的内容就是对应server.1=localhost:2887:3887  里面的server.1中的1.例如:

[doctor d_1]$ pwd

/home/doctor/zookeeper/d_1
[doctor d_1]$ ls
myid  version-2  zookeeper_server.pid
[doctor d_1]$ 

[doctor d_1]$ cat myid 

1

内容是1,

问题根源:我写入的内容为1,不后面加了空格,就报错,启动不了。

所以,。。。。应该程序读取配置文件时候,就应该trim一下吧。。

转载于:https://my.oschina.net/doctor2014/blog/385837

你可能感兴趣的文章
数据结构7_链二叉树
查看>>
使用Newtonsoft将DataTable转Json
查看>>
第八天
查看>>
Android Studio中多项目共享Library
查看>>
用java的io流,将一个文本框的内容反转
查看>>
修改testtools框架,将测试结果显示用例注释名字
查看>>
谁说程序员必须要加班
查看>>
2 Django REST Framework 开发 ---- APIView
查看>>
类别列表_显示树状结构
查看>>
(待写)五大常用算法:分治、动态规划、贪心、回溯和分支界定
查看>>
C++ - memset的效率和源码分析
查看>>
【UIKit】UITableView 1
查看>>
[HeadFirst-HTMLCSS学习笔记][第十三章表格]
查看>>
2017-2018-2上课课程
查看>>
linux文件删除原理
查看>>
python 模块
查看>>
(5)连续非周期信号的傅里叶变换(频谱) & 周期信号的傅里叶变换
查看>>
poj 1422 Air Raid (二分匹配)
查看>>
Apache Storm技术实战之2 -- BasicDRPCTopology
查看>>
随机数生成器
查看>>