Primary-Standby Switchover Method

Note!
Disaster recovery capability is available as an experimental feature in YMatrix version 6.0.0.

When a disaster occurs and all machines in the primary cluster become physically unavailable, users can only perform operations on the standby cluster side.

After the primary-standby switchover, the data in the standby cluster will no longer remain consistent with the primary cluster, and it is not possible to switch back to the standby cluster role.

Operating the Standby Cluster

  1. On the Master machine of the standby cluster, log in as the mxadmin user and run either the mxdr switch or mxdr switch -a command to perform the switchover.

    a. When using mxdr switch for switchover, the following prompt appears. You must confirm whether to proceed with the switchover.

     Continue promoting cluster for disaster recovery to normal cluster? Yy|Nn (default=N):

    b. Using mxdr switch -a skips the interactive confirmation step.

Operating the Publisher

  1. On the Publisher machine, run the following command as the mxadmin user to obtain the name of the Publisher managed by supervisor.
supervisorctl status

The output is shown in the image below. In this example, the Publisher process name is publisher_5V967HARnCHfRMTeyiLQgS.

dr_switch_1

  1. After identifying the Publisher process name, run the following command to stop it:
supervisorctl stop publisher_5V967HARnCHfRMTeyiLQgS
  1. Finally, run the following command to verify that the Publisher status changes to exited:
supervisorctl status

Example:

dr_switch_2

Using the Cluster After Switchover

  • After disaster recovery switchover, the standby YMatrix database cluster assumes the role of the primary cluster and provides normal service. The cluster can be used in the same way as a regular YMatrix database cluster.
  • Application connections to the database service can be redirected to the new primary cluster to resume normal operations.
  • If high availability is required, you can add standby masters and mirror segments to enable high availability for the YMatrix database cluster.

Remarks

Command-line Tools

This section describes the command-line tools related to disaster recovery functionality.

  • mxdr

    The mxdr command is used to start and manage the Subscriber and Publisher components, and to control the switchover of the standby database cluster.

      Usage:
        mxdr [flags]
        mxdr [command]
    
      Available Commands:
        completion  Generate the autocompletion script for the specified shell
        help        Help about any command
        switch      Promote disaster recovery cluster
    
      Flags:
        -c, --config-file string   path of the configuration file to start up
        -h, --help                 help for mxdr
        -s, --shard-cnt int        number of shards of the source database cluster
        -v, --version              version for mxdr
  • mxbox deployer dr

    The mxbox deployer dr tool is used to deploy disaster recovery components and the standby cluster.

      Usage:
        mxbox deployer dr [command]
    
      Available Commands:
        pub         Publisher deployer for dr
    
      Flags:
        -h, --help   help for dr
      Usage:
        mxbox deployer dr pub [command]
    
      Available Commands:
        config      Generate a config template file
        plan        Generate plan for migrating host.
        setup       Execute steps to deploy physical publisher.
    
      Flags:
        -h, --help   help for pub