Sentinel/sentinel-extension/sentinel-datasource-etcd
LearningGp eb3a9b099a
Sentinel CI / build (11) (push) Waiting to run Details
Sentinel CI / build (17) (push) Waiting to run Details
Sentinel CI / build (21) (push) Waiting to run Details
Sentinel CI / build (8) (push) Waiting to run Details
CodeQL / Analyze (java) (push) Waiting to run Details
document-lint / document-lint (push) Waiting to run Details
Bump version to 1.8.9 (#3566)
* chore: update release configuration

* Bump version to 1.8.9
2025-10-16 20:26:58 +08:00
..
src Fix thread-blocked problem of EtcdDataSource (#2991) 2023-12-27 20:40:26 +08:00
README.md Move document-lint from circleci to github-actions (#3345) 2024-02-21 17:05:29 +08:00
pom.xml Bump version to 1.8.9 (#3566) 2025-10-16 20:26:58 +08:00

README.md

Sentinel DataSource Etcd

Sentinel DataSource Etcd provides integration with etcd so that etcd can be the dynamic rule data source of Sentinel. The data source uses push model (watcher).

To use Sentinel DataSource Etcd, you should add the following dependency:

<dependency>
    <groupId>com.alibaba.csp</groupId>
    <artifactId>sentinel-datasource-etcd</artifactId>
    <version>x.y.z</version>
</dependency>

We could configure Etcd connection configuration by config file (for example sentinel.properties):

csp.sentinel.etcd.endpoints=http://ip1:port1,http://ip2:port2
csp.sentinel.etcd.user=your_user
csp.sentinel.etcd.password=your_password
csp.sentinel.etcd.charset=your_charset
csp.sentinel.etcd.auth.enable=true # if ture, then open user/password or ssl check
csp.sentinel.etcd.authority=authority # ssl

Or we could configure via JVM -D args or via SentinelConfig.setConfig(key, value).

Then we can create an EtcdDataSource and register to rule managers. For instance:

// `rule_key` is the rule config key
ReadableDataSource<String, List<FlowRule>> flowRuleEtcdDataSource = new EtcdDataSource<>(rule_key, (rule) -> JSON.parseArray(rule, FlowRule.class));
FlowRuleManager.register2Property(flowRuleEtcdDataSource.getProperty());

We've also provided an example: sentinel-demo-etcd-datasource