MariaDB/MySQL
MariaDB/MySQL
Overview
This document guides you on how to migrate MariaDB and MySQL used in SCP V to SCP V2. Migration proceeds by transferring the entire data from the Source DB to the Target DB, and then replicating changes from the Source DB to the Target DB via replication.
Since the source DB replicates data using replication while it is online, the downtime of the source DB can be minimized during migration.
Prerequisites
- 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 a Target Cluster
Create the Target DB according to the following procedure.
- Click the All Services > Database > MariaDB(DBaaS) > Create MariaDB/Create MySQL menu. Go to the Service Home page for MariaDB(DBaaS)/MySQL(DBaaS).
- Click the MariaDB(DBaaS)/MySQL(DBaaS) Create button on the Service Home page. Navigate to the MariaDB(DBaaS)/MySQL(DBaaS) Create page.
- On the Create MariaDB(DBaaS)/MySQL(DBaaS) page, enter the information required to create the service and select detailed options.
- Enter the Target DB version and service information. Check the following constraints when entering service information.
Constraints (common to MariaDB and 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 rather than the allocated disk as a basis.
- The information below for the target cluster must be identical to that of 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 configured
Constraints (MySQL Only)
- The following information for the Target cluster must be identical to the Source cluster.
- Table case sensitivity
* The DB character set and collation correspond to the values of the `character_set_server` and `collation_server` parameters.
* After creating the DB, you must change 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. Check Source cluster permissions
You need the following permissions to migrate data from the Source DB and perform Replication.
MariaDB/MySQL Common
Check migration account permissions In the query execution results, all permissions below must be ‘Y’.
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 following command.
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 migration account permissions If there is a value other than ‘Y’ among the account permissions checked in step 1, you must add permissions 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, verify the network connection and then configure the Migration.
Constraints
- Target clusters corresponding to the following cannot perform Migration configuration.
- If the instance type is Replica
- If it is a Master cluster with a Replica
- If not in the Running state
- When performing a Migration configuration and before promoting the Master (if the cluster type is Migration)
- Audit Log, if backup is configured
From the detail page of the Target DB, you can start the setup by clicking the Migration configuration menu at the top right.
- Click the All Services > Database > MariaDB(DBaaS) > MariaDB(DBaaS) Details menu. Go to the MariaDB(DBaaS)/MySQL(DBaaS) Details page of MariaDB(DBaaS)/MySQL(DBaaS).
- Click the More button at the top right of the MariaDB(DBaaS)/MySQL(DBaaS) Details page. The additional menus are displayed.
- Click the Migration Configuration menu. After checking the message in the alert popup, click the OK button.
- Enter the Target DB version and service information. Check the following constraints when entering service information.
- Source DB Database Name : Required value. Please enter 1 to 63 characters starting with an English letter.
- Source DB IP : Required value. Please enter in IP format (e.g., 192.168.10.1).
- Source DB Port : Required value. The valid input range for Port is 1024 to 65535.
- Source DB Username: Required value. Please enter 1 to 80 characters, starting with an English letter.
- Source DB Password: Required value. Please enter 8 to 30 characters including English letters, numbers, and special characters (excluding " and ‘).
Cancel
Selecting the Cancel button cancels the Migration configuration and returns you to the previous page.
Verifying Connection
After entering the Source DB information, click the Check Connection button to check constraints specified in this guide such as network, account permissions, and database information. If any constraint is not met, the connection check fails. Check the error message and take action. After successfully verifying the connection, if you modify the Source DB information, the Complete button is disabled again and the ‘Verify Connection’ button is enabled.
Migration Configuration Complete
If the connection check succeeds, the Complete button is enabled. Clicking the Complete button starts data migration from the Source DB, and after migrating all data once, the migration configuration is completed only when the Replication connection also succeeds.
This step may take several hours or more depending on the data size. During migration, the cluster status is displayed as Migrating, and you cannot perform modifications on the Target cluster while Migrating.
When you click the Migration configuration complete button, all data currently existing in the Target DB will be deleted.
- When the Target DB is in a Migrating state and the Source DB’s state changes (stop, restart, SwitchOver, etc.), 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; various settings cannot be changed on the detail page. |
| If migration configuration fails | Enable migration configuration |
Service Status Synchronization
When the status of the Target cluster becomes Running and the Master promotion button is activated, the Migration has been successfully completed.
To check the current replication status, click the ‘Service Status Sync’ button in the top right of the Target DB details page, and then check the replication status.
MariaDB(DBaaS)/MySQL(DBaaS) Details Click the Master Promotion button at the top right of the page.
4. Master Promotion
Parameters set in the source DB are not migrated. After master promotion, modify them on the MariaDB(DBaaS) > MariaDB(DBaaS) List > MariaDB(DBaaS) Details > Parameter Management page to match the source DB’s settings.
- User account information is synchronized from the Source. After the Master promotion, use the account information from the Source DB to connect to the database.
- On the top right of the MariaDB(DBaaS)/MySQL(DBaaS) Details page, click the Master Promotion button.
- It changes to the Editing state, and changes to the Running state when Master promotion is complete.
- Parameters set in the source DB are not migrated. After master promotion, modify them on the MariaDB(DBaaS) > MariaDB(DBaaS) List > MariaDB(DBaaS) Details > Parameter Management page to match the source DB’s settings.
- User account information is synchronized from the Source. After the Master promotion, use the account information from the Source DB to connect to the database.