Quick onboard
Deployment
Data Modeling
Connecting
Migration
Query
Operations and Maintenance
Common Maintenance
Partition
Backup and Restore
Expansion
Mirroring
Resource Management
Security
Monitoring
Performance Tuning
Troubleshooting
Reference Guide
Tool guide
Data type
Storage Engine
Executor
Stream
DR (Disaster Recovery)
Configuration
Index
Extension
SQL Reference
This document describes the mirror segment instance (Mirror) migration tool mxmoveseg.
Note!
mxmovesegis used only to migrate segment instances in thegp_segment_configurationtable where therole(current role) ism(mirror). It does not depend on thepreferred_role(preferred role) column.
mxmoveseg tool supports migrating any database segment instance currently serving as Mirror/Standby to another server.Note!
Before using this tool, you must assess the health of all servers in the system. If any servers are unhealthy, identify them explicitly to ensure thatmxmovesegcan collect information only from healthy hosts.
The following table lists the available command-line options:
| Option | Description |
|---|---|
--config |
Create a configuration file for the Mirror segment to be migrated |
--plan |
Generate a migration plan based on the configuration |
--setup |
Execute the migration plan |
-h / --help |
Display 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 through 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. Edit the required segment instances according to the instructions in the generated file.
$ 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 segment to be migrated. SPEC: If there is a port conflict between the new and old servers, specify a new port 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.
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. Edit the required segment instances according to the instructions in the generated file.
$ 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 to be migrated. SPEC: If there is a port conflict between the target and original servers, specify a new port 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.