Status
Current state: Under Discussion
Discussion thread: here
JIRA:
Released:
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Motivation
Currently kafka-topics.sh uses only direct Zookeeper connections which is not really desired compared to the AdminClient. This change would aim to add capability to the TopicCommand to be able to connect to a broker using the AdminClient.
This is part of KIP-4 which outlines the importance of exposing admin operations via the Kafka protocol:
- Allows clients in any language to administrate Kafka (Wire protocol is supported by any language)
- Provides public client for performing admin operations
- Ensures integration test code in other projects and clients maintains compatibility
- Prevents users from needing to use the Command classes and work around standard output and system exits
- Removing the need for admin scripts (kafka-configs.sh, kafka-topics.sh, etc) to talk directly to Zookeeper.
- Allows ZNodes to be completely locked down via ACLs
- Further hides the Zookeeper details of Kafka
Public Interfaces
Commandline Options
A few extra options will be added to kafka-configs.sh:
--bootstrap-server
option will be added to accept config changes. This will would accept a list of brokers that the internal AdminClient would use.
--command-config
option will be also added. This would accept a file argument that points to the AdminClient configuration.
val bootstrapServerOpt = parser.accepts("bootstrap-server", "REQUIRED: The Kafka servers to connect to, separated by commas, for instance "localhost:9091,localhost:9092". In case of providing this, a direct Zookeeper connection won't be required.") .withRequiredArg .describedAs("server to connect to") .ofType(classOf[String]) val commandConfigOpt = parser.accepts("command-config", "Property file containing configs to be passed to Admin Client. " + "This is used only with --bootstrap-server option for describing and altering broker configs.") .withRequiredArg .describedAs("command config property file") .ofType(classOf[String])
Proposed Changes
The change proposed in this KIP is to add an extra option as stated above and to migrate create, delete, list and describe operations to use a broker connection. This would be a backward compatible change, meaning the zookeeper way would be still available until a further point in time but hopefully would deprecate it as part of this KIP.
Providing --bootstrap-server
and --zookeeper
together would result in an exception as they should be mutually exclusive.
Compatibility, Deprecation, And Migration Plan
No existing behavior would be removed and the implementation would be done in a backward compatible way.
Test Plan
The existing tests will be run with the --bootstrap-server
mode too. Additionally we can refactor some of the kafka-topics.sh usages in the smokes to use the AdminClient mode.