The page has been translated by Gen AI.

PostgreSQL(DBaaS), EPAS(DBaaS) migration

PostgreSQL(DBaaS), EPAS(DBaaS) migration

Overview

This guide provides the procedures and tasks for migrating PostgreSQL (DBaaS) and EPAS (DBaaS) services created on Samsung Cloud Platform to Samsung Cloud Platform v2.

In Samsung Cloud Platform v2, to minimize downtime during migration, it provides a feature that configures replicas using Streaming Replication and promotes them to the master server at the switchover point. Through this, users can perform migration tasks more easily.

Preprocessing

To perform a PostgreSQL (DBaaS) and EPAS (DBaaS) migration, a target cluster must exist in Samsung Cloud Platform v2, and you must be able to access the source cluster’s database on Samsung Cloud Platform.

By default, network communication must be possible for the following ports.

  • Source cluster DB Port : Target cluster IP (if HA, Active server IP / Standby server IP / VIP) -> Source cluster IP (if HA, Active server IP / Standby server IP / VIP)

This guide assumes that the server and network are properly configured in advance and outlines the items to verify before the migration.

Check target server

When migrating PostgreSQL(DBaaS) and EPAS(DBaaS) services, the configuration parameters set in the source are taken as‑is and used. In addition, due to the automation of various service functions, we recommend configuring the Target cluster with the same setup as the Source cluster, and please review the items below.

  • The Target cluster server’s Memory must be greater than or equal to the Source cluster’s.
  • The DATA block storage capacity of the Target cluster server must be greater than or equal to that of the Source cluster.
  • The following configuration information of the Target cluster must be the same as that of the Source cluster.
    • Image version
    • Database name
    • Database username
    • Database Port number
    • Database Encoding
    • DB Locale
    • time zone
  • The target cluster must have the following configuration set to unused.
    • Backup
    • Audit Log Settings

Check DB user for migration configuration

The Source DB user required for migration replication must have login replication pg_read_all_settings pg_hba_file_rules view query privileges.

When using an existing database user in the source DB, refer to the information below to grant the necessary permissions. Please refer to the constraints below.

  • username : 2~20 characters, only lowercase English letters
  • password : 8~30 characters composed of letters, numbers, and special characters
ALTER USER user_name WITH LOGIN REPLICATION;

GRANT pg_read_all_settings TO user_name;

GRANT SELECT ON pg_hba_file_rules TO user_name;
GRANT EXECUTE ON FUNCTION pg_hba_file_rules TO user_name;

If you create a new DB user for the source DB, refer to the information below to create the user and grant permissions. Please refer to the constraints below.

  • username : 2~20 characters, only lowercase English letters
  • password : 8~30 characters composed of letters, numbers, and special characters
CREATE USER user_name WITH LOGIN REPLICATION PASSWORD 'user_password';

GRANT pg_read_all_settings TO user_name;

GRANT SELECT ON pg_hba_file_rules TO user_name;
GRANT EXECUTE ON FUNCTION pg_hba_file_rules TO user_name;

Check DB Access Control Registration

For configuring migration‑type replication, the database’s own access control (pg_hba) rules must be applied to the Source DB for access from the Target DB. However, registering access control rules is difficult for users to perform directly due to OS access restrictions. A rule registration request is needed through the Samsung Cloud Platform 1:1 inquiry. When proceeding with a 1:1 inquiry, providing the Target IP information together with the username to be used for migration enables faster processing.

If a rule has been registered, you can verify it using the following SQL statement.

SELECT * FROM pg_hba_file_rules WHERE database = 'replication';

Source DB - Target DB Communication Check

After setting DB user permissions and DB access control, access from the Target DB to the Source DB is possible.

You can use PostgreSQL’s Foreign Data Wrapper (FDW) to check whether the DB is accessible. For detailed information, refer to PostgreSQL Document - postgres_fdw.

Check additional installed extensions

