-
Notifications
You must be signed in to change notification settings - Fork 119
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
Automatically configure and fail-over connections using DNS #2043
Comments
…2044) A connection may be configured to using a DNS name instead of an instance name. If the cloudSqlInstance property is set to be a domain name instead of an instance name, the connector will look up a SRV record for that name and connect to that instance. There should be exactly 1 SRV for the database instance. The connector will always use the SRV record with the highest priority. Part of #2043
…2043. When connecting to a Cloud SQL database using a domain name like `db.example.com`, you may now set the domain name in the JDBC URL. For example, you can use a URL like "jdbc:mysql://db.example.com/my-schema?socketFactory=socketFactory=com.google.cloud.sql.mysql.SocketFactory" The socket factory will detect "db.example.com" and look up the TXT record to resolve the instance name. See #2043 for the whole feature definition.
@derek-gfs Thanks for showing your interest here! We really appreciate it 😄 I believe @hessjcg will be picking back up this work in the coming week or two and getting these PRs across the line. We are still waiting on a backend change to fully roll out before the full support of the feature in the Connectors will be possible. |
See #2043 for the whole feature definition.
…2043. When connecting to a Cloud SQL database using a domain name like `db.example.com`, you may now set the domain name in the JDBC URL. For example, you can use a URL like "jdbc:mysql://db.example.com/my-schema?socketFactory=socketFactory=com.google.cloud.sql.mysql.SocketFactory" The socket factory will detect "db.example.com" and look up the TXT record to resolve the instance name. See #2043 for the whole feature definition.
…2043. When connecting to a Cloud SQL database using a domain name like `db.example.com`, you may now set the domain name in the JDBC URL. For example, you can use a URL like "jdbc:mysql://db.example.com/my-schema?socketFactory=socketFactory=com.google.cloud.sql.mysql.SocketFactory" The socket factory will detect "db.example.com" and look up the TXT record to resolve the instance name. See #2043 for the whole feature definition.
wip: fix validation in InternalConnectorRegistry wip: e2e postgres custom san test
Add DomainName to connection config, and an InstanceNameResolver function. This will allow the connector to be configured using a domain name referencing the instead of the instance name. This is part of the implementation of #2043.
…2043. (#2050) When connecting to a Cloud SQL database using a domain name like `db.example.com`, you may now set the domain name in the JDBC URL. For example, you can use a URL like "jdbc:mysql://db.example.com/my-schema?socketFactory=socketFactory=com.google.cloud.sql.mysql.SocketFactory" The socket factory will detect "db.example.com" and look up the TXT record to resolve the instance name. See #2043 for the whole feature definition.
…2047) The dialer may be configured to use a DNS name to look up the instance name instead of configuring the connector with the instance name directly. Add a DNS TXT record for the Cloud SQL instance to a private DNS server or a private Google Cloud DNS Zone used by your application. For example: Record type: TXT Name: prod-db.mycompany.example.com – This is the domain name used by the application Value: my-project:region:my-instance – This is the instance connection name Configure the dialer with the cloudsqlconn.WithDNSResolver() option. Open a database connection using the DNS name: HOST: The domain name configured in your DNS TXT record. Base JDBC URL: jdbc:mysql://<HOST>/<DATABASE_NAME> SOCKET_FACTORY_CLASS: com.google.cloud.sql.mysql.SocketFactory The full JDBC URL for MySQL should look like this: String jdbcUrl = "jdbc:mysql://<HOST>/<DATABASE_NAME>?" + "&socketFactory=com.google.cloud.sql.mysql.SocketFactory" + "&user=<MYSQL_USER_NAME>" + "&password=<MYSQL_USER_PASSWORD>"; See also: the Cloud SQL Go Connector implementation Part of #2043
…nnector. (#2103) Now, the connector will detect if the R2DBC HOST connection property contains a domain name or a Cloud SQL instance name. If HOST has a domain name, the connector will look up the domain name to determine the instance name. For example, if the R2DBC url is set to r2dbc:gcp:mssql://<DB_USER>:<DB_PASS>@db.example.com/db, the connector will lookup the TXT record for db.example.com. The record should contain a valid Cloud SQL instance name. Part of #2043
Feature Description
The java connector may be configured to connect to a Cloud SQL instance using a DNS name.
When the JDBC connection properties does not contain the
cloudSqlInstance
property, the connector will attempt to use the hostname from the JDBC URL to resolve name using DNS. The connector will query the local DNS for a TXT record. The TXT should contain an instance name matching that DNS name. The connector will use the instance name from the TXT record to connect to the Cloud SQL instance.The connector will periodically query that DNS. If the instance name in the DNS record changes, the connector will terminate all open connections to the old instance. Then, it will reconfigure itself to open connections to the new instance.
This enables several DNS-related features by allowing configuration through DNS.
Users can configure their database clients using the domain name instead of the instance name.
Users can fail-over database clients when they change the DNS entry for the database instance.
This is the Java implementation of GoogleCloudPlatform/cloud-sql-go-connector#842
The text was updated successfully, but these errors were encountered: