You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "xli1224 (GitHub)" <gi...@apache.org> on 2020/03/03 14:30:34 UTC

[GitHub] [dubbo] xli1224 opened issue #5823: Zone-Aware police couldn't work when service instance registered to multi-zone registries

- [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
- [x] I have checked the [FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 2.7.5
* Operating System version: macos 10.15.2
* Java version: openJDK8

### Steps to reproduce this issue

1. create a service named Greeting service
2. startup two nacos instances representing as two registry center in two different zones.
3. startup two greeting service instances registering to both nacos registry with different registry id
4. startup one consumer instance registering to both nacos registry with different zone id.
5. use consumer to call greeting service with cluster=zone-aware and registry_zone parameter.

The code is simple so I will ignore them and just paste properties as below:

#Provider#
```
dubbo.protocol.name=dubbo
dubbo.protocol.port=12345

dubbo.config.multiple=true
dubbo.registries.a.id=nuc
dubbo.registries.a.address=nacos://127.0.0.1:8848
dubbo.registries.a.zone=nuc
dubbo.registries.a.use-as-config-center=false
dubbo.registries.b.id=mbp
dubbo.registries.b.address=nacos://192.168.1.31:8848
dubbo.registries.b.zone=mbp
dubbo.registries.b.use-as-config-center=false
```
#Consumer#
```
server.port=0
## Dubbo Registry
dubbo.registry.address=nacos://127.0.0.1:8848?zone=nuc|nacos://192.168.1.31:8848?zone=mbp
dubbo.registry.zone
dubbo.registry.use-as-config-center=false
```
```java
    public String hello(String name) {
        logger.info(name);
        RpcContext.getContext().setAttachment("cluster", "zone-aware");
        RpcContext.getContext().setAttachment("registry_zone", "nuc");
        return greetingService.sayHelloTo(name);
    }
```

### Expected Result

I'm confused here, I don't know what to expect. According to the explanation by @chickenlj  in #5399 , One provider instance such as B1 should be able to register to multiple registries in the same time. 

![](https://user-images.githubusercontent.com/18097545/70682056-8ea65300-1cd8-11ea-8e9b-cf6284e04e48.png)

But ZoneAware policy is being executed in ClusterInvoker level. The ZoneAwareClusterInvoker use zone value to decide which FailoverClusterInvoker (contains RegsitryDirectory). I know there is a bug in 2.7.5 that will drop zone parameter #5654 , but this doesn't matter. Even if that is fixed in 2.7.6, the problem is still there, that is:

you choose the right registry, but the registry still list all available DubboInvoker (B1, B2), meanwhile, there is no LoadBalance based on zone value as there is no such value on provider. The consumer A1 can still go to B2 even when B1 is alive.

### Actual Result

When using zone-aware policy, should one service instance can only register to one registry? but this will lose the ability to use services in other zone as a backup. Am I missing something?...



[ Full content available at: https://github.com/apache/dubbo/issues/5823 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] xli1224 commented on issue #5823: Zone-Aware police couldn't work when service instance registered to multi-zone registries

Posted by "xli1224 (GitHub)" <gi...@apache.org>.
> Something is wrong with the picture explaining how it works:
> 
> > One provider instance such as B1 should be able to register to multiple registries in the same time.
> 
> **One provider only registers to one registry.** So you should have two providers to do the test, with one:
> 
> Provider#1
> 
> ```ini
> dubbo.protocol.name=dubbo
> dubbo.protocol.port=12345
> 
> dubbo.config.multiple=true
> dubbo.registry.id=nuc
> dubbo.registry.address=nacos://127.0.0.1:8848
> dubbo.registry.zone=nuc
> dubbo.registry.use-as-config-center=false
> ```
> 
> and another one:
> 
> Provider#2
> 
> ```ini
> dubbo.protocol.name=dubbo
> dubbo.protocol.port=12345
> 
> dubbo.config.multiple=true
> dubbo.registry.id=mbp
> dubbo.registry.address=nacos://192.168.1.31:8848
> dubbo.registry.zone=mbp
> dubbo.registry.use-as-config-center=false
> ```
> 
> **It's the Consumer that need to care about all the two registries:**
> 
> ```ini
> server.port=0
> ## Dubbo Registry
> dubbo.registries.a.address=nacos://127.0.0.1:8848?zone=nuc
> dubbo.registries.a.zone=nuc
> dubbo.registries.a.use-as-config-center=false
> 
> dubbo.registries.b.address=nacos://127.0.0.1:8848
> dubbo.registries.b.zone=mbp
> dubbo.registries.b.use-as-config-center=false
> ```

Thank you, this is exactly what I thought zone should be.

[ Full content available at: https://github.com/apache/dubbo/issues/5823 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] xli1224 closed issue #5823: Zone-Aware police couldn't work when service instance registered to multi-zone registries

Posted by "xli1224 (GitHub)" <gi...@apache.org>.
[ issue closed by xli1224 ]

[ Full content available at: https://github.com/apache/dubbo/issues/5823 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] chickenlj commented on issue #5823: Zone-Aware police couldn't work when service instance registered to multi-zone registries

Posted by "chickenlj (GitHub)" <gi...@apache.org>.
Something is wrong with the picture explaining how it works:

> One provider instance such as B1 should be able to register to multiple registries in the same time.

**One provider only registers to one registry.** So you should have two providers to do the test, with one:

Provider#1
```properties
dubbo.protocol.name=dubbo
dubbo.protocol.port=12345

dubbo.config.multiple=true
dubbo.registry.id=nuc
dubbo.registry.address=nacos://127.0.0.1:8848
dubbo.registry.zone=nuc
dubbo.registry.use-as-config-center=false
```
and another one:

Provider#2
```properties
dubbo.protocol.name=dubbo
dubbo.protocol.port=12345

dubbo.config.multiple=true
dubbo.registry.id=mbp
dubbo.registry.address=nacos://192.168.1.31:8848
dubbo.registry.zone=mbp
dubbo.registry.use-as-config-center=false
```

**It's the Consumer that need to care about all the two registries:**
```properties
server.port=0
## Dubbo Registry
dubbo.registries.a.address=nacos://127.0.0.1:8848?zone=nuc
dubbo.registries.a.zone=nuc
dubbo.registries.a.use-as-config-center=false

dubbo.registries.b.address=nacos://127.0.0.1:8848
dubbo.registries.b.zone=mbp
dubbo.registries.b.use-as-config-center=false
```

[ Full content available at: https://github.com/apache/dubbo/issues/5823 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org