Morgan Kenyon
Morgan Kenyon

Reputation: 3172

Creating Kafka Topic for Multiple Zookeepers Instances

Reading through the Kafka Quick Start, creating a topic tied to a single Zookeeper instance (in this case localhost) is really simple using the command

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

But what if I have 3 Zookeeper servers running? Do I only need to include one of the Zookeeper urls, and will the other Zookeeper instances be notified of this new topic to help fault tolerance? Or do I need to provide all of them?

Upvotes: 3

Views: 4847

Answers (1)

codejitsu
codejitsu

Reputation: 3182

If you have a ZK cluster running, it's ok to use only one ZK connection string (host:port). Topic changes will be propagated automatically to all zookeeper nodes.

If you want specify multiple ZK hosts (for failover), use comma-separated string like: host1:port1,host2:port2,host3:port3

Upvotes: 7

Related Questions