If you are using extensions that were installed separately upon request, in addition to the default extensions installed in PostgreSQL (DBaaS) and EPAS (DBaaS) services, it may cause issues when configuring migration. In particular, for extensions added to the shared_preload_libraries parameter value and loaded when the DB starts, the DB cannot start if the required module is not installed. Therefore, before configuring the migration, you should verify the extensions in use and take action first if any additional extensions have been installed.

  • Install additional Extension on target cluster - Install Extension module and set the shared_preload_libraries parameter

    or

  • Disable additional Extension on the source cluster - Delete Extension and set the shared_preload_libraries parameter

Migration Procedure

Migration configuration

Migration configuration can be requested through the following menu.

  • PostgreSQL(DBaaS) : Database > PostgreSQL(DBaaS) > PostgreSQL(DBaaS) List > PostgreSQL(DBaaS) Details > Migration Configuration
  • EPAS(DBaaS) : Database > EPAS(DBaaS) > EPAS(DBaaS) List > EPAS(DBaaS) Details > Migration Configuration

You can start the migration configuration by clicking the Migration configuration menu at the top right of the Detail page of the Target cluster.

When you click the Migration Configuration menu, the Migration Configuration page is displayed and you can enter information about the Source DB.

  • Source DB Database name : required value. - Begin with an English character and enter 1 to 63 characters.
  • Source DB IP : required value. - IP format (e.g. - Enter 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 an English letter and enter between 1 and 63 characters.
  • Source DB password: required value. - Enter 8~30 characters, including letters, numbers, and special characters (excluding " and ‘).

Cancel

Cancel button, when selected, cancels the Migration configuration and returns to the previous screen.

Connection Check

After entering the information for the Source DB, click the Check Connection button to first check the connection to the Source DB, DB user permissions, Database information, and other constraints specified in this guide. If the constraints are not met, the connection check will fail, and you must review the error message and take action.

Migration configuration complete

If the connection check succeeds, the Complete button will be enabled. When you click the Complete button, the data migration configuration from the Source DB begins, and after transferring all data once and successfully establishing the Replication connection, the migration configuration is considered complete. 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 modification operations on the Target cluster. Clicking the Migration configuration complete button will delete all data currently present in the Target DB.

information
If the source DB’s state changes (e.g., stop, restart, SwitchOver, etc.) and the DB process is interrupted while the target DB is in a Migrating state, the migration operation fails. During migration, changes to the Source DB should be avoided.
Migration configuration resultEnable menu
When migration configuration succeedsMaster promotion, cannot change any settings on the detail screen
When migration configuration failsMigration configuration
Table. Menu activation based on migration configuration results

Service status synchronization

When the migration configuration is complete, the target cluster’s status becomes Running, and the Master promotion button is enabled, the migration has been performed successfully. Database > PostgreSQL(DBaaS) > PostgreSQL(DBaaS) List > PostgreSQL(DBaaS) Details > Job History > Click Job History > Job History Details or Database > EPAS(DBaaS) > EPAS(DBaaS) List > EPAS(DBaaS) Details > Job History > Click Job History > Job History Details please check the detailed information. To check the current replication status, go to the detail screen of the Target DB, click the Service Status Sync button at the top right, and then you can view the replication status.

Additionally, you can run the following query directly on the DB to check the detailed replication status.

  • Source cluster

    SELECT * FROM pg_stat_replication;
    
  • Target cluster

    SELECT * FROM pg_stat_wal_receiver;
    

Master promotion

After checking the replication status at the cut‑over point, click the Master promotion button to switch the DB to the primary server, completing the migration. The figure above. After completing the migration configuration, on the detail page, click the ‘Promote to Master’ button at the top right of the Target DB detail screen. After a master promotion, you can change settings on the PostgreSQL(DBaaS) Details page or the EPAS(DBaaS) Details page, just like with a regular cluster.

Constraints

  • The target cluster listed below cannot be used for migration configuration.

    • When the instance type is Replica.
    • When the Master cluster has a replica
    • When not in Running state
    • When the Migration configuration has been performed but before promoting the Master (i.e., when the cluster type is Migration)
  • The target cluster can perform migration after turning off Audit logs and Backup settings.

  • After configuring a migration once, modifications to the server (Spec changes, Disk addition tasks, Parameter management, etc.) are not possible.

    • After promoting to Master, modify the Target cluster.