Quick onboard
Deployment
Data Modeling
Connection
Migration
Query
Operations and Maintenance
Common Maintenance
Partition
Backup and Restore
Expansion
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 node (Mirror) addition tool mxaddmirrors.
mxaddmirrors tool allows you to add Mirrors to a YMatrix system that was initially deployed without Mirrors, and starts the online replication process between primary segments (Primary) and their corresponding Mirrors.Note!
The mirror addition process consumes system resources such as network bandwidth, I/O, and CPU. If the system is under heavy workload, this may impact ongoing business operations.
It is recommended to keep the database idle during the mirror addition process and minimize active queries and system load.
Below is a detailed description of the command-line arguments:
| Subcommand | Parameter | Description | Optional |
|---|---|---|---|
| config | Creates a custom configuration file | ||
| --db-cluster-id | Database cluster ID. Used to identify a unique database cluster | Optional | |
| --filename | Saves the generated configuration to the specified file. If the file does not exist, it will be created automatically. Redirection can also be used | Optional | |
| init | Gathers system information and generates a basic plan | ||
| --db-cluster-id | Database cluster ID. Stored in the /etc/matrixdb6/cluster.conf file. Use the last ClusterID if only one cluster is deployed; otherwise, select the appropriate --db-cluster-id for the target cluster |
Required | |
| --mirror-port-base | Starting port from which to search for an available port for Mirror processes. Defaults to searching from 7000 |
Optional | |
| plan | Generates the deployment plan | ||
| --init-file | Absolute path to the redirected output file from the init command |
Required | |
| --custom-config | Absolute path to the file generated by the config command |
Optional | |
| setup | Executes the deployment plan | ||
| --plan-file | Absolute path to the redirected output file from the plan command |
Required |
Note!
Only required parameters need to be specified if default behaviors are acceptable.
mxaddmirrors must be executed by a user with sudo privileges on the master host (except mxadmin, use absolute path /opt/ymatrix/matrixdb6/bin/mxaddmirrors). If the mxaddmirrors init command is mistakenly run under a non-sudo user, a mxaddmirrors.init file will be generated under that user's directory, readable but not writable by others. You must delete this file and re-run the command under a sudo-enabled user to regenerate it.
Two usage examples are provided: one using default behavior and another with custom configuration. Details are as follows:
Note!
Choose either Section 3.1 or 3.2. The default behavior uses YMatrix’s default Ring mirror distribution policy. With custom configuration, you can define alternative mirror placement strategies. Regardless of the method chosen, a complete mirror addition workflow must be followed.
$ mxaddmirrors init > /tmp/mxaddmirrors.init
$ mxaddmirrors plan --init-file /tmp/mxaddmirrors.init > /tmp/mxaddmirrors.plan
$ mxaddmirrors setup --plan-file /tmp/mxaddmirrors.plan --mode cli
config file. If the file does not exist, it will be created automatically:$ mxaddmirrors config --filename /tmp/config
config file:$ edit config
$ mxaddmirrors init > /tmp/mxaddmirrors.init
$ mxaddmirrors plan --init-file /tmp/mxaddmirrors.init --custom-config /tmp/config > /tmp/mxaddmirrors.plan
$ mxaddmirrors setup --plan-file /tmp/mxaddmirrors.plan --mode cli
The generated configuration file is in CSV format:
0||7000|
1||7000|
content_id, hostname, port, and rootdir of datadir (used to create database directories and files).content_id must not be empty and must be unique. All modified options take effect immediately—what you see is what you get.Note!
Starting from YMatrix 5, a new database architecture has been introduced. Themxaddmirrorstool is now used to add Mirrors and is not compatible withgpaddmirrors. For versions prior to YMatrix 5, use thegpaddmirrorstool.