Skip to content

Data Migration ​

Reminder

Please ensure the target server has the database installed before migrating data.

Migrate Database ​

Notes

The database password can be viewed in the configuration file at the following path, with the configuration item being spring.datasource.druid.password.

shell
cat {informat-installation-directory}/instance/informat-account/application.yml

Back Up Database ​

Back Up account Database ​

shell
/usr/local/pgsql/bin/pg_dump -U postgres db_informat2_account_prd  > db_informat2_account_prd.sql

Back Up biz Database ​

shell
/usr/local/pgsql/bin/pg_dump -U postgres db_informat2_biz_prd_0  > db_informat2_biz_prd_0.sql

Transfer Backup Files to Target Server ​

shell
scp [file-path] [target-server-login-account]@[target-server-IP]:[target-server-path]

Restore Backup ​

Notes

Please ensure there are no active connections to the database

Rename Databases on Target Server (If Corresponding Databases Exist on Target) ​

sql
ALTER DATABASE db_informat2_account_prd RENAME TO db_informat2_account_prd_bak;
ALTER DATABASE db_informat2_biz_prd_0 RENAME TO db_informat2_biz_prd_0_bak;

Create New Databases ​

shell
/usr/local/pgsql/bin/psql -d postgres -U postgres -c 'create database db_informat2_account_prd';
/usr/local/pgsql/bin/psql -d postgres -U postgres -c 'create database db_informat2_biz_prd_0';
/usr/local/pgsql/bin/psql -d postgres -U postgres -d db_informat2_biz_prd_0 -c 'create extension ltree';

Restore Data ​

shell
/usr/local/pgsql/bin/psql -U postgres -d db_informat2_account_prd -f /db_informat2_account_prd.sql
/usr/local/pgsql/bin/psql -U postgres -d db_informat2_biz_prd_0 -f /db_informat2_biz_prd_0.sql

Notes

    1. After restoration is complete, you need to restart the Informat service
    1. After restart, you need to perform the following checks:
    • System Authorization: Since system authorization is bound to the machine, you need to access the management backend to update the corresponding authorization
    • Resource Configuration: You need to adjust the following configurations in Management Backend > System Information > Parameter Settings - Login and Resources: Configure the homepage URL as the current service deployment address; for login address, mobile login URL, resource address, and API address, if configured, they need to be adjusted to the current service deployment address - File Preview Service: Configure the OnlyOffice file preview address as the current service deployment address :::

Application Table Data Migration ​

For concepts related to data tables, please refer to Application Table Data Structure. The following is the migration method using the command line. If using a database client for migration, please ignore the following content.

Notes

  • Database table lookup Physical table names are automatically generated based on the z_{application-ID}_{table-ID} rule, where application ID and table ID are 12-digit unique IDs generated by the system

  • Database system Seq field lookup Sequence names are automatically generated based on the z_{application-ID}_{table-ID}_seq rule, where application ID and table ID are 12-digit unique IDs generated by the system

  • Data table serial number field sequence lookup Serial number field sequence names are automatically generated based on the z_{application-ID}_{table-ID}_{field-ID}_seq rule, where application ID, table ID, and field ID are 12-digit unique IDs generated by the system

Data Backup ​

shell
/usr/local/pgsql/bin/pg_dump -U postgres db_informat2_biz_prd_0 -t z_{application-ID}_{table-ID} -a --inserts > z_{application-ID}_{table-ID}.sql

Data Import ​

shell
/usr/local/pgsql/bin/psql -U postgres -d db_informat2_biz_prd_0 -f z_{application-ID}_{table-ID}.sql

Reset Sequence Values ​

  • Database system Seq field

    sql
    -- Update data table sequence value to source value
    UPDATE z_{application-ID}_{table-ID}_seq SET "last_value"={source-value};
  • Data table serial number field sequence (if the data table has one)

    sql
    -- Update data table serial number field sequence value to source value
    UPDATE z_{application-ID}_{table-ID}_{field-ID}_seq SET "last_value"={source-value};

Migrate Attachments ​

The following path files need to be migrated:

  • /data/minio_home
  • {installation-directory}/file_storage

Example

shell
scp /data/minio_home informat@192.168.1.2:/data/minio_home
scp /informat-next/file_storage informat@192.168.1.2:/informat-next/file_storage

INFO

If the target file already exists, you need to first transfer it to a temporary path and then overwrite the target path file