Skip to content

Commit 8e241d8

Browse files
authored
Merge pull request #235805 from HJToland3/main
neil
2 parents a6fb93a + 272b3f7 commit 8e241d8

File tree

2 files changed

+263
-36
lines changed

2 files changed

+263
-36
lines changed

articles/mysql/flexible-server/concepts-server-parameters.md

Lines changed: 93 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: Server parameters - Azure Database for MySQL - Flexible Server
3-
description: This topic provides guidelines for configuring server parameters in Azure Database for MySQL - Flexible Server.
3+
description: This article provides guidelines for configuring server parameters in Azure Database for MySQL - Flexible Server.
44
ms.service: mysql
55
ms.subservice: flexible-server
66
ms.topic: conceptual
77
author: code-sidd
88
ms.author: sisawant
99
ms.custom: event-tier1-build-2022
10-
ms.date: 05/24/2022
10+
ms.date: 04/26/2023
1111
---
1212
# Server parameters in Azure Database for MySQL - Flexible Server
1313

@@ -23,21 +23,22 @@ Azure Database for MySQL - Flexible Server exposes the ability to change the val
2323

2424
## Configurable server parameters
2525

26-
You can manage Azure Database for MySQL - Flexible Server configuration using server parameters. The server parameters are configured with the default and recommended value when you create the server. The server parameter blade on Azure portal shows both the modifiable and non-modifiable server parameters. The non-modifiable server parameters are greyed out.
26+
You can manage Azure Database for MySQL - Flexible Server configuration using server parameters. The server parameters are configured with the default and recommended value when you create the server. The server parameter blade on Azure portal shows both the modifiable and nonmodifiable server parameters. The nonmodifiable server parameters are greyed out.
2727

2828
The list of supported server parameters is constantly growing. Use the server parameters tab in the Azure portal to view the full list and configure server parameters values.
2929

30-
Refer to the following sections below to learn more about the limits of the several commonly updated server parameters. The limits are determined by the compute tier and size (vCores) of the server.
30+
Refer to the following sections to learn more about the limits of the several commonly updated server parameters. The limits are determined by the compute tier and size (vCores) of the server.
3131

