-
Notifications
You must be signed in to change notification settings - Fork 657
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
How can a client send a list of IP addresses for load balancing? #1307
Comments
grpc-js does not currently have a mechanism to do exactly what you're trying to do. The existing name resolution+load balancing functionality can load balance across multiple addresses, when DNS records or hosts file records have multiple entries, but they always use the same port, and there isn't currently a way to load balance to multiple ports on the same address. |
By default, grpc-js only uses one address, so to enable true load balancing you will need to set a default service config (documented here). You can do this by passing the client construction argument const serviceConfig = {
'loadBalancingConfig': [
{ round_robin: {} }
]
} Then you can construct your client like this to enable round robin load balancing: const client = new Client(address, credentials, { 'grpc.service_config': JSON.stringify(serviceConfig) }); |
@murgatroid99 Is the parameter of |
No, it's the DNS name of the gRPC server. |
I have read the code of |
The |
Will you consider exporting the |
That API is not currently designed to be part of the public API. It would need to go through an API design process and probably some revisions before we export it like that. |
I'm glade to hear that. Expecting you complete it. |
const client = new Client(address, credentials, { 'grpc.service_config': JSON.stringify(serviceConfig) }); then, how address can be multi server ip, or how Client can be iniciated with a list of ip addreses? |
Yes, grpc-js now supports the |
thanks, it works! |
I get the following error
The text was updated successfully, but these errors were encountered: