Top
Enterprise Postgres 17 SP1 Cluster Operation Guide(Database Multiplexing)

2.12 Setting Automatic Start and Stop of Mirroring Controller and Multiplexed Instances

Multiplexed instances and Mirroring Controller can be started and stopped automatically in line with the starting and stopping of the operating system of the database server.

Perform the following procedure:

  1. Create a unit file

    Copy the unit file sample stored in the directory below, and revise it to match the target instance.

    Sample file
    /installDir/share/mcoi.service.sample
    Example)
    In the following example, the installation directory is "/opt/fsepv<x>server64", and the instance name is "inst1". Note that "<x>" indicates the product version.
    # cp /opt/fsepv<x>server64/share/mcoi.service.sample /usr/lib/systemd/system/mcoi_inst1.service

    Revise the underlined portions of the options below in the unit file.

    Section

    Option

    Specified value

    Description

    Unit

    Description

    Fujitsu Enterprise Postgres MirroringController instanceName

    Specifies the feature overview.

    Specifies the name of the target instance. (*1)

    Service

    ExecStart

    /bin/bash -c 'installDir/bin/mc_std start installDir MirroringControllerManagementDir' mc_ctlOption'

    Command to be executed when the service is started.

    Specify the option you want to add when the mc_ctl command (start mode) is executed without the -M option in the mc_ctl option.

    Note that the content specified in this mc_ctl option is carried over from the mc_std command to the mc_ctl command.

    ExecStop

    /bin/bash -c 'installDir/bin/mc_std stop installDir MirroringControllerManagementDir' mc_ctlOption'

    Command to be executed when the service is stopped.

    Specify the option you want to add when the mc_ctl command (stop mode) is executed without the -M option in the mc_ctl option. However, you cannot specify the -a option, which also stops the Mirroring Controller process on the other server.

    Note that the content specified in this mc_ctl option is carried over from the mc_std command to the mc_ctl command.

    User

    User

    OS user account of the instance administrator user.

    Group

    Group

    Group to which the instance administrator user belongs.

    *1: The instance name should be as nameThatIdentifiesTheInstance.
    The naming conventions for identifying the instance are as follows:

    • Up to 16 bytes

    • The first character must be an ASCII alphabetic character

    • The other characters must be ASCII alphanumeric characters

  2. Enable automatic start and stop

    As the OS superuser, use the systemctl command to enable automatic start and stop.

    Example)
    # systemctl enable mcoi_inst1.service

Note

  • Since Mirroring Controller is automatically started and stopped on each server in accordance with the startup and shutdown of the OS, to prevent unnecessary automatic switching or errors by Mirroring Controller, start it from the OS of the primary server and stop it from the OS of the standby server.

  • Starting the database instance and Mirroring Controller requires time correction and opening the network environment, so set it to wait for these to be completed before starting.

Point

  • The sample unit file assumes that the Mirroring Controller service will automatically start and stop the database instance at the same time, but it can be customized according to the operation. For example, if you want to stop only the Mirroring Controller process while the database is running, create the Mirroring Controller and the database instance as separate services. In addition, by linking these services, you can automatically start and stop the Mirroring Controller and the multiplexed instances.

    • Create a unit file for the multiplexed instances

    • In the Mirroring Controller unit file, specify the --mc-only mc_ctl option and define the dependency relationship with the multiplexed instance service and the order in which the instance will start after the service has started

  • When using an arbitration server to perform automatic degradation, if you are considering starting the Mirroring Controller process on the database server before starting the Mirroring Controller arbitration process on the arbitration server, specify the --async-connect-arbiter option in the mc_ctl option and start the Mirroring Controller process.

  • After the Mirroring Controller process is started by system service management using systemctl, you can use the mc_ctl command to display the server status, switch, and disconnect the server.

  • To stop Mirroring Controller, use the systemctl command as an OS superuser, not the mc_ctl command.

    Example)

    # systemctl stop mcoi_inst1.service

    If the instance does not stop, refer to "Actions in Response to Failure to Stop an Instance" in the Operation Guide to stop the instance. Then, specify the -e option in the mc_ctl command to forcibly stop Mirroring Controller.

    Example)

    $ mc_ctl stop -M /mcdir/inst1 -e

    If Mirroring Controller is stopped using the mc_ctl command, the message below is output to the system log, however there is no issue because automatic stop is executed by systemd.

    Message

    FATAL: failed to stop Mirroring Controller target server:"{0}" (MCA00043)

See

  • For information about creating a unit file for a database instance, refer to "Configuring Automatic Start and Stop of an Instance" in the Installation and Setup Guide for Server.

  • For more information about unit files, refer to the documentation from your vendor.