Hello, community,
It's a nice way to support hostname or domain in service discovery, then we can gain more flexibility both developers and users.
Problems
in Dubbo, providers register their IP addresses to Registry Server like ZK/Redis etc. It will be difficult for these case:
- case A: When a provider deployed in a vm container such as Docker, consumers in other computer can't access the IPs in container.
- case B: Across LANs(Local Area Network),consumer can't touch another IP in different LAN.
Target
Solve above problems to support case A & B
Solution
In case A and B, usually we map a proxy port from a remote IP or Container IP to a local IP out of network box.Then if dubbo support hostname or domain in service discovery directly, then we can modify /etc/hosts to redirect consumer's requests to the proxy port to invoke Service.
Example
Configure protocol with a new attribute host:
<dubbo:protocol name="dubbo" port="28080" host="www.example.com" />
Then we start providers, the providers will register a URL such as "dubbo://www.example.com:28080/com.test.HelloService" to registry servers.
We also can config the host param in Service Config or Registry Config.
Assume 10.1.1.3 is the mapping proxy IP for real Provider IP.
Nothing need to configure except opening /etc/hosts and adding one line:
www.example.com 10.1.1.3
And then we can start consumers.
Hello, community,
It's a nice way to support hostname or domain in service discovery, then we can gain more flexibility both developers and users.
Problems
in Dubbo, providers register their IP addresses to Registry Server like ZK/Redis etc. It will be difficult for these case:
Target
Solve above problems to support case A & B
Solution
In case A and B, usually we map a proxy port from a remote IP or Container IP to a local IP out of network box.Then if dubbo support hostname or domain in service discovery directly, then we can modify /etc/hosts to redirect consumer's requests to the proxy port to invoke Service.
Example
Configure protocol with a new attribute host:
Then we start providers, the providers will register a URL such as "dubbo://www.example.com:28080/com.test.HelloService" to registry servers.
We also can config the host param in Service Config or Registry Config.
Nothing need to configure except opening /etc/hosts and adding one line:
www.example.com 10.1.1.3
And then we can start consumers.