That is correct.
On 2016.11.15 08:54, ZHU Hua B wrote:
Hi,
Thanks for your explanation!
Do you mean I just need to write a number "1" in the file myid on 192.168.210.5, not
"server.1" or other content? Thanks!
Best Regards
Johnny
-----Original Message-----
From: Karolis Pocius [mailto:k.poc...@adform.com]
Sent: 2016年11月15日 14:47
To: users@kafka.apache.org
Subject: Re: Create topic with multi-zookeeper URLs
You need to create myid file in the datadir (in your case
/tmp/zookeeper/myid) of each instance with a numeric ID inside that file
corresponding to what you have in this section
server.1=192.168.210.5:2888:3888
server.2=192.168.210.6:2888:3888
server.3=192.168.210.8:2888:3888
So on 192.168.210.5 myid file would say 1, on 192.168.210.6 it would say 2, and
so on.
On 2016.11.15 08:04, ZHU Hua B wrote:
Hi,
Many thanks for your info!
As you said, I think my configuration might be running two separate instances of zookeeper rather
than a cluster, so I modify the configuration file as below and start up three zookeeper instances
in separate machines. While the zookeeper launched, some error occurred that
"/tmp/zookeeper/myid file is missing ". From zookeeper document, it said " 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." If the file myid will be created
automatically or manually by myself? What's format for the file myid? Thanks!
Previous configuration:
dataDir=/tmp/zookeeper
clientPort=2181
maxClientCnxns=0
Current configuration:
dataDir=/tmp/zookeeper
clientPort=2181
maxClientCnxns=0
# For replicated mode
tickTime=2000
initLimit=5
syncLimit=2
server.1=192.168.210.5:2888:3888
server.2=192.168.210.6:2888:3888
server.3=192.168.210.8:2888:3888
# /root/kafka_2.8.0-0.8.0/bin/zookeeper-server-start.sh
config/zookeeper.properties
[2016-11-15 03:11:54,143] INFO Reading configuration from:
config/zookeeper.properties
(org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2016-11-15 03:11:54,145] INFO Defaulting to majority quorums
(org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2016-11-15 03:11:54,146] FATAL Invalid config, exiting abnormally
(org.apache.zookeeper.server.quorum.QuorumPeerMain)
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error
processing config/zookeeper.properties
at
org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:110)
at
org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:99)
at
org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:76)
Caused by: java.lang.IllegalArgumentException: /tmp/zookeeper/myid file is
missing
at
org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:320)
at
org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:106)
... 2 more
Invalid config, exiting abnormally
Best Regards
Johnny
-----Original Message-----
From: Karolis Pocius [mailto:k.poc...@adform.com]
Sent: 2016年11月14日 17:25
To: users@kafka.apache.org
Subject: Re: Create topic with multi-zookeeper URLs
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