...
Various flags will be used to accomplish these operations.
Common flags:--bootstrap-server
: The standard bootstrap server.--command-config
: Property file for the Admin client.
Operations (mutually exclusive):--list
: Lists the entities that match the given specification, and prints out their configuration values.--describe
: Describes the effective quota values for an entity.--alter
: Alters the configuration for the given specification.
Entity specification flags (common to all):--names
: Comma-separated list of type=name pairs, e.g. "user=some-user,client-id=some-client-id"--defaults
: Comma-separated list of entity types with the default name, e.g. "defaults=user,client-id" (Note a separate flag is necessary since names are opaque.)
Exclusive to --list
:--prefix
: Comma-separated prefix=name pairs, e.g. "user=test-user-".
Exclusive to --describe:--include-overrides
: Whether to include overridden config entries.
Exclusive to --alter:--add
: Comma-separated list of entries to add or update to the configuration, in format "name:unit=value".--delete
: Comma-separated list of entries to remove from the configuration, in format "name:unit".--validate-only
: If set, validates the alteration but doesn't perform it.
Output
In general, the output of the entities will be of the form: {entity-type=entity-name, ...}
, where entity-name
is sanitized for output since it is an opaque string. When displaying configuration values, the form: quota-name:quota-unit=quota-value
.
List:
Code Block |
---|
$./bin/kafka-quotas.sh --bootstrap-server localhost:9092 --list --names=client-id=my-client {user=user-two, client-id=my-client} consumer_byte_rate :shares =200 producer_byte_rate :bps =10000000 {user=user-one, client-id=my-client} producer_byte_rate :broker_bps =2000000 {user=<default>, client-id=my-client} consumer_byte_rate :shares =100 producer_byte_rate :broker_bps =500000 $./bin/kafka-quotas.sh --bootstrap-server localhost:9092 --list --prefix=user=user- {user=user-two, client-id=my-client} consumer_byte_rate :shares =200 producer_byte_rate :bps =10000000 {user=user-one, client-id=my-client} producer_byte_rate :broker_bps =2000000 |
Describe:
Code Block |
---|
$./bin/kafka-quotas.sh --bootstrap-server localhost:9092 --describe --names=user=user-one,client-id=my-client consumer_byte_rate shares :shares=200 {user=user-one, client-id=my-client} producer_byte_rate bps :bps=10000000 {user=user-one, client-id=my-client} producer_byte_rate :broker_bps =500000 {user=<default>, client-id=my-client} $./bin/kafka-quotas.sh --bootstrap-server localhost:9092 --describe --names=user=user-two,client-id=my-client --include-overrides consumer_byte_rate shares 100 :shares=100 {user=<default>, client-id=my-client} producer_byte_rate :broker_bps =2000000 {user=user-two, client-id=my-client} * producer_byte_rate :broker_bps =500000 {user=<default>, client-id=my-client} |
Alter:
Code Block |
---|
$./bin/kafka-quotas.sh --bootstrap-server localhost:9092 --describe --names=client-id=my-client --defaults=user --add=producer_byte_rate:shares=100 --delete=producer_byte_rate:broker_bps <no output on success> $./bin/kafka-quotas.sh --bootstrap-server localhost:9092 --list --names=client-id=my-client --defaults=user {user=<default>, client-id=my-client} consumer_byte_rate :shares =100 producer_byte_rate :shares =100 |
Proposed Changes
In addition to the API changes above, the following write protocol would be implemented:
...