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.
Note
To guarantee the startup sequence of Mirroring Controller on the primary and standby servers, first confirm that the primary server has started, and then start the standby servers in sequence.
Perform the following procedure:
Set the OS user account of the instance administrator user
If you logged in using the OS user account of the instance administrator user, set the environment variables required for starting the instance.
This setting is required for executing the "su -" command.
Edit the shell script
Copy the sample shell script, and edit the environment variables in the shell script to suit the environment.
Path of the sample shell script
/installDir/share/rc_mcoi.sample
Copy the revised shell script and set access permissions
As the OS superuser, copy the revised shell script to /etc/rc.d/init.d, and then set and register the access rights.
In the following example, the shell script was created as "rc_mc_inst1".
Example)
# cp rc_mc_inst1 /etc/rc.d/init.d/ # chmod 755 /etc/rc.d/init.d/rc_mc_inst1
Register and enable automatic start and stop
As the OS superuser, execute the chkconfig command to register and enable the script. To register and enable the script, specify the options shown in the table below.
Option | Description |
---|---|
--add | Registers the shell script as the startup script. |
--level | Sets and enables the startup script for each run level. |
In the following example, the shell script is registered, and then enabled for run levels 3 and 5.
Example)
# chkconfig --add rc_mc_inst1 # chkconfig --level 35 rc_mc_inst1 on
Perform the following procedure:
Create a unit file
Copy the unit file sample stored in the directory below, and revise it to match the target instance.
Path of the sample file
/installDir/share/mcoi.service.sample
Example)
In the following example, the installation directory is "/opt/symfoserver64", and the instance name is "inst1".
# cp /opt/symfoserver64/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 | Symfoware Server (Open Interface) 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 option is executed 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 is executed 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. | |
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
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