seninel部署
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Sentinel DataSource Spring Cloud Config
  2. Sentinel DataSource Spring Cloud Config provides integration with Spring Cloud Config
  3. so that Spring Cloud Config can be the dynamic rule data source of Sentinel.
  4. To use Sentinel DataSource Spring Cloud Config, you should add the following dependency:
  5. ```xml
  6. <dependency>
  7. <groupId>com.alibaba.csp</groupId>
  8. <artifactId>sentinel-datasource-spring-cloud-config</artifactId>
  9. <version>x.y.z</version>
  10. </dependency>
  11. ```
  12. Then you can create an `SpringCloudConfigDataSource` and register to rule managers.
  13. For instance:
  14. ```Java
  15. ReadableDataSource<String, List<FlowRule>> flowRuleDs = new SpringCloudConfigDataSource<>(ruleKey, s -> JSON.parseArray(s, FlowRule.class));
  16. FlowRuleManager.register2Property(flowRuleDs.getProperty());
  17. ```
  18. To notify the client that the remote config has changed, we could bind a git webhook callback with the
  19. `com.alibaba.csp.sentinel.datasource.spring.cloud.config.SentinelRuleLocator.refresh` API.
  20. We may refer to the the sample `com.alibaba.csp.sentinel.datasource.spring.cloud.config.test.SpringCouldDataSourceTest#refresh` in test cases.
  21. We offer test cases and demo in the package: `com.alibaba.csp.sentinel.datasource.spring.cloud.config.test`.
  22. When you are running test cases, please follow the steps:
  23. ```
  24. // First, start the Spring Cloud config server
  25. com.alibaba.csp.sentinel.datasource.spring.cloud.config.server.ConfigServer
  26. // Second, start the Spring Cloud config client
  27. com.alibaba.csp.sentinel.datasource.spring.cloud.config.client.ConfigClient
  28. // Third, run the test cases and demo
  29. com.alibaba.csp.sentinel.datasource.spring.cloud.config.test.SentinelRuleLocatorTests
  30. com.alibaba.csp.sentinel.datasource.spring.cloud.config.test.SpringCouldDataSourceTest
  31. ```