Skip to content

Commit 2f75641

Browse files
committed
Address review comments
1 parent b04e54f commit 2f75641

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

articles/mysql/concepts-connectivity-architecture.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ Azure Database for MySQL supports an additional connection policy, **redirection
7070

7171
This feature is supported in Azure Database for MySQL servers with engine versions 5.6, 5.7, and 8.0.
7272

73-
Preview support for redirection is available in the [PHP mysqlnd_azure](https://github.com/microsoft/mysqlnd_azure) extension, developed by Microsoft, and is available on [PECL](https://pecl.php.net/package/mysqlnd_azure). See the [configuring redirection](./howto-redirection.md) article for more information on how to use redirection in your applications.
73+
Support for redirection is available in the PHP [mysqlnd_azure](https://github.com/microsoft/mysqlnd_azure) extension, developed by Microsoft, and is available on [PECL](https://pecl.php.net/package/mysqlnd_azure). See the [configuring redirection](./howto-redirection.md) article for more information on how to use redirection in your applications.
74+
75+
> [!IMPORTANT]
76+
> Support for redirection in the PHP [mysqlnd_azure](https://github.com/microsoft/mysqlnd_azure) extension is currently in preview.
7477
7578
## Next steps
7679

articles/mysql/howto-redirection.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ms.date: 03/16/2020
1313
This topic explains how to connect an application your Azure Database for MySQL server with redirection mode. Redirection aims to reduce network latency between client applications and MySQL servers by allowing applications to connect directly to backend server nodes.
1414

1515
> [!IMPORTANT]
16-
> Support for redirection in the PHP [mysqlnd_azure](https://github.com/microsoft/mysqlnd_azure) is currently in preview.
16+
> Support for redirection in the PHP [mysqlnd_azure](https://github.com/microsoft/mysqlnd_azure) extension is currently in preview.
1717
1818
## Before you begin
1919
Sign in to the [Azure portal](https://portal.azure.com). Create an Azure Database for MySQL server with engine version 5.6, 5.7, or 8.0. For details, refer to [How to create Azure Database for MySQL server from Portal](quickstart-create-mysql-server-database-using-azure-portal.md) or [How to create Azure Database for MySQL server using CLI](quickstart-create-mysql-server-database-using-azure-cli.md).
@@ -24,15 +24,16 @@ Redirection is currently only supported when SSL is enabled. For details on how
2424

2525
It is highly recommended to use PECL to install and configure the [mysqlnd_azure](https://pecl.php.net/package/mysqlnd_azure) extension.
2626

27-
Redirection logic/behavior beginning version 1.10 was updated and it is recommended to use 1.10+.
28-
2927
### Redirection logic
3028

31-
The redirection behavior is determined by the value of `mysqlnd_azure.enableRedirect`. The table below outlines the behavior of redirection based on the value of this parameter.
29+
>[!IMPORTANT]
30+
> Redirection logic/behavior beginning version 1.1.0 was updated and **it is recommended to use 1.1.0+**.
3231
32+
The redirection behavior is determined by the value of `mysqlnd_azure.enableRedirect`. The table below outlines the behavior of redirection based on the value of this parameter beginning in **version 1.1.0+**.
3333

34+
If you are using an older version of the mysqlnd_azure extension (version 1.0.0-1.0.3), the redirection behavior is determined by the value of `mysqlnd_azure.enabled`. The valid values are `off` (acts similarly as the behavior outlined in the table below) and `on` (acts like `preferred` in the table below).
3435

35-
|**`mysqlnd_azure.enableRedirect` value**| **Behavior**|
36+
|**mysqlnd_azure.enableRedirect value**| **Behavior**|
3637
|----------------------------------------|-------------|
3738
|`off` or `0`|Redirection will not be used. |
3839
|`on` or `1`|- If SSL is not enabled on the Azure Database for MySQL server, no connection will be made. The following error will be returned: *"mysqlnd_azure.enableRedirect is on, but SSL option is not set in connection string. Redirection is only possible with SSL."*<br>- If SSL is enabled on the MySQL server, but redirection is not supported on the server, the first connection is aborted and the following error is returned: *"Connection aborted because redirection is not enabled on the MySQL server or the network package doesn't meet redirection protocol."*<br>- If the MySQL server supports redirection, but the redirected connection failed for any reason, also abort the first proxy connection. Return the error of the redirected connection.|
@@ -48,7 +49,7 @@ The subsequent sections of the document will outline how to install the `mysqlnd
4849
- php-mysql
4950
- Azure Database for MySQL server with SSL enabled
5051

51-
1. Install [mysqlnd_azure](https://github.com/microsoft/mysqlnd_azure) with [PECL](https://pecl.php.net/package/mysqlnd_azure).
52+
1. Install [mysqlnd_azure](https://github.com/microsoft/mysqlnd_azure) with [PECL](https://pecl.php.net/package/mysqlnd_azure). It is recommended to use version 1.1.0+.
5253

5354
```bash
5455
sudo pecl install mysqlnd_azure
@@ -92,14 +93,14 @@ The subsequent sections of the document will outline how to install the `mysqlnd
9293
php -i | findstr "Thread"
9394
```
9495

95-
2. Download the corresponding x64 or x86 version of the [mysqlnd_azure](https://github.com/microsoft/mysqlnd_azure) DLL from [PECL](https://pecl.php.net/package/mysqlnd_azure) that matches your version of PHP. It is recommended to use version 1.10+.
96+
2. Download the corresponding x64 or x86 version of the [mysqlnd_azure](https://github.com/microsoft/mysqlnd_azure) DLL from [PECL](https://pecl.php.net/package/mysqlnd_azure) that matches your version of PHP. It is recommended to use version 1.1.0+.
9697

9798
3. Extract the zip file and find the DLL named `php_mysqlnd_azure.dll`.
9899

99100
4. Locate the extension directory (`extension_dir`) by running the below command:
100101

101102
```cmd
102-
php -i | find "extension_dir"s
103+
php -i | find "extension_dir"
103104
```
104105

105106
5. Copy the `php_mysqlnd_azure.dll` file into the directory returned in step 4.
@@ -133,19 +134,21 @@ $host = '<yourservername>.mysql.database.azure.com';
133134
$username = '<yourusername>@<yourservername>';
134135
$password = '<yourpassword>';
135136
$db_name = 'testdb';
136-
echo "mysqlnd_azure.enabled: ", ini_get("mysqlnd_azure.enabled") == true?"On":"Off", "\n";
137+
138+
echo "mysqlnd_azure.enableRedirect: ", ini_get("mysqlnd_azure.enableRedirect"), "\n";
137139
$db = mysqli_init();
138-
$link = mysqli_real_connect ($db, $host, $username, $password, $db_name, 3306, NULL, MYSQLI_CLIENT_SSL);
140+
//The connection must be configured with SSL for redirection test
141+
$link = mysqli_real_connect ($db, 'your-hostname-with-redirection-enabled', 'user@host', 'password', "db", 3306, NULL, MYSQLI_CLIENT_SSL);
139142
if (!$link) {
140143
die ('Connect error (' . mysqli_connect_errno() . '): ' . mysqli_connect_error() . "\n");
141144
}
142145
else {
143146
echo $db->host_info, "\n"; //if redirection succeeds, the host_info will differ from the hostname you used used to connect
144147
$res = $db->query('SHOW TABLES;'); //test query with the connection
145148
print_r ($res);
146-
$db->close();
149+
$db->close();
147150
}
148-
?>
151+
?>
149152
```
150153
151154
## Next steps

0 commit comments

Comments
 (0)