Skip to content
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

Implement Azure Database for MySQL redirection #789

Closed
bgrainger opened this issue Mar 27, 2020 · 9 comments
Closed

Implement Azure Database for MySQL redirection #789

bgrainger opened this issue Mar 27, 2020 · 9 comments
Assignees

Comments

@bgrainger
Copy link
Member

Azure Database for MySQL redirection was recently announced for the PHP driver: https://docs.microsoft.com/en-us/azure/mysql/howto-redirection

On connection, the proxy provides connection information that can be used to connect directly to the MySQL backend, bypassing the proxy.

We should add the ability to redirect, and bypass the Azure Database for MySQL proxy.

Documentation request: https://social.msdn.microsoft.com/Forums/en-US/aa7e346a-3574-4175-a0ec-c7ebc0ef1026/documentation-for-redirection-mode?forum=AzureDatabaseforMySQL

Possible approaches:

  1. A new connection string option (ServerRedirection=Off|Preferred|On). When a connection is opened to the proxy, and a Location: "header" is returned, transparently reconnect to the new server location. Should the new connection info be cached and used by default the next time the pool needs a new connection, or should each new connection hit the proxy initially to get a chance to get updated backend location information? (Probably the latter.)
  2. After connecting, a MySqlConnection.RedirectionLocation property is populated with a connection string for the new location that can be used with CloneWith. The user is responsible for reopening a new connection and refreshing the location periodically.
@bgrainger
Copy link
Member Author

Related PR in Connector/J: mariadb-corporation/mariadb-connector-j#134

@bgrainger
Copy link
Member Author

Related PR in MariaDB Server: MariaDB/server#1472

@AdamCoulterOz
Copy link

@bgrainger - any idea on when this might happen? :-)

@bgrainger
Copy link
Member Author

I haven't heard anything from the Azure team in a while, but my understanding was that the server-side implementation of the protocol hadn't been finalised yet, so it could be premature to code a client-side implementation.

@AdamCoulterOz
Copy link

AdamCoulterOz commented Feb 2, 2021

I haven't heard anything from the Azure team in a while, but my understanding was that the server-side implementation of the protocol hadn't been finalised yet, so it could be premature to code a client-side implementation.

They've been in public preview with host redirection with the php mysqlnd_azure client library since early Aug 2020.

https://docs.microsoft.com/en-us/azure/mysql/howto-redirection

I recently raised an Azure support request which went through to the product team, and they said they were waiting for this library (MySqlConnector) to be updated to provide equivalent dotnet support.

@bgrainger
Copy link
Member Author

I see that the MariaDB PRs still aren't merged, but I haven't checked on the actual behaviour of Azure Database for MySQL since last year. I'll re-test it and see if this is ready to ship.

@bgrainger
Copy link
Member Author

A version for Azure Database for MySQL is available in 1.3.0-beta.3.

It's opt-in, so add ServerRedirectionMode=Preferred (or =Required) to your connection string to use it.

@bgrainger bgrainger self-assigned this Feb 7, 2021
@AdamCoulterOz
Copy link

awesome! thanks @bgrainger !

@bgrainger
Copy link
Member Author

Added in 1.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants