How to Deploy a MySQL Flexible Server?
Create MySQL Flexible Server
Go to Azure Portal -> MySQL Flexible Server -> Advance Create
Basic information:
At the time I was setting up the MySQL server, the smaller compute engine ran out. This lead to deployment failure. So I set up the MySQL server in different region, and then do VNet peering.
- When picking the region, make sure the region you select provide this service. If there is no VMs, then Azure won’t notify you until you get deployment failure. (Which is horrible.)
1 2
az provider show -n Microsoft.DBforMySQL --query "resourceTypes[?resourceType=='flexibleServers'].locations" az mysql flexible-server list-skus --location <location> -o yaml
- In Authentication, choose
MySQL authentication only. Remeber the administrator login and password, they are theDatabase userandDatabase password.
- When picking the region, make sure the region you select provide this service. If there is no VMs, then Azure won’t notify you until you get deployment failure. (Which is horrible.)
Networking:
Form How to Connectivity method Private access Database port 3306 (set by default) Virtual network VNet and Subnet for MySQL Flexible Server Subnet VNet and Subnet for MySQL Flexible Server Private DNS integration:
Form How to Private DNS zone Let Azure create new one
VNet and Subnet for MySQL Flexible Server
After creating the VNet, Add a subnet:
| Form | How to |
|---|---|
| Subnet purpose | Default |
| Name | mysql-subnet |
| Subnet Delegation | Select Microsoft.DBforMySQL/flexibleServers |
Make sure the VNet this MySQL server is at can do peering with the VNet where the cluster is, if MySQL server and the cluster are not in the same VNet.
It is best that we create the VNet and subnet in a separate window and make sure it can do peering (See VNet peering).
Create Database for the Cluster
Go to Azure Portal -> MySQL Flexible Server, select the server and go to Databases -> Add
Create a database, and get the
Databases name
Make Sure Private DNS Can be Searched in the VNet
Go to Azure Portal -> Private DNS Zones -> Virtual Network Links -> Add
- Select the virtual network
- Enable auto registration
Log in to scheduler, and make sure we can find the private DNS of the MySQL flexible server:
1
nslookup <private dns>
Download SSL Certificate
Go to Azure Portal -> MySQL Flexible Server -> Networking -> Download SSL Certificate (name.crt.pem)
Upload the certificate and rename it to /sched/<cluster-name>/AzureCA.pem.
We need this when setting up Slurm.
Change Server Parameter
Go to Azure Portal -> MySQL Flexible Server -> Server Parameters
The recommended value (see Slurm Doc):
| Parameter | Value |
|---|---|
innodb_buffer_pool_size | 5% ~ 50% of the available memory on the SQL server, or at least 4GB. |
innodb_lock_wait_timeout | 900 seconds to allow some potentially extended queries |