Kafka quotas


With the CLI you can view, create, modify and delete quotas.The commands for these actions are shown in the table below.

CommandsDescription
clientsHandle the clients quotas
usersHandle the users quotas

View quotas 

lenses-cli quotas

Create and update quotas for users 

# Creation example
lenses-cli quota users set --quota-user="user" \
    --quota-config='{"producer_byte_rate": "100000","consumer_byte_rate": "200000","request_percentage": "75"}'

# Update example
lenses-cli quota users set --quota-user="user" \
    --quota-config='{"producer_byte_rate": "1000000","consumer_byte_rate": "2000000","request_percentage": "15"}'

Create and update quotas for clients 

# Creation example
lenses-cli quota clients set --quota-client="test" \
    --quota-config='{"producer_byte_rate": "100000","consumer_byte_rate": "200000","request_percentage": "75"}'

# Update example
lenses-cli quota clients set --quota-client="test" \
    --quota-config='{"producer_byte_rate": "1000000","consumer_byte_rate": "2000000","request_percentage": "75"}'

You can create and update quotas using a file

# Delete users quota example
lenses-cli quota users set ./quota.yaml

File example:

- type: USER
  config:
    producerByteRate: "1024000"
    consumerByteRate: "1024000"
    requestPercentage: "10"
  user: [USER_NAME]
  client: [CLIENT_NAME]

Remove user quota config’s specific properties 

# Delete users quota example
lenses-cli quota users delete --quota-client="*" \
    producer_byte_rate consumer_byte_rate request_percentage

Delete for the default user quota 

lenses-cli quota users delete

Delete for a specific user quota 

lenses-cli quota users delete \
    --quota-user="user"

Delete for a specific user and client 

lenses-cli quota users delete \
    --quota-user="user" \
    --quota-client="clientID"

Delete for a specific user quota’s property 

lenses-cli quota users delete \
    --quota-user="user" \
    request_percentage

Remove client quota config’s specific properties 

If empty then all properties will be passed on automatically and the client quota will be removed entirely.

lenses-cli quota clients delete \
    producer_byte_rate consumer_byte_rate request_percentage

Delete for the default client quota 

lenses-cli quota clients delete

Delete for a specific client quota 

lenses-cli quota clients delete \
    --quota-client="clientID"

Delete for a specific client quota’s property 

lenses-cli quota clients delete \
    --quota-client="clientID" \
    request_percentage
--
Last modified: November 18, 2024