You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a connection url with multiple hosts, e.g. r2dbc:postgresql://host1:5432,host2:5432/db_name, is used for setup through spring application properties, connections cannot be made to the given hosts. An exception is thrown instead: io.r2dbc.postgresql.PostgresqlConnectionFactory$PostgresConnectionException: Cannot connect to host1:5432,host2:5432:5432
According to the spec, the authority part of the url can contain multiple hosts. I would expect a connection to be made to the first host, and if this connection fails, an attempt is made to connect to the next host in the list, moving on until a connection has been made successfully, or until there is no next host to try.
Possible Solution
Provide actual support for multiple hosts with failover capabilities. This would require quite some changes in the ConnectionUrlParser, ConnectionFactoryOptions, ConnectionFactoryProvider implementation and a
ConnectionFactory implementation that supports failover.
The text was updated successfully, but these errors were encountered:
When parsing a connection url, then multiple hosts are parsed into the host option (see ConnectionUrlParserUnitTests). Whether a driver support multiple hosts or just a single one is up to the actual driver.
Here is the solution, that works without any changes in ConnectionUrlParser, ConnectionFactoryOptions, ConnectionFactoryProvider implementation. It also works with any driver (not only postgresql).
Bug Report
Versions
Current Behavior
When a connection url with multiple hosts, e.g.
r2dbc:postgresql://host1:5432,host2:5432/db_name
, is used for setup through spring application properties, connections cannot be made to the given hosts. An exception is thrown instead:io.r2dbc.postgresql.PostgresqlConnectionFactory$PostgresConnectionException: Cannot connect to host1:5432,host2:5432:5432
Example configuration
Expected behavior/code
According to the spec, the authority part of the url can contain multiple hosts. I would expect a connection to be made to the first host, and if this connection fails, an attempt is made to connect to the next host in the list, moving on until a connection has been made successfully, or until there is no next host to try.
Possible Solution
Provide actual support for multiple hosts with failover capabilities. This would require quite some changes in the ConnectionUrlParser, ConnectionFactoryOptions, ConnectionFactoryProvider implementation and a
ConnectionFactory implementation that supports failover.
The text was updated successfully, but these errors were encountered: