Service Information
The service list displays the service information provided by the interface, and distinguishes it according to the registration source interface level/application level.
The service details page displays information about the provider and consumer of the interface, and the method of the interface.
Dynamic routing
Conditional routing
Conditional routing can write some custom routing rules to achieve some service governance requirements such as black and white lists, separation of reads and writes, and so on. Conditional routing can create rules at the interface level and consumer application level.
To create a conditional routing rule, you need to fill in the interface, version, group information (if version and group are not available, leave it blank). The following figure shows a simple blacklist configuration. => The left side represents consumer matching conditions, and the right side represents provider matching conditions (no means no For details of specific rules, please refer to the official website (for details, please refer to the relevant links at the end of the article). Therefore, the meaning of the configuration is that the consumer whose consumer ip is 192.168.1.3 does not have a provider to provide services.
Label routing
Label routing divides one or more service providers into the same group, restricting traffic to only flow in designated groups, so as to achieve the purpose of traffic isolation. It can be used as a capability basis for scenarios such as blue-green release and gray-scale release. Create rules at the provider application level, for static marking:
dubbo.provider.tag=tag1
@DubboService(tag = "tag2")
Mesh routing
Mesh routing is a new traffic management strategy introduced in version 3.0. It supports more condition matching and combinations to easily implement various routing functions. The entire traffic management is divided into two parts: VirtualService and DestinationRule. VirtualService matches ingress traffic, and DestinationRule matches egress traffic. Refer to the document for detailed rules (see the relevant links at the end of the article for details).
Case study
An interface org.test.apache.dubbo.interfaces.HelloService#hi(Integer number) The parameter number is an Integer type. The following rules indicate that when the number is an even number, it matches the provider whose label is v1 (that is, the url parameter with test-version = v1 Service), when it is an odd number matching provider with label v2 (that is, the service with test-version = v2 in the url parameter), the service can be marked by dubbo.application.parameters.test-version = v1 to achieve a simple Grayscale function.
apiVersion: service.dubbo.apache.org/v1alpha1
kind: VirtualService
metadata:
name: demo/oddEvenRouter
spec:
dubbo:
- routedetail:
- match:
- method:
argc: 1
args:
- index: 0
num_value:
oneof:
- exact: 0.0
mod: 2.0
type: int
name_match:
exact: hi
name: even-route
route:
- destination:
host: demo
subset: v1
- match:
- method:
argc: 1
args:
- index: 0
num_value:
oneof:
- exact: 1.0
mod: 2.0
type: int
name_match:
exact: hi
name: odd-route
route:
- destination:
host: demo2
subset: v2
services:
- exact: org.test.apache.dubbo.interfaces.HelloService
---
apiVersion: service.dubbo.apache.org/v1alpha1
kind: DestinationRule
metadata:
name: test-route
spec:
host: demo
subsets:
- name: v1
labels:
test-version: v1
- name: v2
labels:
test-version: v2
Dynamic configuration
Dynamic configuration provides the ability to dynamically adjust the behavior of RPC calls without restarting. For example, modify the timeout period, weight, load balancing strategy adjustment, etc. The effect is at the interface level and application level. The meaning of the following figure is to adjust the timeout time to 6000ms, which acts on all nodes on the conusmer side.
Service test
You can test the dubbo service through the admin background, and the parameters will automatically generate a JSON template based on the content of the metadata.
Service Mock
Through the rule configuration in the Admin background, the rule configuration is carried out according to the service name and method name.
The user introduces the dependency of Mock in the Dubbo reference, and by adding the JVM startup parameter -Denable.dubbo.admin.mock=true, you can experience that without a Provider, realize the simulation call of the Consumer to the Provider, and return the configuration from the admin Simulation data.
<denpendency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-mock-admin</artifactId>
<version>last</version>
</denpendency>
new features
- Application-level service discovery
- Mesh routing
- Service Mock
- Permission SPI extension
Related Links
1) Official website:
https://dubbo.apache.org/zh/docs/advanced/routing-rule/
2) Document:
https://dubbo.apache.org/zh/docs/concepts/traffic-management/
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。