Dubbo provides the service management capability of dynamic traffic isolation, which can dynamically isolate traffic without restarting the application.
Dubbo can implement traffic isolation through XML configuration, annotation configuration, and dynamic configuration. Here we mainly introduce the dynamic configuration method. For other configuration methods, please refer to the old document Configuration
before the start
Please make sure to run Dubbo-Admin successfully
If multiple versions of an application run simultaneously online and are deployed in different environments, such as daily environments and special environments, you can use label routing to isolate the traffic of different versions in different environments, and the order traffic of flash sales or orders from different channels Routing to special environments, routing normal traffic to everyday environments. Even if the special environment is abnormal, the traffic that should have entered the special environment will not enter the daily environment, and will not affect the use of the daily environment.
- Log in to the Dubbo-Admin console
- In the left navigation pane, select Service Governance > Label Routing.
- Click the Create button, and in the Create New Tag Rule pane, fill in the rule content, and then click Save.
--- force: false runtime: true enabled: true key: governance-tagrouter-provider tags: - name: tag1 addresses: ["127.0.0.1:20880"] - name: tag2 addresses: ["127.0.0.1:20881"] ...
For the traffic isolation scenario, you only need to clarify the following issues to know how to write the configuration:
- To modify the configuration of the provider application to which the service belongs.
scope: application, key: app-name(you can also use
servicesto specify certain services).
- When the routing result is empty, whether to force return.
- force=false: When the routing result is empty, downgrade the provider whose tag is empty.
- force=true: When the routing result is empty, an exception will be returned directly.
- Priority of routing rules
- priority=1: The priority of routing rules, used for sorting, the higher the priority, the higher the execution, it can be left blank, the default is 0.
- Whether the configuration takes effect only for certain specific instances.
- All instances:
addresses: ["0.0.0.0:*"]depends on the side value.
- Specified instances:
addersses[list of instance addresses].
- All instances:
- The tag name to modify.
Select the application related to the traffic isolation configuration to trigger the call verification.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.