MariaDB/MySQL
Overview
This document provides a guide on migrating MariaDB and MySQL used in SCP V to SCP V2. Migration proceeds by first transferring all data from the Source DB to the Target DB, and then replicating changes from the Source DB to the Target DB using a replication method.
Since the Source DB replicates data via replication while in an online state, the downtime of the Source DB can be minimized during migration.
Preliminary work
- This guide covers only DB migration using SCP (Samsung Cloud Platform), and the network between the Source and Target clusters must be connected in advance.
- The DB port used between the Source and Target clusters must be the same, and the Target DB must be able to access the Source DB’s DB port.
Migration Procedure
1. ## Create target cluster
Create the Target DB according to the following procedure.
- Click the All Services > Database > MariaDB (DBaaS) > Create MariaDB / Create MySQL menu. 1. Go to the Service Home page of MariaDB(DBaaS)/MySQL(DBaaS).
- On the Service Home page, click the MariaDB(DBaaS)/MySQL(DBaaS) Create button. 2. Go to the MariaDB(DBaaS)/MySQL(DBaaS) Create page.
- MariaDB(DBaaS)/MySQL(DBaaS) Creation page: enter the information required to create the service and select detailed options.
- Enter the version and service information of the target DB. 4. When entering service information, the following constraints are verified.
Constraints (common to MariaDB, MySQL)
- Allocate disk space that is at least roughly twice the size of the data used by the source cluster.
- We need twice the actual usage, not based on the allocated disk.
- The information below for the Target cluster must be the same as the Source cluster.
- Database version (Major, Minor version)
- Port
- Database name
- DB character set (Collation)
- Time zone (server Timzone)
- The target cluster must meet the following conditions.
- Backup not configured
- Audit Log not set
Constraints (MySQL)
- The information below for the Target cluster must be the same as the Source cluster.
- Case-sensitive “Table” input in the console
Constraints(MariaDB)
- The lower_case_table_names parameter setting must be the same for the Target cluster and the Source cluster.
- After the DB is created, you can modify it on the Parameter management page.
* The DB character set and collation correspond to the values of the character_set_server and collation_server parameters.
* After creating the DB, you need to modify it on the Parameter management page to match the Source DB.
* Since backup and Audit Log settings can be changed after the database is created, if they are set, you must change them to unset on the detail page before configuring the migration.
2. ## Source Cluster Permission Check
To migrate data from the source DB and perform replication, the following permissions are required.
MariaDB/MySQL common
Check migration account permissions All the permissions below must be set to ‘Y’ in the query execution result.
select select_priv , lock_tables_priv , show_view_priv , trigger_priv , event_priv , reload_priv , process_priv , show_db_priv , repl_client_priv , repl_slave_priv from mysql.user where user='Migration용 계정' and host='%'Alternatively, you can check the permissions granted to the current account using the command below.
show grants for 'Migration용 계정'@'%';
Constraints
Since the migration account’s privileges are verified with the condition host='%', the Host information must be set to '%' when creating the migration account.
Add account permissions for migration If there is a value other than Y among the account permissions performed in step 1, you must add the permission to that account.
grant select, lock tables, show view, trigger, event, reload, process, show databases, replication client, replication slave on *.* to 'Migration용 계정'@'%';
3. ## Migration configuration
Once the target DB is created, you can perform the migration configuration after verifying the network connection.
Constraints
- The target cluster listed below cannot perform migration configuration.
- When the instance type is Replica.
- When the Master cluster has a replica
- When not in Running state
- When performing a Migration configuration and before promoting the Master (in the case where the cluster type is Migration)
- Audit Log, when backup is configured
On the detail page of the Target DB, you can start the configuration by clicking the Migration Configuration menu at the top right.
- All Services > Database > MariaDB(DBaaS) > MariaDB(DBaaS) Details Click the menu. 1. Go to the MariaDB(DBaaS)/MySQL(DBaaS) Details page of MariaDB(DBaaS)/MySQL(DBaaS).
- MariaDB(DBaaS)/MySQL(DBaaS) Details Click the More button at the top right of the page. 2. More menus are displayed.
- Click the Migration configuration menu. 3. After reviewing the notification popup message, click the Confirm button.
- Enter the version and service information of the target DB. 4. When entering service information, the following constraints are verified.
- Source DB Database name : required value. * Begin with an English character and enter between 1 and 63 characters.
- Source DB IP : required value. * IP format (e.g. * Enter as 192.168.10.1)
- Source DB Port : required value. * The allowable range for port input is 1024 to 65535.
- Source DB username : required value. * Start with English letters and enter within 1–80 characters.
- Source DB password: required value. * Enter 8~30 characters, including letters, numbers, and special characters (excluding " and ‘).
Cancel
When the Cancel button is selected, the Migration configuration is canceled and you return to the previous page.
Connection Check
After entering the information of the Source DB, click the Check Connection button to check constraints specified in this guide, such as N/W, account permissions, and Database information. If any constraint is not met, the connection check will fail, and you must review the error message and take appropriate action. After successfully verifying the connection, if you modify the information for the Source DB, the Complete button is disabled again and the ‘Check Connection’ button becomes enabled.
Migration configuration completed
If the connection check succeeds, the Complete button becomes active. When you click the Complete button, data transfer from the Source DB begins, and after transferring all data once and successfully establishing the Replication connection, the migration configuration is completed.
This step may take several hours or more depending on the size of the data. During migration, the cluster status is shown as Migrating, and while Migrating you cannot perform modifications on the Target cluster.
Clicking the Migration configuration complete button will delete all data currently existing in the Target DB.
- If the Source DB’s state changes (e.g., stop, restart, SwitchOver) while the Target DB is in a Migrating state, the migration operation fails. *
- You must stop operations on the Source DB during migration.
| Migration Configuration Result | Menu activation |
|---|---|
| When migration configuration succeeds | Enable Master promotion, cannot modify various settings on the detail page. |
| If migration configuration fails | Enable Migration configuration |
Service Status Synchronization
When the Target cluster in Migrating state becomes Running, and the Master promotion button is enabled, the migration has been performed successfully.
To check the current replication status, go to the detail page of the Target DB, click the ‘Service Status Sync’ button at the top right, and then you can view the replication status.
Please check the eventdata item in MariaDB(DBaaS) > MariaDB(DBaaS) List > MariaDB(DBaaS) Details > Job History > Job History Click > Job Details.
4. ## Master Promotion
After checking the replication status, click the Master promotion button to complete the migration.
- All Services > Database > MariaDB (DBaaS) > MariaDB (DBaaS) Details Click the menu. 1. Navigate to the MariaDB(DBaaS)/MySQL(DBaaS) Details page.
- MariaDB(DBaaS)/MySQL(DBaaS) Details Click the Master Promotion button at the top right of the page.
- It changes to the Editing state, and changes to the Running state once Master promotion is complete.
- Parameters configured in the source DB are not migrated. * After the Master promotion, modify on the MariaDB(DBaaS) > MariaDB(DBaaS) List > MariaDB(DBaaS) Details > Parameter Management page according to the Source DB settings. *
- User account information is synchronized from Source. * After master promotion, use the Source DB’s account credentials to connect to the database.