3232
> [!NOTE]
33-
>* If you are looking to modify a server parameter which are static using the portal, it will request you to restart the server for the changes to take effect. In case you are using automation scripts (using tools like ARM templates , Terraform, Azure CLI etc) then your script should have a provision to restart the service for the settings to take effect even if you are changing the configurations as a part of create experience.
34-
>* If you are looking to modify a server parameter which is non-modifiable but you would like to see as a modifiable for your environment, please open a [UserVoice](https://feedback.azure.com/d365community/forum/47b1e71d-ee24-ec11-b6e6-000d3a4f0da0) item or vote if the feedback already exist which can help us prioritize.
33+
>
34+
>* If you modify a static server parameter using the portal, you need to restart the server for the changes to take effect. In case you are using automation scripts (using tools like ARM templates , Terraform, Azure CLI etc) then your script should have a provision to restart the service for the settings to take effect even if you are changing the configurations as a part of create experience.
35+
>* If you want to modify a non-modifiable server parameter for your environment, please open a [UserVoice](https://feedback.azure.com/d365community/forum/47b1e71d-ee24-ec11-b6e6-000d3a4f0da0) item or vote if the feedback already exist which can help us prioritize.
3536
3637
### log_bin_trust_function_creators
3738

3839
In Azure Database for MySQL - Flexible Server, binary logs are always enabled (that is, `log_bin` is set to ON). log_bin_trust_function_creators is set to ON by default in flexible servers.
3940

40-
The binary logging format is always **ROW** and all connections to the server **ALWAYS** use row-based binary logging. With row-based binary logging, security issues do not exist and binary logging cannot break, so you can safely allow [`log_bin_trust_function_creators`](https://dev.mysql.com/doc/refman/5.7/en/replication-options-binary-log.html#sysvar_log_bin_trust_function_creators) to remain **ON**.
41+
The binary logging format is always **ROW** and all connections to the server **ALWAYS** use row-based binary logging. With row-based binary logging, security issues don't exist and binary logging can't break, so you can safely allow [`log_bin_trust_function_creators`](https://dev.mysql.com/doc/refman/5.7/en/replication-options-binary-log.html#sysvar_log_bin_trust_function_creators) to remain **ON**.
4142

4243
If [`log_bin_trust_function_creators`] is set to OFF, if you try to create triggers you may get errors similar to *you do not have the SUPER privilege and binary logging is enabled (you might want to use the less safe `log_bin_trust_function_creators` variable)*.
4344

@@ -73,16 +74,14 @@ Azure Database for MySQL - Flexible Server supports at largest, **4 TB**, in a s
7374

7475
### innodb_log_file_size
7576

76-
[innodb_log_file_size](https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_file_size) is the size in bytes of each [log file](https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_log_file) in a [log group](https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_log_group). The combined size of log files [(innodb_log_file_size](https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_file_size) * [innodb_log_files_in_group](https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_files_in_group)) cannot exceed a maximum value that is slightly less than 512GB). A bigger log file size is better for performance, but it has a drawback that the recovery time after a crash will be high. You need to balance recovery time in the rare event of a crash recovery versus maximizing throughput during peak operations. These can also result in longer restart times. You can configure innodb_log_size to any of these values - 256MB, 512MB, 1GB or 2GB for Azure Database for MySQL - Flexible Server. The parameter is static and requires a restart.
77+
[innodb_log_file_size](https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_file_size) is the size in bytes of each [log file](https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_log_file) in a [log group](https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_log_group). The combined size of log files [(innodb_log_file_size](https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_file_size) * [innodb_log_files_in_group](https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_files_in_group)) can't exceed a maximum value that is slightly less than 512 GB). A bigger log file size is better for performance, but it has a drawback that the recovery time after a crash is high. You need to balance recovery time in the rare event of a crash recovery versus maximizing throughput during peak operations. These can also result in longer restart times. You can configure innodb_log_size to any of these values - 256 MB, 512 MB, 1 GB or 2 GB for Azure Database for MySQL - Flexible Server. The parameter is static and requires a restart.
7778

7879
> [!NOTE]
7980
> If you have changed the parameter innodb_log_file_size from default, check if the value of "show global status like 'innodb_buffer_pool_pages_dirty'" stays at 0 for 30 seconds to avoid restart delay.
8081
81-
82-
8382
### max_connections
8483

85-
The value of max_connection is determined by the memory size of the server.
84+
The value of `max_connection` is determined by the memory size of the server.
8685

8786
|**Pricing Tier**|**vCore(s)**|**Memory Size (GiB)**|**Default value**|**Min value**|**Max value**|
8887
|---|---|---|---|---|---|
@@ -110,14 +109,14 @@ When connections exceed the limit, you may receive the following error:
110109
> [!IMPORTANT]
111110
>For best experience, we recommend that you use a connection pooler like ProxySQL to efficiently manage connections.
112111
113-
Creating new client connections to MySQL takes time and once established, these connections occupy database resources, even when idle. Most applications request many short-lived connections, which compounds this situation. The result is fewer resources available for your actual workload leading to decreased performance. A connection pooler that decreases idle connections and reuses existing connections will help avoid this. To learn about setting up ProxySQL, visit our [blog post](https://techcommunity.microsoft.com/t5/azure-database-for-mysql/load-balance-read-replicas-using-proxysql-in-azure-database-for/ba-p/880042).
112+
Creating new client connections to MySQL takes time and once established, these connections occupy database resources, even when idle. Most applications request many short-lived connections, which compounds this situation. The result is fewer resources available for your actual workload leading to decreased performance. A connection pooler that decreases idle connections and reuses existing connections helps to avoid this. To learn about setting up ProxySQL, visit our [blog post](https://techcommunity.microsoft.com/t5/azure-database-for-mysql/load-balance-read-replicas-using-proxysql-in-azure-database-for/ba-p/880042).
114113

115114
>[!Note]
116115
>ProxySQL is an open source community tool. It is supported by Microsoft on a best effort basis. In order to get production support with authoritative guidance, you can evaluate and reach out to [ProxySQL Product support](https://proxysql.com/services/support/).
117116
118117
### innodb_strict_mode
119118

120-
If you receive an error similar to "Row size too large (> 8126)", you may want to turn OFF the parameter **innodb_strict_mode**. The server parameter **innodb_strict_mode** is not allowed to be modified globally at the server level because if row data size is larger than 8k, the data will be truncated without an error, which can lead to potential data loss. We recommend modifying the schema to fit the page size limit.
119+
If you receive an error similar to "Row size too large (> 8126)", you may want to turn OFF the parameter **innodb_strict_mode**. The server parameter **innodb_strict_mode** isn't allowed to be modified globally at the server level because if row data size is larger than 8k, the data is truncated without an error, which can lead to potential data loss. We recommend modifying the schema to fit the page size limit.
121120

122121
This parameter can be set at a session level using `init_connect`. To set **innodb_strict_mode** at session level, refer to [setting parameter not listed](./how-to-configure-server-parameters-portal.md#setting-non-modifiable-server-parameters).
123122

@@ -126,19 +125,93 @@ This parameter can be set at a session level using `init_connect`. To set **inno
126125
127126
### time_zone
128127

129-
Upon initial deployment, an Azure for MySQL Flexible Server includes system tables for time zone information, but these tables are not populated. The time zone tables can be populated by calling the `mysql.az_load_timezone` stored procedure from a tool like the MySQL command line or MySQL Workbench. Refer to the [Azure portal](./how-to-configure-server-parameters-portal.md#working-with-the-time-zone-parameter) or [Azure CLI](./how-to-configure-server-parameters-cli.md#working-with-the-time-zone-parameter) articles for how to call the stored procedure and set the global or session-level time zones.
128+
Upon initial deployment, an Azure for MySQL Flexible Server includes system tables for time zone information, but these tables aren't populated. The time zone tables can be populated by calling the `mysql.az_load_timezone` stored procedure from a tool like the MySQL command line or MySQL Workbench. Refer to the [Azure portal](./how-to-configure-server-parameters-portal.md#working-with-the-time-zone-parameter) or [Azure CLI](./how-to-configure-server-parameters-cli.md#working-with-the-time-zone-parameter) articles for how to call the stored procedure and set the global or session-level time zones.
130129

131-
### binlog_expire_logs_seconds
130+
### binlog_expire_logs_seconds
132131

133132
In Azure Database for MySQL this parameter specifies the number of seconds the service waits before purging the binary log file.
134133

135-
The binary log contains “events” that describe database changes such as table creation operations or changes to table data. It also contains events for statements that potentially could have made changes. The binary log are used mainly for two purposes , replication and data recovery operations. Usually, the binary logs are purged as soon as the handle is free from service, backup or the replica set. In case of multiple replica, it would wait for the slowest replica to read the changes before it is been purged. If you want to persist binary logs for a more duration of time you can configure the parameter binlog_expire_logs_seconds. If the binlog_expire_logs_seconds is set to 0, which is the default value, it will purge as soon as the handle to the binary log is freed. If binlog_expire_logs_seconds > 0, then it would wait until the seconds configured before it purges. For Azure database for MySQL, managed features like backup and read replica purging of binary files are handled internally . When you replicate the data-out from the Azure Database for MySQL service, this parameter needs to be set in primary to avoid purging of binary logs before the replica reads from the changes from the primary. If you set the binlog_expire_logs_seconds to a higher value, then the binary logs will not get purged soon enough and can lead to increase in the storage billing.
134+
The binary log contains “events” that describe database changes such as table creation operations or changes to table data. It also contains events for statements that potentially could have made changes. The binary log is used mainly for two purposes, replication and data recovery operations. Usually, the binary logs are purged as soon as the handle is free from service, backup or the replica set. If there are multiple replicas, the binary logs wait for the slowest replica to read the changes before it's been purged. If you want to persist binary logs for a more duration of time, you can configure the parameter binlog_expire_logs_seconds. If the binlog_expire_logs_seconds is set to 0, which is the default value, it purges as soon as the handle to the binary log is freed. If binlog_expire_logs_seconds > 0, then it would wait until the seconds configured before it purges. For Azure database for MySQL, managed features like backup and read replica purging of binary files are handled internally. When you replicate the data-out from the Azure Database for MySQL service, this parameter needs to be set in primary to avoid purging of binary logs before the replica reads from the changes from the primary. If you set the binlog_expire_logs_seconds to a higher value, then the binary logs won't get purged soon enough and can lead to increase in the storage billing.
135+
136+
### event_scheduler
137+
138+
In Azure Database for MySQL, the `event_schedule` server parameter manages creating, scheduling, and running events, i.e., tasks that run according to a schedule, and they're run by a special event scheduler thread. When the `event_scheduler` parameter is set to ON, the event scheduler thread is listed as a daemon process in the output of SHOW PROCESSLIST. You can create and schedule events using the following SQL syntax:
139+
140+
```sql
141+
CREATE EVENT <event name>
142+
ON SCHEDULE EVERY _ MINUTE / HOUR / DAY
143+
STARTS TIMESTAMP / CURRENT_TIMESTAMP
144+
ENDS TIMESTAMP / CURRENT_TIMESTAMP + INTERVAL 1 MINUTE / HOUR / DAY
145+
COMMENT ‘<comment>
146+
DO
147+
<your statement>;
148+
```
149+
150+
> [!NOTE]
151+
> For more information about creating an event, see the MySQL Event Scheduler documentation here:
152+
>
153+
> * [MySQL :: MySQL 5.7 Reference Manual :: 23.4 Using the Event Scheduler](https://dev.mysql.com/doc/refman/5.7/en/event-scheduler.html)
154+
> * [MySQL :: MySQL 8.0 Reference Manual :: 25.4 Using the Event Scheduler](https://dev.mysql.com/doc/refman/8.0/en/event-scheduler.html)
155+
>
156+
157+
#### Configuring the event_scheduler server parameter
158+
159+
The following scenario illustrates one way to use the `event_scheduler` parameter in Azure Database for MySQL. To demonstrate the scenario, consider the following example, a simple table:
160+
161+
```azurecli
162+
mysql> describe tab1;
163+
+-----------+-------------+------+-----+---------+----------------+
164+
| Field | Type | Null | Key | Default | Extra |
165+
+-----------+-------------+------+-----+---------+----------------+
166+
| id | int(11) | NO | PRI | NULL | auto_increment |
167+
| CreatedAt | timestamp | YES | | NULL | |
168+
| CreatedBy | varchar(16) | YES | | NULL | |
169+
+-----------+-------------+------+-----+---------+----------------+
170+
3 rows in set (0.23 sec)
171+
```
172+
173+
To configure the `event_scheduler` server parameter in Azure Database for MySQL, perform the following steps:
174+
175+
1. In the Azure portal, navigate to your server, and then, under **Settings**, select **Server parameters**.
176+
2. On the **Server parameters** blade, search for `event_scheduler`, in the **VALUE** drop-down list, select **ON**, and then select **Save**.
177+
178+
> [!NOTE]
179+
> The dynamic server parameter configuration change will be deployed without a restart.
180+
181+
3. Then to create an event, connect to the MySQL server, and run the following SQL command:
182+
183+
```sql
184+
CREATE EVENT test_event_01
185+
ON SCHEDULE EVERY 1 MINUTE
186+
STARTS CURRENT_TIMESTAMP
187+
ENDS CURRENT_TIMESTAMP + INTERVAL 1 HOUR
188+
COMMENT ‘Inserting record into the table tab1 with current timestamp
189+
DO
190+
INSERT INTO tab1(id,createdAt,createdBy)
191+
VALUES('',NOW(),CURRENT_USER());
192+
```
193+
194+
4. To view the Event Scheduler Details, run the following SQL statement:
195+
196+
```slq
197+
SHOW EVENTS;
198+
```
199+
200+
The following output appears:
201+
202+
```azurecli
203+
mysql> show events;
204+
+-----+---------------+-------------+-----------+-----------+------------+----------------+----------------+--------------------
205+
206+
#### Limitations
207+
208+
For servers with High Availability configured, when failover occurs, it's possible that the `event_scheduler` server parameter will be set to ‘OFF’. If this occurs, when the failover is complete, configure the parameter to set the value to ‘ON’.
136209
137-
## Non-modifiable server parameters
210+
## Nonmodifiable server parameters
138211
139-
The server parameter blade on the Azure portal shows both the modifiable and non-modifiable server parameters. The non-modifiable server parameters are greyed out. If you want to configure a non-modifiable server parameter at session level, refer to the [Azure portal](./how-to-configure-server-parameters-portal.md#setting-non-modifiable-server-parameters) or [Azure CLI](./how-to-configure-server-parameters-cli.md#setting-non-modifiable-server-parameters) article for setting the parameter at the connection level using `init_connect`.
212+
The server parameter blade on the Azure portal shows both the modifiable and nonmodifiable server parameters. The nonmodifiable server parameters are greyed out. If you want to configure a nonmodifiable server parameter at session level, refer to the [Azure portal](./how-to-configure-server-parameters-portal.md#setting-non-modifiable-server-parameters) or [Azure CLI](./how-to-configure-server-parameters-cli.md#setting-non-modifiable-server-parameters) article for setting the parameter at the connection level using `init_connect`.
140213
141214
## Next steps
142215
143-
- How to configure [server parameters in Azure portal](./how-to-configure-server-parameters-portal.md)
144-
- How to configure [server parameters in Azure CLI](./how-to-configure-server-parameters-cli.md)
216+
* How to configure [server parameters in Azure portal](./how-to-configure-server-parameters-portal.md)
217+
* How to configure [server parameters in Azure CLI](./how-to-configure-server-parameters-cli.md)

0 commit comments

Comments
 (0)