seninel部署
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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)