Skip to content

Commit 135d099

Browse files
authored
just overview here
1 parent 6b39ab0 commit 135d099

1 file changed

Lines changed: 0 additions & 54 deletions

File tree

  • 0_Azure/1_AzureData/1_Databases/demos/11_enablingAutoscaleIOPSmySQL

0_Azure/1_AzureData/1_Databases/demos/11_enablingAutoscaleIOPSmySQL/README.md

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Last updated: 2025-05-09
2525
- [How to provision](#how-to-provision)
2626
- [How to enable IOPS](#how-to-enable-iops)
2727
- [How to Monitor IOPS Scaling](#how-to-monitor-iops-scaling)
28-
- [Azure CLI Script to Enable Autoscale IOPS](#azure-cli-script-to-enable-autoscale-iops)
2928

3029
</details>
3130

@@ -81,59 +80,6 @@ Last updated: 2025-05-09
8180

8281
https://github.com/user-attachments/assets/19b96128-e37f-40b4-8e23-8a5384bc6686
8382

84-
## Azure CLI Script to Enable Autoscale IOPS
85-
86-
> [!NOTE]
87-
> The script below will execute: <br/>
88-
> - Using Python 3.13.3 <br/>
89-
> - Checks if Azure CLI is available at the specified path. <br/>
90-
> - Lists all MySQL Flexible Servers. <br/>
91-
> - Tries to get each server’s resource group. <br/>
92-
> - If the resource group is missing, it prompts you to enter it. <br/>
93-
> - Asks for confirmation before enabling autoscale IOPS. <br/>
94-
95-
```python
96-
import subprocess
97-
import json
98-
99-
# Step 1: Get list of MySQL Flexible Servers
100-
servers_output = subprocess.check_output(
101-
["az", "mysql", "flexible-server", "list", "--query", "[].name", "-o", "tsv"],
102-
text=True
103-
)
104-
servers = servers_output.strip().splitlines()
105-
106-
# Step 2: Loop through each server and enable autoscale IOPS
107-
for server in servers:
108-
# Get the resource group for the server
109-
rg_output = subprocess.check_output(
110-
["az", "mysql", "flexible-server", "show", "--name", server, "--query", "resourceGroup", "-o", "tsv"],
111-
text=True
112-
)
113-
resource_group = rg_output.strip()
114-
115-
print(f"Enabling autoscale IOPS for {server} in {resource_group}...")
116-
117-
# Update the server to enable autoscale IOPS
118-
subprocess.run([
119-
"az", "mysql", "flexible-server", "update",
120-
"--name", server,
121-
"--resource-group", resource_group,
122-
"--iops", "Auto"
123-
])
124-
```
125-
126-
## How to execute it Azure CLI Script to Enable Autoscale IOPS
127-
128-
1. Download [the script](./enable_autoscale_iops.py) to your local machine or a cloud shell environment.
129-
2. Make sure you're logged in: `az login`
130-
4. Run the script: `py enable_autoscale_iops.py`
131-
132-
> Example: enabling Autoscale IOPS on three different servers, each hosted in a separate resource group but under the same subscription.
133-
134-
<img width="550" alt="image" src="https://github.com/user-attachments/assets/22aa763d-b358-441a-b5b9-aa0197ce680d" />
135-
136-
13783

13884
<div align="center">
13985
<h3 style="color: #4CAF50;">Total Visitors</h3>

0 commit comments

Comments
 (0)