-
Notifications
You must be signed in to change notification settings - Fork 345
-
I have a kubernetes cluster with manticore inside it (which uses mysql as a protocol); I couldn't find from the docs but does mysqlconnector allow me to do something like:
"Server=manticore-manticoresearch-worker-svc, User=manticore, Password=manticore, Database=manticore, LoadBalance=RoundRobin, DnsCheckInterval=5"
Where it would connect to either 10.240.0.38 or 10.240.0.19 (in this case), instead of hardcoding the addresses (not an option since they can change any any moment)
# host manticore-manticoresearch-worker-svc
manticore-manticoresearch-worker-svc.manticorecluster.svc.cluster.local has address 10.240.0.38
manticore-manticoresearch-worker-svc.manticorecluster.svc.cluster.local has address 10.240.0.19
Beta Was this translation helpful? Give feedback.
All reactions
LoadBalance=RoundRobin
currently only applies to comma-delimited entries in the Server
connection string option; multiple IP addresses for a single host name are tried in order. (However, if Dns.GetHostAddresses
returns the IP addresses in a different order each time it's invoked by MySqlConnector, then MySqlConnector will end up alternating between them.)
DnsCheckInterval=5
will cause the connection pool to be cleared (and new connections to be made) if the host name manticore-manticoresearch-worker-svc
ever resolves to a different set of IP addresses.
So it will "connect to either 10.240.0.38 or 10.240.0.19 (in this case)", but it may prefer to make all connections to 10.240.0.38 based ...
Replies: 2 comments
-
LoadBalance=RoundRobin
currently only applies to comma-delimited entries in the Server
connection string option; multiple IP addresses for a single host name are tried in order. (However, if Dns.GetHostAddresses
returns the IP addresses in a different order each time it's invoked by MySqlConnector, then MySqlConnector will end up alternating between them.)
DnsCheckInterval=5
will cause the connection pool to be cleared (and new connections to be made) if the host name manticore-manticoresearch-worker-svc
ever resolves to a different set of IP addresses.
So it will "connect to either 10.240.0.38 or 10.240.0.19 (in this case)", but it may prefer to make all connections to 10.240.0.38 based on the behaviour of Dns.GetHostAddresses
. (Enabling "Trace" logging will show what's actually happening.)
Beta Was this translation helpful? Give feedback.
All reactions
-
Cool. Since ping picks a different instance every connection, i could just let it do that automatically then. I'll play with this, thanks!
Beta Was this translation helpful? Give feedback.