В этом документе описывается инструмент миграции данных mxshift.
Инструмент mxshift в настоящее время поддерживает следующие функции:
WHERE.Примечание!
Все функции инструментаmxshiftтребуют выполнения с правами суперпользователя.
Без прав суперпользователя применяются следующие ограничения: не поддерживается сжатие данных; не поддерживается инкрементальная миграция; не поддерживается режим fetch.
Кроме того, во время миграции необходимо вручную добавить целевой хост в файлpg_hba.confна всех исходных узлах.
Файл полного шаблона называется config.toml. Этот шаблон можно получить, выполнив команду mxshift --config.
Ниже приведены примеры шаблонов для различных случаев использования. Используйте их в качестве образца и измените конфигурацию с помощью команды vim config.toml в соответствии со своей средой.
[database]
[database.source]
## Name of database
db-database= "testdb"
## Hostname of database master
db-host="sdw3"
## password of database
db-password="xxxx"
## Port of database master
db-port=54322
## user name of database
db-user="gpadmin"
## Version of database(Please use the result of 'SELECT version();' as value). Required only when
## 1. Source database is un-reachable, and 'ddl.only-ddl' is enabled and 'ddl.mode' is 'input'
## 2. Target database is un-reachable, and 'ddl.mode' is 'output'
# db-version="PostgreSQL 12 (MatrixDB 5.2.0-enterprise) (Greenplum Database 7.0.0+dev.17410.gedbdb5ef84 build dev) on arm-apple-darwin21.5.0, compiled by Apple clang version 13.0.0 (clang-1300.0.27.3), 64-bit compiled on Jun 5 2023 15:45:24"
## The installation directory of database
install-dir="/usr/local/greenplum-db-6.7.1"
[[database.source.hostname-to-ip]]
## The content within <> should be replaced with actual information and <> should be removed
node-hostname="<mdw>"
node-ip="<127.0.0.1>"
[[database.source.hostname-to-ip]]
node-hostname="<sdw1>"
node-ip="<127.0.0.2>"
[[database.source.hostname-to-ip]]
node-hostname="<sdw2>"
node-ip="<127.0.0.3>"
[database.target]
## Name of database
db-database="destdb"
## Hostname of database master
db-host="172.16.100.32"
## password of database
db-password="yyyy"
## Port of database master
db-port=5432
## user name of database
db-user="mxadmin"
## Version of database(Please use the result of 'SELECT version();' as value). Required only when
## 1. Source database is un-reachable, and 'ddl.only-ddl' is enabled and 'ddl.mode' is 'input'
## 2. Target database is un-reachable, and 'ddl.mode' is 'output' */
# db-version="PostgreSQL 12 (MatrixDB 5.2.0-enterprise) (Greenplum Database 7.0.0+dev.17410.gedbdb5ef84 build dev) on arm-apple-darwin21.5.0, compiled by Apple clang version 13.0.0 (clang-1300.0.27.3), 64-bit compiled on Jun 5 2023 15:45:24"
[scope]
## Whether to disable data incremental migration, by default, it is true.
# disable-data-increment=true
disable-connector=false
## The compress method for transferring data, methods restricted to 0/gzip/lz4/zstd
compress-method="lz4"
## mode for transferring data from source to target database, and value restricted to normal/dryrun/fetch/motion.
##dryrun for only executing ddl, not transferring data
##fetch for fetching data from source and abandon
##motion for fetching data from source, redistributing and finally abandon
mode="normal"
## Sql for select segment information from source database
# select-source-segment-sql="SELECT dbid, content, port, hostname FROM gp_segment_configuration WHERE status = 'u' AND role = 'p' ORDER BY CONTENT;"
## Sql for select segment information from target database
# select-target-segment-sql="SELECT dbid, content, port, hostname FROM gp_segment_configuration WHERE status = 'u' AND role = 'p' ORDER BY CONTENT;"
[[scope.table-list]]
schema="test_schema_1"
name="table_001"
[[scope.table-list]]
schema="test_schema_2"
name="table_002"
[[scope.exclude-table-list]]
schema="test_schema_3"
name="table_003"
schema-list=["test_schema_1", "test_schema_2"]
exclude-schema-list=["test_schema_5", "test_schema_8"]
[log]
## The log level, value restricted to: debug/verbose/info.
log-level="info"
## Print log without color.
# no-color=false
[controller]
## By default, transfer work will start from the largest table. If set 'bothway' it will start from both the largest and the smallest table
both-way=true
## The number of table transferred at the same time
concurrency=3
[transfer]
## Verity the number of record of every table
verify=true
with-index=true
## Whether to disable transfer Data, by default, it is false.
# disabled-data-transfer=false
## Table with size under this threshold are categorized as "small",
## transfer between masters instead of segments to avoid creating external table.
# small-table-mb=32
[ddl]
enabled=true
# file-path="/tmp/mxshift.sql"
# mode="output"
only-ddl=false
## During the DDL transfer, whether to skip the transfer of resource queue or group, by default, it is true.
# skip-resource-queue-and-group=true
## During the DDL transfer, whether to skip the transfer of tablespace, by default, it is true.
# skip-table-space=true
[[ddl.replace]]
## Only applicable for the case of migration from Greenplum to YMatrix
category="role"
[[ddl.replace.pairs]]
old="gpadmin"
new="mxadmin"
## Whether to disable ddl incremental migration, by default, it is true.
# disable-ddl-increment=true
## DDL transfer will stop and exit when executing sql encounter errors, unless the type of DDL is set to 'ignore error'.Types of DDL are:
## "all","collation","default acl","extension","external table","function","index","language",
## "namespace","operator","resource","role","table","tablespace","type","view"
# ignore-error=[]
[verify]
## Whether to enable data verify, by default, it is false.
# enabled=false
## mode for verifying data consistency between source and target database,
## and value restricted to simple-count/column-count/length-sum/hash-bit-bloom.
## 'simple-count' for counting number of rows
## 'column-count' for counting not-null value of a certain column
## 'length-sum' for summing the length of some columns(e.g. column of type text, xml, json, varchar)
## 'hash-bit-bloom' for calculating the hash for one or more columns, and compare it's binary content
## (except for column of floating-point type, the result of witch can be affected by software/hardware)
# mode="simple-count"
## Columns used in verification, will randomly select columns if not set
# columns=[]
## Maximum number of randomly selected columns used in verification
# max-column-count=3
# [[verify.table-list]]
# schema="test_schema_1"
# name="table_001"
# [[verify.exclude-table-list]]
# schema="test_schema_3"
# name="table_003"
# verify.schema-list=["test_schema_1"]
# verify.exclude-schema-list=["test_schema_5"]
# [[verify.override]]
# mode="length-sum"
# max-column-count=3
# columns=[]
# [[verify.override.table-list]]
# schema="test_schema_3"
# name="table_003"
# verify.override.schema-list=[]
# [[verify.override]]
# mode="column-count"
# max-column-count=2
# columns=[]
# [[verify.override.table-list]]
# schema="test_schema_1"
# name="table_001"
# verify.override.schema-list=[]
После подготовки файла конфигурации TOML запустите следующую команду для начала полной миграции:
$ mxshift -c config_path_full.toml
[database]
[database.source]
## Name of database
db-database= "testdb"
## Hostname of database master
db-host="sdw3"
## password of database
db-password="xxxx"
## Port of database master
db-port=54322
## user name of database
db-user="gpadmin"
## Version of database(Please use the result of 'SELECT version();' as value). Required only when
## 1. Source database is un-reachable, and 'ddl.only-ddl' is enabled and 'ddl.mode' is 'input'
## 2. Target database is un-reachable, and 'ddl.mode' is 'output' */
# db-version="PostgreSQL 12 (MatrixDB 5.2.0-enterprise) (Greenplum Database 7.0.0+dev.17410.gedbdb5ef84 build dev) on arm-apple-darwin21.5.0, compiled by Apple clang version 13.0.0 (clang-1300.0.27.3), 64-bit compiled on Jun 5 2023 15:45:24"
## The installation directory of database
install-dir="/usr/local/greenplum-db-6.7.1"
[[database.source.hostname-to-ip]]
## The content within <> should be replaced with actual information and <> should be removed
node-hostname="<mdw>"
node-ip="<127.0.0.1>"
[[database.source.hostname-to-ip]]
node-hostname="<sdw1>"
node-ip="<127.0.0.2>"
[[database.source.hostname-to-ip]]
node-hostname="<sdw2>"
node-ip="<127.0.0.3>"
[database.target]
## Name of database
db-database="destdb"
## Hostname of database master
db-host="172.16.100.32"
## password of database
db-password="yyyy"
## Port of database master
db-port=5432
## user name of database
db-user="mxadmin"
## Version of database(Please use the result of 'SELECT version();' as value). Required only when
## 1. Source database is un-reachable, and 'ddl.only-ddl' is enabled and 'ddl.mode' is 'input'
## 2. Target database is un-reachable, and 'ddl.mode' is 'output' */
# db-version="PostgreSQL 12 (MatrixDB 5.2.0-enterprise) (Greenplum Database 7.0.0+dev.17410.gedbdb5ef84 build dev) on arm-apple-darwin21.5.0, compiled by Apple clang version 13.0.0 (clang-1300.0.27.3), 64-bit compiled on Jun 5 2023 15:45:24"
[scope]
disable-connector=false
## The compress method for transferring data, methods restricted to 0/gzip/lz4/zstd
compress-method="lz4"
## mode for transferring data from source to target database, and value restricted to normal/dryrun/fetch/motion.
##dryrun for only executing ddl, not transferring data
##fetch for fetching data from source and abandon
##motion for fetching data from source, redistributing and finally abandon
mode="normal"
## Sql for select segment information from source database
# select-source-segment-sql="SELECT dbid, content, port, hostname FROM gp_segment_configuration WHERE status = 'u' AND role = 'p' ORDER BY CONTENT;"
## Sql for select segment information from target database
# select-target-segment-sql="SELECT dbid, content, port, hostname FROM gp_segment_configuration WHERE status = 'u' AND role = 'p' ORDER BY CONTENT;"
## Whether to disable data incremental migration, by default, it is true.
disable-data-increment=false
[[scope.table-list]]
schema="test_schema_1"
name="table_001"
[[scope.table-list]]
schema="test_schema_2"
name="table_002"
[[scope.exclude-table-list]]
schema="test_schema_3"
name="table_003"
schema-list=["test_schema_1", "test_schema_2"]
exclude-schema-list=["test_schema_5", "test_schema_8"]
[log]
## The log level, value restricted to: debug/verbose/info.
log-level="info"
## Print log without color.
# no-color=false
[controller]
## By default, transfer work will start from the largest table. If set 'bothway' it will start from both the largest and the smallest table
both-way=true
## The number of table transferred at the same time
concurrency=3
[transfer]
## Verity the number of record of every table
verify=true
with-index=true
## Whether to disable transfer Data, by default, it is false.
# disabled-data-transfer=false
## Table with size under this threshold are categorized as "small",
## transfer between masters instead of segments to avoid creating external table.
# small-table-mb=32
[ddl]
enabled=true
# file-path="/tmp/mxshift.sql"
# mode="output"
only-ddl=false
## During the DDL transfer, whether to skip the transfer of resource queue or group, by default, it is true.
# skip-resource-queue-and-group=true
## During the DDL transfer, whether to skip the transfer of tablespace, by default, it is true.
# skip-table-space=true
[[ddl.replace]]
## Only applicable for the case of migration from Greenplum to YMatrix
category="role"
[[ddl.replace.pairs]]
old="gpadmin"
new="mxadmin"
## Whether to disable ddl incremental migration, by default, it is true.
disable-ddl-increment=false
## DDL transfer will stop and exit when executing sql encounter errors, unless the type of DDL is set to 'ignore error'.Types of DDL are:
## "all","collation","default acl","extension","external table","function","index","language",
## "namespace","operator","resource","role","table","tablespace","type","view"
# ignore-error=[]
[verify]
## Whether to enable data verify, by default, it is false.
# enabled=false
## mode for verifying data consistency between source and target database,
## and value restricted to simple-count/column-count/length-sum/hash-bit-bloom.
## 'simple-count' for counting number of rows
## 'column-count' for counting not-null value of a certain column
## 'length-sum' for summing the length of some columns(e.g. column of type text, xml, json, varchar)
## 'hash-bit-bloom' for calculating the hash for one or more columns, and compare it's binary content
## (except for column of floating-point type, the result of witch can be affected by software/hardware)
# mode="simple-count"
## Columns used in verification, will randomly select columns if not set
# columns=[]
## Maximum number of randomly selected columns used in verification
# max-column-count=3
# [[verify.table-list]]
# schema="test_schema_1"
# name="table_001"
# [[verify.exclude-table-list]]
# schema="test_schema_3"
# name="table_003"
# verify.schema-list=["test_schema_1"]
# verify.exclude-schema-list=["test_schema_5"]
# [[verify.override]]
# mode="length-sum"
# max-column-count=3
# columns=[]
# [[verify.override.table-list]]
# schema="test_schema_3"
# name="table_003"
# verify.override.schema-list=[]
# [[verify.override]]
# mode="column-count"
# max-column-count=2
# columns=[]
# [[verify.override.table-list]]
# schema="test_schema_1"
# name="table_001"
# verify.override.schema-list=[]
После подготовки файла TOML запустите следующую команду для начала инкрементальной миграции с помощью mxshift.
$ mxshift -c config_path_incremental.toml
Используйте условие WHERE, чтобы мигрировать только данные, удовлетворяющие определённым критериям, либо исключить устаревшие данные из миграции:
[database]
[database.source]
## Name of database
db-database= "testdb"
## Hostname of database master
db-host="sdw3"
## password of database
db-password="xxxx"
## Port of database master
db-port=54322
## user name of database
db-user="gpadmin"
## The installation directory of database
install-dir="/usr/local/greenplum-db-6.7.1"
[database.target]
## Name of database
db-database="destdb"
## Hostname of database master
db-host="172.16.100.32"
## password of database
db-password="yyyy"
## Port of database master
db-port=5432
## user name of database
db-user="mxadmin"
[scope]
## The compress method for transferring data, methods restricted to 0/gzip/lz4/zstd
compress-method="lz4"
## mode for transferring data from source to target database, and value restricted to normal/dryrun/fetch/motion.
##dryrun for only executing ddl, not transferring data
##fetch for fetching data from source and abandon
##motion for fetching data from source, redistributing and finally abandon
mode="normal"
## Sql for select segment information from source database
# select-source-segment-sql="SELECT dbid, content, port, hostname FROM gp_segment_configuration WHERE status = 'u' AND role = 'p' ORDER BY CONTENT;"
## Sql for select segment information from target database
# select-target-segment-sql="SELECT dbid, content, port, hostname FROM gp_segment_configuration WHERE status = 'u' AND role = 'p' ORDER BY CONTENT;"
[[scope.table-list]]
schema=......
name=......
[[scope.table-list]]
......
[[scope.exclude-table-list]]
......
schema-list=["test_schema_1", "test_schema_2"]
exclude-schema-list=["test_schema_5", "test_schema_8"]
disable-connector=false
[log]
## The log level, value restricted to: debug/verbose/info.
log-level="info"
## Print log without color.
# no-color=false
[controller]
## By default, transfer work will start from the largest table. If set 'bothway' it will start from both the largest and the smallest table
both-way=true
## The number of table transferred at the same time
concurrency=3
[transfer]
## Verity the number of record of every table
verify=true
## Table with size under this threshold are categorized as "small",
## transfer between masters instead of segments to avoid creating external table.
# small-table-mb=32
[transfer.table-data-where-sql]
enabled=true
global="txdate >= '2022-10-01' AND batchnum >= 100000000"
[[transfer.table-data-where-sql.override]]
where="abc > 10"
[transfer.table-data-where-sql.override.table]
schema="test_schema_1"
name="table_001"
[[transfer.table-data-where-sql.override]]
where="tag != 'aabbcc' AND ts > '2022-01-01'"
[transfer.table-data-where-sql.override.table]
schema="test_schema_2"
name="another_table"
[verify]
## Whether to enable data verify, by default, it is false.
# enabled=false
## mode for verifying data consistency between source and target database,
## and value restricted to simple-count/column-count/length-sum/hash-bit-bloom.
## 'simple-count' for counting number of rows
## 'column-count' for counting not-null value of a certain column
## 'length-sum' for summing the length of some columns(e.g. column of type text, xml, json, varchar)
## 'hash-bit-bloom' for calculating the hash for one or more columns, and compare it's binary content
## (except for column of floating-point type, the result of witch can be affected by software/hardware)
# mode="simple-count"
## Columns used in verification, will randomly select columns if not set
# columns=[]
## Maximum number of randomly selected columns used in verification
# max-column-count=3
# [[verify.table-list]]
# schema="test_schema_1"
# name="table_001"
# [[verify.exclude-table-list]]
# schema="test_schema_3"
# name="table_003"
# verify.schema-list=["test_schema_1"]
# verify.exclude-schema-list=["test_schema_5"]
# [[verify.override]]
# mode="length-sum"
# max-column-count=3
# columns=[]
# [[verify.override.table-list]]
# schema="test_schema_3"
# name="table_003"
# verify.override.schema-list=[]
# [[verify.override]]
# mode="column-count"
# max-column-count=2
# columns=[]
# [[verify.override.table-list]]
# schema="test_schema_1"
# name="table_001"
# verify.override.schema-list=[]
После подготовки файла TOML запустите следующую команду для начала условной миграции с помощью mxshift.
$ mxshift -c config_path_conditional.toml
При миграции всей базы данных или всех реплицированных таблиц в определённой схеме дополнительная настройка в config_path.toml не требуется. mxshift автоматически определяет реплицированные таблицы и применяет соответствующую стратегию миграции, чтобы избежать дублирования данных. Вам нужно лишь настроить параметры scope.table-list, а именно задать значения schema и name.
[[scope.table-list]]
schema=“public1”
name=“table_replicated1”
[[scope.table-list]]
schema=“public2”
name=“table_replicated2”
После подготовки файла TOML запустите следующую команду для миграции реплицированных таблиц с помощью mxshift.
$ mxshift -c config_path_replicated.toml
Примечание!
Подробное описание стратегий миграции данных и полные шаги см. в разделе Миграция данных.
Для миграции данных mxshift сначала запрашивает каталог, чтобы получить метаданные таблиц, подлежащих миграции, а затем выполняет передачу данных.
По мере увеличения объёма использования базы данных разрастание каталога может привести к увеличению времени запросов. Чтобы ускорить отладку и сократить простои сервиса во время миграции, mxshift предоставляет параметры командной строки для экспорта метаданных таблиц и их повторного использования в последующих миграциях:
## Export table metadata to mxshift_meta_file and exit
$ mxshift -c <migration_config_file> --write-table-meta-file mxshift_meta_file
## Import table metadata from mxshift_meta_file and proceed with data migration
$ mxshift -c <migration_config_file> --read-table-meta-file mxshift_meta_file
Примечание!
Экспортированные метаданные таблиц не следует использовать в течение длительного времени. Пересоздавайте метаданные каждый раз, когда изменяется набор таблиц для миграции или модифицируются определения таблиц.
Настройте следующее в конфигурационном файле mxshift:
[ddl]
enabled=true
file-path="/tmp/mxshift.sql"
mode="output"
-- DO NOT EDIT.. exec, output и input. Их значения:exec: значение по умолчанию. Выполнять DDL непосредственно в целевой базе данных.output: выводить DDL в указанный файл. После экспорта mxshift завершает работу без выполнения миграции данных.input: читать DDL из указанного файла и применять его. Если целевая база данных недоступна при использовании output, настройте database.target.db-version, как показано ниже, чтобы обеспечить успешный экспорт DDL:
[database]
[database.target]
...
## Version of database (Use output of 'SELECT version();'). Required only when
## 1. Source database is unreachable, 'ddl.only-ddl' is enabled, and 'ddl.mode' is 'input'
## 2. Target database is unreachable, and 'ddl.mode' is 'output'
db-version="PostgreSQL 12 (MatrixDB 5.2.0-enterprise) (Greenplum Database 7.0.0+dev.17410.gedbdb5ef84 build dev) on arm-apple-darwin21.5.0, compiled by Apple clang version 13.0.0 (clang-1300.0.27.3), 64-bit compiled on Jul 5 2022 15:45:24"
Если исходная база данных недоступна при использовании input, настройте database.source.db-version и ddl.only-ddl, как показано ниже, чтобы обеспечить успешный импорт:
[database]
[database.target]
## Version of database (Use output of 'SELECT version();'). Required only when
## 1. Source database is unreachable, 'ddl.only-ddl' is enabled, and 'ddl.mode' is 'input'
## 2. Target database is unreachable, and 'ddl.mode' is 'output'
db-version="PostgreSQL 12 (MatrixDB 4.5.0-enterprise) (Greenplum Database 7.0.0+dev.17410.gedbdb5ef84 build dev) on arm-apple-darwin21.5.0, compiled by Apple clang version 13.0.0 (clang-1300.0.27.3), 64-bit compiled on Jul 5 2022 15:45:24"
[ddl]
only-ddl=true
mxshift поддерживает изменение уровня параллелизма во время миграции. Выполните следующие шаги:
controller.concurrency в конфигурационном файле (тот же файл, который использовался для запуска mxshift): [controller]
## The number of tables transferred at the same time
concurrency=xxx
Получите текущий идентификатор процесса mxshift
Запустите ps aux | grep mxshift в терминале и запомните число во втором столбце — {{mxshift PID}}.
Отправьте сигнал SIGUSR2 процессу mxshift, чтобы перезагрузить конфигурацию и обновить уровень параллелизма
Выполните kill -SIGUSR2 {{mxshift PID}} в терминале.
В версиях до v5.2.1 в разделе [transfer] содержались параметры with-index и verify, управляющие тем, мигрируются ли индексы и выполняется ли проверка количества строк. Однако миграция индексов и устаревшая проверка (только проверка количества строк) были тесно связаны с миграцией данных — они не могли выполняться независимо и должны были происходить в рамках процесса миграции.
Начиная с версии v5.2.1 миграция индексов и устаревшая проверка могут выполняться независимо. В разделе [transfer] добавлен новый параметр disabled-data-transfer, позволяющий пропустить передачу данных. Примеры:
[transfer]
## Whether to disable data transfer; default is false
disabled-data-transfer=false
## Transfer indexes of tables; default is false
with-index=true
[transfer]
## Whether to disable data transfer; default is false
disabled-data-transfer=false
## Verify row count per table; default is disabled
verify=true
[transfer]
## Whether to disable data transfer; default is false
disabled-data-transfer=false
## Transfer indexes of tables; default is false
with-index=true
## Verify row count per table; default is disabled
verify=true
[transfer]
## Whether to disable data transfer; default is false
disabled-data-transfer=false
## Transfer indexes of tables; default is false
with-index=false
## Verify row count per table; default is disabled
verify=false
[transfer]
## Whether to disable data transfer; default is false
disabled-data-transfer=true
## Transfer indexes of tables; default is false
with-index=true
[transfer]
## Whether to disable data transfer; default is false
disabled-data-transfer=true
## Verify row count per table; default is disabled
verify=true
Начиная с версии v5.2.1, YMatrix mxshift поддерживает новый алгоритм проверки данных, настраиваемый через раздел [verify].
Подробные глобальные параметры конфигурации см. в Приложении. Полный пример раздела [verify] приведён выше в Файле конфигурации полной миграции. Ниже рассматривается конфигурация области действия.
[verify]
# [[verify.table-list]]
# schema="test_schema_1"
# name="table_001"
# [[verify.exclude-table-list]]
# schema="test_schema_3"
# name="table_003"
# verify.schema-list=["test_schema_1"]
# verify.exclude-schema-list=["test_schema_5"]
# [[verify.override]]
# mode="length-sum"
# max-column-count=3
# columns=[]
# [[verify.override.table-list]]
# schema="test_schema_3"
# name="table_003"
# verify.override.schema-list=[]
# [[verify.override]]
# mode="column-count"
# max-column-count=2
# columns=[]
# [[verify.override.table-list]]
# schema="test_schema_1"
# name="table_001"
# verify.override.schema-list=[]
Область проверки управляется четырьмя подразделами: [verify.table-list], [verify.exclude-table-list], [verify.schema-list] и [verify.exclude-schema-list].
Порядок приоритета следующий:
table-list перечислены конкретные таблицы, проверяются только эти таблицы. schema-list. verify.table-list: список таблиц, включённых в проверку данных v5.2.1. verify.exclude-table-list: список таблиц, исключённых из проверки данных v5.2.1. verify.schema-list: список схем, включённых в проверку данных v5.2.1. verify.exclude-schema-list: список схем, исключённых из проверки данных v5.2.1. Подраздел [verify.override] переопределяет глобальные настройки проверки и применяет свои конфигурации к таблицам в указанной области.
В этом разделе описываются параметры, поддерживаемые инструментом mxshift.
Для использования инструмента mxshift необходимо сначала подготовить файл конфигурации в формате TOML. Ниже приведено подробное описание параметров в этом файле:
Для условной миграции с использованием условий WHERE используйте следующие параметры:
| Категория | Подкатегория | Подпараметр | Подподкатегория | Подподпараметр | Описание | Обязательный |
| [transfer] категория | [transfer.table-data-where-sql] категория | --enabled | Если установлено `true`, применяется условие WHERE для фильтрации исходных данных, мигрируются только строки, соответствующие условию — обеспечивает инкрементную миграцию. Эта функция отключена по умолчанию; включайте вручную с помощью `true`. | Нет | ||
| --global | SQL-выражение `WHERE`, применяемое ко всем таблицам в рамках этой миграции. Если таблица не содержит ключевое слово `WHERE`, `SKIPPED` автоматически пропускает таблицу. | Нет | ||||
| [[transfer.table-data-where-sql.override]] категория | --where | Подвыражение WHERE, имеет более высокий приоритет, чем глобальное. Применяется фильтрация на уровне таблиц для конкретных таблиц. | Нет | |||
| [transfer.table-data-where-sql.override.table] категория | --schema | Имя схемы таблицы, которую нужно мигрировать. | Нет | |||
| --name | Имя таблицы для миграции. | Нет |
Опции командной строки mxshift следующие:
| Опция | Описание |
|---|---|
| --config | Вывести содержимое конфигурационного файла по умолчанию. |
| -c / --config-path | Путь к глобальному конфигурационному файлу mxshift. |
| -a / --all | Выполнить миграцию без подтверждения. По умолчанию пропускаются уже смигрированные и пустые таблицы. |
| -v / --version | Отобразить версию инструмента mxshift. |
| -l / --show-progress | Показать ход последней миграции. Если миграция не выполняется, показывается результат последнего запуска. Если миграция идёт, отображается текущий статус. Значения STATUS: Not start — не входит в область миграции; Skip — пропущено (уже смигрировано или пусто); Processing/Interrupted — выполняется или прервано; Complete — миграция завершена; Failed — миграция завершилась с ошибкой. |
| -R / --redo | Повторно смигрировать таблицы, даже если они уже были смигрированы (перед повторной миграцией существующие данные в целевой таблице удаляются). |
| --write-table-meta-file | Экспортировать метаданные таблиц миграции в файл mxshift_meta_file и завершить работу. |
| --read-table-meta-file | Импортировать метаданные таблиц миграции из файла mxshift_meta_file и продолжить миграцию данных. |