1 Change the version number to 1.1.1 and 1.1.2 respectively in conf microservice.yaml of two mersher_calculator instances. Restart the mersher service and you can see that the service version number has changed in servicecenter.
2 Change weight options in configuration file router.yaml of mersher_webapp. Then restart service.
routeRule: calculator: #service name - precedence: 2 #precedence of route rule route: #route rule list - tags: version: 1.1.1 weight: 70 #weight of 20% - tags: version: 1.1.2 weight: 30 #weight of 20%
1 Change the circuit breaker configuration in conf chassis.yaml of mersher_webapp.
isolation: Consumer: timeout: enabled: true timeoutInMilliseconds: 1000 maxConcurrentRequests: 1 circuitBreaker: Consumer: enabled: true forceOpen: false forceClosed: false sleepWindowInMilliseconds: 10000 requestVolumeThreshold: 1 errorThresholdPercentage: 1 fallback: Consumer: enabled: true maxConcurrentRequests: 1 fallbackpolicy: Consumer: policy: returnnull
2 Stop the service instances in directory test_balance.
1 The circuit breaker of mersher_webapp takes effect when a negative parameter is passed in. The first picture is the log of mersher_webapp. The second picture is the return value when inputing negative parameter. The third picture is the return value when the circuit breaker of mersher_webapp takes effect.
2 The service is automatically restored after 10 seconds because of the conf parameter sleepWindowInMilliseconds.
More about service management