seninel部署
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

README.md 1.5KB

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