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
Copy file name to clipboardExpand all lines: articles/mysql/concepts-connectivity-architecture.md
+51-39Lines changed: 51 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: kummanish
5
5
ms.author: manishku
6
6
ms.service: mysql
7
7
ms.topic: conceptual
8
-
ms.date: 12/02/2019
8
+
ms.date: 03/16/2020
9
9
---
10
10
11
11
# Connectivity architecture in Azure Database for MySQL
@@ -23,48 +23,60 @@ The following table lists the primary and secondary IPs of the Azure Database fo
23
23
24
24
|**Region Name**|**Gateway IP Addresses**|
25
25
|:----------------|:-------------|
26
-
| Australia Central| 20.36.105.0|
27
-
| Australia Central2| 20.36.113.0|
28
-
| Australia East | 13.75.149.87, 40.79.161.1|
29
-
| Australia South East |191.239.192.109, 13.73.109.251|
30
-
| Brazil South | 104.41.11.5, 191.233.201.8, 191.233.200.16|
31
-
| Canada Central |40.85.224.249|
32
-
| Canada East | 40.86.226.166|
33
-
| Central US | 23.99.160.139, 13.67.215.62|
34
-
| China East | 139.219.130.35|
35
-
| China East 2 | 40.73.82.1|
36
-
| China North | 139.219.15.17|
37
-
| China North 2 | 40.73.50.0|
38
-
| East Asia | 191.234.2.139, 52.175.33.150, 13.75.33.20, 13.75.33.21|
39
-
| East US | 40.121.158.30, 191.238.6.43|
40
-
| East US 2 |40.79.84.180, 191.239.224.107, 52.177.185.181|
41
-
| France Central | 40.79.137.0, 40.79.129.1|
42
-
| Germany Central | 51.4.144.100|
43
-
| Germany North East | 51.5.144.179|
44
-
| India Central | 104.211.96.159|
45
-
| India South | 104.211.224.146|
46
-
| India West | 104.211.160.80|
47
-
| Japan East | 13.78.61.196, 191.237.240.43|
26
+
| Australia Central| 20.36.105.0|
27
+
| Australia Central2| 20.36.113.0|
28
+
| Australia East | 13.75.149.87, 40.79.161.1|
29
+
| Australia South East |191.239.192.109, 13.73.109.251|
30
+
| Brazil South | 104.41.11.5, 191.233.201.8, 191.233.200.16|
31
+
| Canada Central |40.85.224.249|
32
+
| Canada East | 40.86.226.166|
33
+
| Central US | 23.99.160.139, 13.67.215.62|
34
+
| China East | 139.219.130.35|
35
+
| China East 2 | 40.73.82.1|
36
+
| China North | 139.219.15.17|
37
+
| China North 2 | 40.73.50.0|
38
+
| East Asia | 191.234.2.139, 52.175.33.150, 13.75.33.20, 13.75.33.21|
39
+
| East US | 40.121.158.30, 191.238.6.43|
40
+
| East US 2 |40.79.84.180, 191.239.224.107, 52.177.185.181|
41
+
| France Central | 40.79.137.0, 40.79.129.1|
42
+
| Germany Central | 51.4.144.100|
43
+
| Germany North East | 51.5.144.179|
44
+
| India Central | 104.211.96.159|
45
+
| India South | 104.211.224.146|
46
+
| India West | 104.211.160.80|
47
+
| Japan East | 13.78.61.196, 191.237.240.43|
48
48
| Japan West | 104.214.148.156, 191.238.68.11, 40.74.96.7, 40.74.96.6 |
49
-
| Korea Central | 52.231.32.42|
50
-
| Korea South | 52.231.200.86|
51
-
| North Central US | 23.96.178.199, 23.98.55.75, 52.162.104.35, 52.162.104.36|
52
-
| North Europe | 40.113.93.91, 191.235.193.75|
53
-
| South Africa North | 102.133.152.0|
54
-
| South Africa West| 102.133.24.0|
55
-
| South Central US |13.66.62.124, 23.98.162.75, 104.214.16.39, 20.45.120.0|
56
-
| South East Asia | 104.43.15.0, 23.100.117.95, 40.78.233.2, 23.98.80.12|
57
-
| UAE Central | 20.37.72.64|
58
-
| UAE North | 65.52.248.0|
59
-
| UK South | 51.140.184.11|
60
-
| UK West | 51.141.8.11|
61
-
| West Central US | 13.78.145.25|
62
-
| West Europe | 40.68.37.158, 191.237.232.75|
63
-
| West US | 104.42.238.205, 23.99.34.75|
64
-
| West US 2 | 13.66.226.202|
49
+
| Korea Central | 52.231.32.42|
50
+
| Korea South | 52.231.200.86|
51
+
| North Central US | 23.96.178.199, 23.98.55.75, 52.162.104.35, 52.162.104.36|
52
+
| North Europe | 40.113.93.91, 191.235.193.75|
53
+
| South Africa North | 102.133.152.0|
54
+
| South Africa West| 102.133.24.0|
55
+
| South Central US |13.66.62.124, 23.98.162.75, 104.214.16.39, 20.45.120.0|
56
+
| South East Asia | 104.43.15.0, 23.100.117.95, 40.78.233.2, 23.98.80.12|
57
+
| UAE Central | 20.37.72.64|
58
+
| UAE North | 65.52.248.0|
59
+
| UK South | 51.140.184.11|
60
+
| UK West | 51.141.8.11|
61
+
| West Central US | 13.78.145.25|
62
+
| West Europe | 40.68.37.158, 191.237.232.75|
63
+
| West US | 104.42.238.205, 23.99.34.75|
64
+
| West US 2 | 13.66.226.202|
65
65
||||
66
66
67
+
## Connection redirection
68
+
69
+
Azure Database for MySQL supports an additional connection policy, **redirection**, that helps to reduce network latency between client applications and MySQL servers. With this feature, after the initial TCP session is established to the Azure Database for MySQL server, the server returns the backend address of the node hosting the MySQL server to the client. Thereafter, all subsequent packets flow directly to the server, bypassing the gateway. As packets flow directly to the server, latency and throughput have improved performance.
70
+
71
+
This feature is supported in Azure Database for MySQL servers with engine versions 5.6, 5.7, and 8.0.
72
+
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.
77
+
67
78
## Next steps
68
79
69
80
*[Create and manage Azure Database for MySQL firewall rules using the Azure portal](./howto-manage-firewall-using-portal.md)
70
81
*[Create and manage Azure Database for MySQL firewall rules using Azure CLI](./howto-manage-firewall-using-cli.md)
82
+
*[Configure redirection with Azure Database for MySQL](./howto-redirection.md)
title: Connect with redirection - Azure Database for MySQL
3
+
description: This article describes how you can configure you application to connect to Azure Database for MySQL with redirection.
4
+
author: ajlam
5
+
ms.author: andrela
6
+
ms.service: mysql
7
+
ms.topic: conceptual
8
+
ms.date: 03/16/2020
9
+
---
10
+
11
+
# Connect to Azure Database for MySQL with redirection
12
+
13
+
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.
14
+
15
+
> [!IMPORTANT]
16
+
> Support for redirection in the PHP [mysqlnd_azure](https://github.com/microsoft/mysqlnd_azure) extension is currently in preview.
17
+
18
+
## Before you begin
19
+
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).
20
+
21
+
Redirection is currently only supported when SSL is enabled. For details on how to configure SSL, see [Using SSL with Azure Database for MySQL](https://docs.microsoft.com/azure/mysql/howto-configure-ssl#step-3-enforcing-ssl-connections-in-azure).
22
+
23
+
## PHP
24
+
25
+
It is highly recommended to use PECL to install and configure the [mysqlnd_azure](https://pecl.php.net/package/mysqlnd_azure) extension.
26
+
27
+
### Redirection logic
28
+
29
+
>[!IMPORTANT]
30
+
> Redirection logic/behavior beginning version 1.1.0 was updated and **it is recommended to use 1.1.0+**.
31
+
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+**.
33
+
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).
|`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.|
40
+
|`preferred` or `2`<br> (default value)|- mysqlnd_azure will use redirection if possible.<br>- If the connection does not use SSL, the server does not support redirection, or the redirected connection fails to connect for any non-fatal reason while the proxy connection is still a valid one, it will fall back to the first proxy connection.|
41
+
42
+
The subsequent sections of the document will outline how to install the `mysqlnd_azure` extension using PECL and set the value of this parameter.
43
+
44
+
### Ubuntu Linux
45
+
46
+
#### Prerequisites
47
+
- PHP versions 7.2.15+ and 7.3.2+
48
+
- PHP PEAR
49
+
- php-mysql
50
+
- Azure Database for MySQL server with SSL enabled
51
+
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+.
53
+
54
+
```bash
55
+
sudo pecl install mysqlnd_azure
56
+
```
57
+
58
+
2. Locate the extension directory (`extension_dir`) by running the below:
59
+
60
+
```bash
61
+
php -i | grep "extension_dir"
62
+
```
63
+
64
+
3. Change directories to the returned folder and ensure `mysqlnd_azure.so` is located in this folder.
65
+
66
+
4. Locate the folder for .ini files by running the below:
67
+
68
+
```bash
69
+
php -i | grep "dir for additional .ini files"
70
+
```
71
+
72
+
5. Change directories to this returned folder.
73
+
74
+
6. Create a new .ini file for`mysqlnd_azure`. Make sure the alphabet order of the name is after that of mysqnld, since the modules are loaded according to the name order of the ini files. For example, if`mysqlnd` .ini is named `10-mysqlnd.ini`, name the mysqlnd ini as `20-mysqlnd-azure.ini`.
75
+
76
+
7. Within the new .ini file, add the following lines to enable redirection.
77
+
78
+
```bash
79
+
extension=mysqlnd_azure
80
+
mysqlnd_azure.enableRedirect = on/off/preferred
81
+
```
82
+
83
+
### Windows
84
+
85
+
#### Prerequisites
86
+
- PHP versions 7.2.15+ and 7.3.2+
87
+
- php-mysql
88
+
- Azure Database for MySQL server with SSL enabled
89
+
90
+
1. Determine if you are running a x64 or x86 version of PHP by running the following command:
91
+
92
+
```cmd
93
+
php -i | findstr "Thread"
94
+
```
95
+
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+.
97
+
98
+
3. Extract the zip file and find the DLL named `php_mysqlnd_azure.dll`.
99
+
100
+
4. Locate the extension directory (`extension_dir`) by running the below command:
101
+
102
+
```cmd
103
+
php -i | find "extension_dir"
104
+
```
105
+
106
+
5. Copy the `php_mysqlnd_azure.dll` file into the directory returned in step 4.
107
+
108
+
6. Locate the PHP folder containing the `php.ini` file using the following command:
109
+
110
+
```cmd
111
+
php -i | find "Loaded Configuration File"
112
+
```
113
+
114
+
7. Modify the `php.ini` file and add the following extra lines to enable redirection.
115
+
116
+
Under the Dynamic Extensions section:
117
+
```cmd
118
+
extension=mysqlnd_azure
119
+
```
120
+
121
+
Under the Module Settings section:
122
+
```cmd
123
+
[mysqlnd_azure]
124
+
mysqlnd_azure.enableRedirect = on/off/preferred
125
+
```
126
+
127
+
### Confirm redirection
128
+
129
+
You can also confirm redirection is configured with the below sample PHP code. Create a PHP file called `mysqlConnect.php` and paste the below code. Update the server name, username, and password with your own.
0 commit comments