-
Notifications
You must be signed in to change notification settings - Fork 26.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal]support hostname or domain in service discovery. #2043
Comments
In docker ,you can use net=host to resolve case A or you can use same brige. |
@chutian52 your suggestion can work well for a little part of cases. |
I agree this proposal about static resolution for registry service. It can be achieved by extending the registry service but also should add more property for the referenceBean about the static host about the service. |
+1. In a morden cluster environment, it would be more frequently to expand/shrink the cluster than expected. We should support putting name instead of static IP addr into the registry center. |
Dubbo目前已支持Provider将自身的host注册到注册中心,注册中心可以根据host自动获取服务的IP。
您可以尝试一下 |
Dubbo has supported Providers to register their host to the registry server, and registry server can automatically get the IP by host name. |
I think this proposal can lead to another question that how can we use dubbo on a kubernetes cluster. There are some scenarios that kube-dns provides a service-name to pod mapping, and users want to using Dubbo to call a service(in dubbo) by a service-name(in k8s). |
set host=service-name for purpose? @lisirrx |
I agree with @lamianer , today's Dubbo has already support configuring <dubbo:protocol name="dubbo" port="20880" host="localhost"/> If Zookeeper is used as registry center, then the following URL will be registered as provider:
|
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.
The text was updated successfully, but these errors were encountered: