0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Azure Database for MySQL フレキシブルサーバーのメジャーアップグレードを Azure CLI で試してみた

Posted at

Azure Database for MySQL フレキシブルサーバーで、インプレースアップグレードが可能になっていました。そこで、まずはデータが何も入っていない MySQL 5.7 を用意して 8.0 へのアップグレードの動作を確認してみました。

検証用 MySQL を作成

bash
region=eastus
prefix=mnrmsql

az group create \
  --name ${prefix}-rg \
  --location $region

az mysql flexible-server create \
  --location $region \
  --resource-group ${prefix}-rg \
  --name ${prefix}-db \
  --admin-user username \
  --admin-password password \
  --sku-name Standard_B1ms \
  --version 5.7

B シリーズのまま試しにアップグレードを試す

Major version update is not supported for the Burstable pricing tier. となりました。

bash
az mysql flexible-server upgrade \
  --resource-group ${prefix}-rg \
  --name ${prefix}-db \
  --version 8

Updating major version in server mnrmsql-db is irreversible. The action you're about to take can't be undone. Going further will initiate major version upgrade to the selected version on this server. (y/n): y
Major version update is not supported for the Burstable pricing tier.

B シリーズから GP シリーズにスケールアップ

bash
az mysql flexible-server update \
  --resource-group ${prefix}-rg \
  --name ${prefix}-db \
  --tier GeneralPurpose \
  --sku-name Standard_D2ds_v4

GP シリーズでアップグレードを試す

Issueed values: NO_AUTO_CREATE_USER となりました。

bash
az mysql flexible-server upgrade \
  --resource-group ${prefix}-rg \
  --name ${prefix}-db \
  --version 8

Updating major version in server mnrmsql-db is irreversible. The action you're about to take can't be undone. Going further will initiate major version upgrade to the selected version on this server. (y/n): y
(ServerVersionUpgradeConditionCheckFailed) Upgrade server version failed, check the error message for details: Find invalid server parameters, please correct before upgrade to new server version
Name: sql_mode, 
Current value: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER, 
Allowed values: ,ALLOW_INVALID_DATES,ANSI_QUOTES,ERROR_FOR_DIVISION_BY_ZERO,HIGH_NOT_PRECEDENCE,IGNORE_SPACE,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION,NO_UNSIGNED_SUBTRACTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY,PAD_CHAR_TO_FULL_LENGTH,PIPES_AS_CONCAT,REAL_AS_FLOAT,STRICT_ALL_TABLES,STRICT_TRANS_TABLES,TIME_TRUNCATE_FRACTIONAL, 
Issueed values: NO_AUTO_CREATE_USER

パラメータを修正

bash
az mysql flexible-server parameter show \
  --resource-group ${prefix}-rg \
  --server-name ${prefix}-db \
  --name sql_mode \
  --query value

"ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"

az mysql flexible-server parameter set \
  --resource-group ${prefix}-rg \
  --server-name ${prefix}-db \
  --name sql_mode \
  --value "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO"

もう一度アップグレードを試す

bash
az mysql flexible-server upgrade \
  --resource-group ${prefix}-rg \
  --name ${prefix}-db \
  --version 8

Updating major version in server mnrmsql-db is irreversible. The action you're about to take can't be undone. Going further will initiate major version upgrade to the selected version on this server. (y/n): y

az mysql flexible-server show \
  --resource-group ${prefix}-rg \
  --name ${prefix}-db \
  --query version

"8.0.21"

後片付け

bash
az group delete \
  --name ${prefix}-rg \
  --yes

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?