seninel部署
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

README.md 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. Configure Etcd Connect Properties By Config File (for example sentinel.properties)
  13. ```
  14. csp.sentinel.etcd.end.points=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 open user/password or ssl check
  19. csp.sentinel.etcd.authority=authority //ssl
  20. ```
  21. or JVM args(Add -D prefix)
  22. Then you can create an `EtcdDataSource` and register to rule managers.
  23. 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. > Note: It needs to update JDK version to JDK8
  30. We've also provided an example: [sentinel-demo-etcd-datasource](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-etcd-datasource)