Will Weber
2018-10-08 15:58:46 UTC
Hey all,
Working on a tool for Kafka lifecycle management and one of the features
we're keen to try to wrap is user quotas.
This capability definitely exists through sets of scripts included with
Kafka, case and point: https://kafka.apache.org/documentation/#quotas
--entity-type users --entity-name user1 --entity-type clients --entity-name
clientA
Updated config for entity: user-principal 'user1', client-id 'clientA'.
Which would set limits on a given client.
Based on this command, it leads me to believe that the
AdminClient#alterConfigs
<https://kafka.apache.org/20/javadoc/org/apache/kafka/clients/admin/AdminClient.html#alterConfigs-java.util.Map->
method
is probably the way to go.
However, I noticed that in the ConfigResource.Type
<https://kafka.apache.org/20/javadoc/org/apache/kafka/common/config/ConfigResource.Type.html>
enum, there are only Broker, Unknown and Topic options. Naively, I imagine
there to be a corresponding Enum to match the entity-type flag options as
well, but no such luck.
Anyone have recommendations as to how I could go about enforcing quotas
through the admin api?
Mostly just looking for a nudge in the right direction, any help is
appreciated!
Best,
-Will
Working on a tool for Kafka lifecycle management and one of the features
we're keen to try to wrap is user quotas.
This capability definitely exists through sets of scripts included with
Kafka, case and point: https://kafka.apache.org/documentation/#quotas
bin/kafka-configs.sh --zookeeper localhost:2181 --alter --add-config
'producer_byte_rate=1024,consumer_byte_rate=2048,request_percentage=200'--entity-type users --entity-name user1 --entity-type clients --entity-name
clientA
Updated config for entity: user-principal 'user1', client-id 'clientA'.
Which would set limits on a given client.
Based on this command, it leads me to believe that the
AdminClient#alterConfigs
<https://kafka.apache.org/20/javadoc/org/apache/kafka/clients/admin/AdminClient.html#alterConfigs-java.util.Map->
method
is probably the way to go.
However, I noticed that in the ConfigResource.Type
<https://kafka.apache.org/20/javadoc/org/apache/kafka/common/config/ConfigResource.Type.html>
enum, there are only Broker, Unknown and Topic options. Naively, I imagine
there to be a corresponding Enum to match the entity-type flag options as
well, but no such luck.
Anyone have recommendations as to how I could go about enforcing quotas
through the admin api?
Mostly just looking for a nudge in the right direction, any help is
appreciated!
Best,
-Will