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.

123456789101112131415161718192021222324252627
  1. # Sentinel DataSource ZooKeeper
  2. Sentinel DataSource ZooKeeper provides integration with ZooKeeper so that ZooKeeper
  3. can be the dynamic rule data source of Sentinel. The data source uses push model (listener).
  4. To use Sentinel DataSource ZooKeeper, you should add the following dependency:
  5. ```xml
  6. <dependency>
  7. <groupId>com.alibaba.csp</groupId>
  8. <artifactId>sentinel-datasource-zookeeper</artifactId>
  9. <version>x.y.z</version>
  10. </dependency>
  11. ```
  12. Then you can create an `ZookeeperDataSource` and register to rule managers.
  13. For instance:
  14. ```java
  15. // `path` is the data path in ZooKeeper
  16. ReadableDataSource<String, List<FlowRule>> flowRuleDataSource = new ZookeeperDataSource<>(remoteAddress, path, source -> JSON.parseObject(source, new TypeReference<List<FlowRule>>() {}));
  17. FlowRuleManager.register2Property(flowRuleDataSource.getProperty());
  18. ```
  19. > Note: It's not recommended to add a large amount of rules to a single path (has limitation, also leads to bad performance).
  20. We've also provided an example: [sentinel-demo-zookeeper-datasource](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-zookeeper-datasource).