Skip to content

Implement Azure Database for MySQL redirection #789

Closed

Description

@bgrainger

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.

Activity

  1. bgrainger commented on Apr 3, 2020

    @bgrainger
    MemberAuthor
  2. bgrainger commented on Apr 3, 2020

    @bgrainger
    MemberAuthor

    Related PR in MariaDB Server: MariaDB/server#1472

  3. AdamCoulterOz commented on Jan 29, 2021

    @AdamCoulterOz

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

  4. bgrainger commented on Jan 29, 2021

    @bgrainger
    MemberAuthor

    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.

  5. AdamCoulterOz commented on Feb 2, 2021

    @AdamCoulterOz

    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.

  6. bgrainger commented on Feb 5, 2021

    @bgrainger
    MemberAuthor

    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.

  7. bgrainger commented on Feb 7, 2021

    @bgrainger
    MemberAuthor

    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.

  8. self-assigned this
    on Feb 7, 2021
  9. AdamCoulterOz commented on Feb 9, 2021

    @AdamCoulterOz

    awesome! thanks @bgrainger !

  10. bgrainger commented on Mar 7, 2021

    @bgrainger
    MemberAuthor

    Added in 1.3.0.

  11. added a commit that references this issue on Feb 26, 2024
    560c4a3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions