Reputation: 31
I want to build a cluster using zookeeper, but I just get 2 servers(A,B). If I install two zookeepers(z1
, z2
) on server A, and one(z3
) on server B. Can this cluster work?
In fact, I have configured my servers like this. z2
can start, but I can not check its status. And z1
and z3
are standalone mode. How to configure? Thanks.
Upvotes: 3
Views: 1964
Reputation: 83
Can this cluster work?
Yes, you can install three instances on two servers. You just need different configurations for z1 and z2.
Use the following configuration for z1.
# z1 configuration
tickTime=2000
initLimit=5
syncLimit=2
dataDir=/data/z1
clientPort=2181
server.1=A:2888:3888
server.2=A:2889:3889
server.3=B:2888:3888
and this one for z2.
# z2 configuration
tickTime=2000
initLimit=5
syncLimit=2
dataDir=/data/z2
clientPort=2182
server.1=A:2888:3888
server.2=A:2889:3889
server.3=B:2888:3888
on z3 configuration you need to have these lines. So z3 will be aware of z1 and z2. If you don't add these, z1 and z2 will be running standalone.
server.1=A:2888:3888
server.2=A:2889:3889
server.3=B:2888:3888
To check the status of a node, simply look inside zookeper.out file under dataDir. It will print enough information about the status.
Upvotes: 1