Can you explain how you launched those two zookeeper instances and maybe
share their config? You need to make some edits to config in order to
run a zookeeper cluster - I have a feeling you might be running two
separate instances of zookeeper rather than a cluster. Also, if you want
a cluster you should run zookeeper in odd numbers. From zookeeper
documentation https://zookeeper.apache.org/doc/trunk/zookeeperStarted.html
For replicated mode, a minimum of three servers are required, and it
is strongly recommended that you have an odd number of servers. If you
only have two servers, then you are in a situation where if one of
them fails, there are not enough machines to form a majority quorum.
Two servers is inherently *less* stable than a single server, because
there are two single points of failure.
On 2016.11.14 11:05, ZHU Hua B wrote:
Hi All,
I want to create a topic with command "bin/kafka-topics.sh --create --zookeeper HOST:PORT
--replication-factor 1 --partitions 1 --topic test", if the option "--zookeeper" could point
to multi-zookeeper URLs such as "HOST1:PORT1,HOST2:PORT2"?
I tried it as below seems the topic only be listed under the first zookeeper URL. But the
description of this option said "Multiple URLS can be given to allow
fail-over." If my usage is wrong? Thanks!
# bin/kafka-topics.sh --create --zookeeper HOST1:PORT1,HOST2:PORT2 --
replication-factor 1 --partitions 1 --topic test
creation succeeded!
# bin/kafka-list-topic.sh --zookeeper HOST1:PORT1
topic: test partition: 0 leader: 0 replicas: 0 isr: 0
# bin/kafka-list-topic.sh --zookeeper HOST2:PORT2
no topics exist!
# bin/kafka-topics.sh
--zookeeper <urls> REQUIRED: The connection string for
the zookeeper connection in the form
host:port. Multiple URLS can be
given to allow fail-over.
Best Regards
Johnny