mxaddmirrors

This document introduces the Mirror Adding Tool mxaddmirrors.

1 Description

  • Function
    • The mxaddmirrors tool supports adding Mirror to the YMatrix system where Mirror was not initially configured and starts the online replication process between the data node primary node and Mirror.
    • Once all Mirrors are synchronized with their corresponding Primary, your YMatrix database system has established complete data redundancy.

Notes!
During the addition process, the database should be in a quiescent state and loads and other queries should not run.

2 Command line parameter information

The following is a detailed command line parameter information:

| Subcommand | Parameter name | Description | Optional | | --- |------------------------------------------ | --- | | config | | Create a custom configuration file | | | | --init-file | Initialize config template | Optional | | | --db-cluster-id | Database cluster ID. To identify a unique database cluster | Optional | | | --filename | Save the generated configuration to this file. If this file does not exist, it will be generated automatically. Redirects are also available | Optional | | init | | Convert the collected information into a basic plan | | | | --db-cluster-id | Database cluster ID. Placed in the /etc/matrixdb5/cluster.conf file. If only one cluster is currently deployed, use the last ClusterID, otherwise select the --db-cluster-id of the corresponding cluster | Required | | | --mirror-port-base | Start searching for an idle port as the port for Mirror listening from the current port, and start searching from 7000 by default | Optional | | plan | | Generate deployment plan | | | | --init-file | init command output information redirects the absolute path of the redirect file | Required | | | --custom-config | The absolute path of the file generated by the config command | Optional | | setup | | Execution deployment | | | | --plan-file | plan command outputs the absolute path to the redirect file | Required |

Notes!
If you do not need to modify the default behavior, just select the required parameters.

3 Usage process example

mxaddmirrors need to be executed on users with sudo permissions (except mxadmin, the absolute path /opt/ymatrix/matrixdb6/bin/mxaddmirrors) except for mxadmin. If the mxaddmirrors init command is executed on a user without sudo permission, the mxaddmirrors.init file will be generated under that user, and other users can only read but not write. The generated file needs to be deleted, and then re-execute the command on the user with sudo permissions to re-generate the file.
Here we give two examples of process: default behavior and custom configuration. The details are as follows:

Notes!
3.1, 3.2 Choose any of them. The default behavior will adopt YMatrix's default [Ring mirror distribution policy] (/doc/latest/reference/mirror_distribution_policy), and the custom configuration can be adjusted to other mirroring policies you need. Whether you choose default behavior or customization, you need to perform a complete Mirror addition process.

3.1 Default Behavior

  1. Collect machine information and some information about the deployed database.
    $ mxaddmirrors init > /tmp/mxaddmirrors.init
  2. Generate a deployment plan based on the collected information, that is, the specific deployment steps.
    $ mxaddmirrors plan --init-file /tmp/mxaddmirrors.init > /tmp/mxaddmirrors.plan
  3. Perform deployment.
    $ mxaddmirrors setup --plan-file /tmp/mxaddmirrors.plan --mode cli

    3.2 Custom configuration

  4. Collect machine information and some information about the deployed database.
    $ mxaddmirrors init > /tmp/mxaddmirrors.init
  5. Save the generated configuration to the config file. If this file does not exist, it will be generated automatically.
    $ mxaddmirrors config --init-file /tmp/config

    Notes!
    Balanced and non-balanced clusters can generate reasonable configuration plans, but they still require manual inspection.

  6. Edit the config file.
    $ edit config
  7. Generate a deployment plan based on the collected information, that is, the specific deployment steps.
    $ mxaddmirrors plan --init-file /tmp/mxaddmirrors.init --custom-config /tmp/config > /tmp/mxaddmirrors.plan
  8. Perform deployment.
    $ mxaddmirrors setup --plan-file /tmp/mxaddmirrors.plan --mode cli

    The generated configuration file is in CSV format.

    0||7000|
    1||7000|
  • There are four columns in this file, namely content_id, hostname, port and rootdir of datadir (in this directory and files generate various databases).
  • If it is a null value, it means that this configuration is not modified and the default behavior is used.
  • content_id is not allowed to be empty and cannot be repeated. The modified options will take effect, and what you see is what you get.

Notes!
The configuration rules for configuration files in non-balanced deployment can be adjusted by referring to the [Related content] in the cluster non-balanced deployment (/doc/latest/install/asymmetric#1.6.4%20%E5%AE%9E%E4%BE%8B%E5%88%86%E5%B8%83%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E7%9A%84%E8%A7%84%E5%88%99).

Notes!
Deploy a brand new database schema from YMatrix 5, enable the mxaddmirrors tool to add Mirrors, which is no longer compatible with gpaddmirrors. Previous versions were available with the gpaddmirrors tool.

See also: mxinitstandby, mxdeletesysystem.