Quick Start
Simulate Time Series Scenarios
Standard Cluster Deployment
Data Modeling
Connecting to The database
Data Writing
Data Migration
Data Query
Scene Application Examples
Federal Query
Maintenance and Monitoring
Global Maintenance
Partition Maintenance
Backup and Restore
Cluster Expansion
Monitoring
Performance Tuning
Troubleshooting
Reference Guide
Tool Guide
Data Type
Storage Engine
Execution Engine
Configuration Parameters
SQL Reference
FAQ
This document describes the mirror segment instance (Mirror) migration tool mxmoveseg.
Note!
mxmovesegis used only to migrate segment instances where thegp_segment_configurationtable'srole(current role) ism(mirror). It does not consider thepreferred_role(preferred role) column.
mxmoveseg tool supports migrating any database segment instance currently serving as a Mirror to another server.mxmoveseg tool does not support migration of the Standby Master.Note!
Before using this tool, you must manually verify the health status of all servers in the cluster. If any servers are unhealthy, identify them explicitly to ensure thatmxmovesegcollects information only from healthy hosts.
The following table lists the available command-line options:
| Option | Description |
|---|---|
--config |
Creates a configuration file for the Mirror segments to be migrated |
--plan |
Generates a migration plan based on the configuration |
--setup |
Executes the migration plan |
-h / --help |
Displays help information |
Note!
The new server must have the same version of YMatrix RPM/DEB package installed as per YMatrix deployment documentation, but do not initialize a new cluster via the graphical interface.
Note!
The new server may host a YMatrix cluster with a different major version (e.g., YMatrix 4.8 on the old server and YMatrix 5.1 on the new server).
Collect information about the existing database cluster. Use more /etc/matrixdb5/cluster.conf to view the cluster ID.
[<username>@<master_hostname> ~]$ sudo /opt/ymatrix/matrixdb5/bin/mxctl expand init --cluster-id <clusterid> --unrestrict > /tmp/init
Add the new server.
[<username>@<master_hostname> ~]$ cat /tmp/init | sudo /opt/ymatrix/matrixdb5/bin/mxctl expand add --unrestrict --host <newhost> > /tmp/initadd
Check network connectivity between the discovered servers.
[<username>@<master_hostname> ~]$ cat /tmp/initadd | sudo /opt/ymatrix/matrixdb5/bin/mxctl expand netcheck > /tmp/netcheck
Switch to the mxadmin user.
[<username>@<master_hostname> ~]$ sudo su - mxadmin
Create a migration configuration file and edit it according to the instructions within to specify the instances to migrate.
$ mxmoveseg config --db-cluster-id <clusterid> --filename /tmp/migrate.cfg
# After creating the configuration file, manually edit the dbid (obtained by running SELECT * FROM gp_segment_configuration; after connecting to the database), hostname, etc., of the segments to be migrated. SPEC: If port conflicts exist between the new and old servers, assign new ports in the configuration file.
$ vim /tmp/migrate.cfg
Generate the migration plan.
$ mxmoveseg plan --init-file /tmp/netcheck --config-file /tmp/migrate.cfg > /tmp/plan
Execute the migration.
$ mxmoveseg setup --plan-file /tmp/plan --mode cli
After successful migration, verify the status of the migrated Mirror using the GUI: "Cluster Management" → "Cluster Overview" → "Instance View", or use the SELECT * FROM gp_segment_configuration SQL statement.
Warning!
If the source server was offline during migration, do not restart the old server after migration completes. Restarting will bring up the old management processes, causing service discovery conflicts with the new processes and potentially destabilizing the cluster.
Collect information about the existing database cluster. Use more /etc/matrixdb5/cluster.conf to view the cluster ID.
[<username>@<master_hostname> ~]$ sudo /opt/ymatrix/matrixdb5/bin/mxctl expand init --cluster-id <clusterid> --unrestrict > /tmp/init
Check network connectivity between the discovered servers.
[<username>@<master_hostname> ~]$ cat /tmp/init | sudo /opt/ymatrix/matrixdb5/bin/mxctl expand netcheck > /tmp/netcheck
Switch to the mxadmin user.
[<username>@<master_hostname> ~]$ sudo su - mxadmin
Create a migration configuration file and edit it according to the internal instructions to specify the Mirror instances to migrate.
$ mxmoveseg config --db-cluster-id <clusterid> --filename /tmp/migrate.cfg
# After creating the configuration file, manually edit the dbid (obtained by running SELECT * FROM gp_segment_configuration; after connecting to the database), hostname, etc., of the Mirror segments to be migrated. SPEC: If port conflicts exist between the target and original servers, assign new ports in the configuration file.
$ vim /tmp/migrate.cfg
Generate the migration plan.
$ mxmoveseg plan --init-file /tmp/netcheck --config-file /tmp/migrate.cfg > /tmp/plan
Execute the migration.
$ mxmoveseg setup --plan-file /tmp/plan --mode cli
After successful migration, verify the status of the migrated Mirror using the GUI: "Cluster Management" → "Cluster Overview" → "Instance View", or use the SELECT * FROM gp_segment_configuration SQL statement.