seninel部署
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.4KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Sentinel DataSource Etcd
  2. Sentinel DataSource Etcd provides integration with etcd so that etcd
  3. can be the dynamic rule data source of Sentinel. The data source uses push model (watcher).
  4. To use Sentinel DataSource Etcd, you should add the following dependency:
  5. ```xml
  6. <dependency>
  7. <groupId>com.alibaba.csp</groupId>
  8. <artifactId>sentinel-datasource-etcd</artifactId>
  9. <version>x.y.z</version>
  10. </dependency>
  11. ```
  12. We could configure Etcd connection configuration by config file (for example `sentinel.properties`):
  13. ```
  14. csp.sentinel.etcd.endpoints=http://ip1:port1,http://ip2:port2
  15. csp.sentinel.etcd.user=your_user
  16. csp.sentinel.etcd.password=your_password
  17. csp.sentinel.etcd.charset=your_charset
  18. csp.sentinel.etcd.auth.enable=true # if ture, then open user/password or ssl check
  19. csp.sentinel.etcd.authority=authority # ssl
  20. ```
  21. Or we could configure via JVM -D args or via `SentinelConfig.setConfig(key, value)`.
  22. Then we can create an `EtcdDataSource` and register to rule managers. For instance:
  23. ```java
  24. // `rule_key` is the rule config key
  25. ReadableDataSource<String, List<FlowRule>> flowRuleEtcdDataSource = new EtcdDataSource<>(rule_key, (rule) -> JSON.parseArray(rule, FlowRule.class));
  26. FlowRuleManager.register2Property(flowRuleEtcdDataSource.getProperty());
  27. ```
  28. We've also provided an example: [sentinel-demo-etcd-datasource](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-etcd-datasource)