问题
I followed this link to install Kafka + Zookeeper. It all works well, yet I am setting up Kafka + Zookeeper on 2 servers.
I have setup the kafka/config/server.properties
to have:
- Server 1:
broker.id = 0
- Server 1:
zookeeper.connect = localhost:2181,99.99.99.91:2181
- Server 2:
broker.id = 1
- Server 2:
zookeeper.connect = localhost:2181,99.99.99.92:2181
I am wondering the follwing:
- When I publish a topic, does it go to both Instances, or just the server it's loaded on?
- In order to use multiple servers like this, would I be required to use something like HAProxy with say 3 servers?
- Is there anything important I am missing with using 3 servers?
Thanks for any answers.
回答1:
At the very beginning, I would be assuming that the instance mentioned here refers to a Kafka server instance.
Question #1: Information for the new-created topics will be stored in Zookeeper and some key information will be loaded into all brokers' metadata cache buffer.
Question #2: No need to configure any kind of proxy servers for Kafka cluster. It's self managed to implement the fail-over and load-balancing.
Question #3: Assigning an unused id and data directory like what you did for those two brokers is enough.
At last but not least, due to the fact that ZAB requires a majority, it is best to use an odd number of machines as the zookeeper quorum.
来源:https://stackoverflow.com/questions/41008386/kafka-on-multiple-servers