Sentinel provides the
sentinel-cluster-server-envoy-rls module, enabling support for Envoy rate limiting gRPC service.
The token server has supported both Envoy RLS v2 and v3 API. Since Envoy 1.18.0, v2 API support has been removed.
Build the executable jar:
mvn clean package -P prod
Note: the gRPC stub classes for Envoy RLS service is generated via
compilegoal. The generated classes is located in the directory:
Currently Sentinel RLS token server supports dynamic rule configuration via the yaml file. The file may provide rules for one domain (defined in Envoy's conf file). In Envoy, one rate limit request might carry multiple rate limit descriptors (which will be generated from Envoy rate limit actions). One rate limit descriptor may have multiple entries (key-value pair). We may set different threshold for each rate limit descriptors.
A sample rule configuration file:
- key: "destination_cluster"
This rule only takes effect for domain
foo. It will limit the max QPS to 1 for
all requests targeted to the
We need to provide the path to yaml file via the
-Dcsp.sentinel.rls.rule.file opts). Then as soon as the content in the rule file has been changed,
Sentinel will reload the new rules from the file to the
We may check the logs in
~/logs/csp/sentinel-record.log.xxx to see whether the rules has been loaded.
We may also retrieve the converted
FlowRule via the command API
The configuration list:
|Item (JVM property)
|The RLS gRPC server port
|The path of the RLS rule yaml file
|Whether to enable the access log (
on for enable)