Name
mc_ctl - Start, stop, switch, or disconnect Mirroring Controller, or display the server status or create a new standby server.
Overview
mc_ctl start [-M mcdir] [-w] [-f] [--mc-only] [--local-server server_id]
mc_ctl stop [-M mcdir] [[-a] [--mc-only]| [-e][--local-server server_id]]
mc_ctl status [-M mcdir] [--local-server server_id]
mc_ctl switch [-M mcdir] [--local-server server_id]
mc_ctl enable-failover [-M mcdir] [--local-server server_id]
mc_ctl disable-failover [-M mcdir] [--local-server server_id] mc_ctl setup [-M mcdir] -r standby -U username [-P password] -h hostname -p port -standby-name=standby_name [-c connstr] [--local-server=server_id]
Description
Starts, stops, switches, or disconnects Mirroring Controller, or displays the server status.
The start mode starts Mirroring Controller. If the --mc-only option is omitted, the command starts a database instance. Specify the -w option to get the status of this command.
The stop mode stops Mirroring Controller. If the --mc-only option is omitted, the database instance is stopped. If --mc-only option is not specified, database instance is also stopped. When executes on standby server without --mc-only, standby server will be detached from primary server.
The status mode displays the status of the servers, database instance processes, and disks monitored by Mirroring Controller.
The switch mode switches the primary server. When the server is switched, the database instance on the primary server stops, and the database instance on the standby server is upgraded to primary server and begins degrading operation.
The enable-failover mode enables automatic switching and disconnection. You can use this mode after installing the Mirroring Controller option.
The disable-failover mode disables automatic switching and disconnection. You can use this mode after installing the Mirroring Controller option.
The setup mode creates a new standby server.
If Mirroring Controller has not been started on the server that executes the command, commands for any mode other than start mode and status mode terminate with an error.
Execute this command as an instance administrator.
Until you start Mirroring Controller of standby server after starting Mirroring Controller of the primary server, disconnect of the standby server occurs operation to be able to continue with only the primary server. Standby server is incorporated when you start the Mirroring Controller of standby server, and you should be able to operate in the multiplexing configuration.
Options
Specify this option to stop Mirroring Controller on all servers.
Specify a connection string to connect to the primary server in keyword/value format.
Refer to "primary_conninfo" in the "Standby Server Settings" in the PostgreSQL Documentation for information on connection string.
If you specify the following parameter key words in -c option, the error will occur. Because there are specified in other options.
-host -port -user -password -application
The equivalence relationship between the parameter key word and the option are follows.
-host : -h option -port : -p option -user : -U option -password : -P option -application_name : --standby-name option
Specify this option to forcibly stop Mirroring Controller on the active server.
Specify this option to enable automatic switching and disconnection of Mirroring Controller immediately after startup.
This option is available only if you install the Mirroring Controller options.
Specify the host name or IP address.
If you run a simulation build of the primary and standby servers in a single server (for system testing, for example), specify this option to identify the server to be operated.
For server_id, specify the server identifier specified in the network.conf file. ASCII characters other than single-byte space can be specified in the server identifier. The operations will be executed as if the user has logged in to server_id.
Specify this option to start and stop only Mirroring Controller processes. At the start mode, this option can be specified only while the database instance is running. If this option is omitted, the database instance is simultaneously started and stopped.
Specify the Mirroring Controller management directory. ASCII characters other than single-byte space can be specified in the Mirroring Controller management directory. If this option is omitted, the value of the MCCONTROLDIR environment variable is used.
Specify the password of the username specified by the -U option.
Specify the port number of the instance on the primary server.
Specify this option to create a new standby server.
Specify the name of the standby server. For standby_name, specify the same as synchronous_standby_name parameter in the postgresql.conf on the primary server.
Specify the username with REPLICATION privileges.
Waits for operations to finish.
Environment variable
Specifies the Mirroring Controller management directory. ASCII characters other than single-byte space can be specified in the Mirroring Controller management directory. You can specify the -M option to override this value.
Diagnostics
0: Normal end
Other: Abnormal end
Notes
The message under execution might be output though the mc_ctl command is not being executed and, besides, it terminate abnormally when the server is downed while processing execution of this command, an automatic switch, and an automatic separation, and the communication between a primary server and the standby server is cut off. Besides, please reactivate Mirroring Controller to solve this problem after confirming nobody is operating the mc_ctl command. Afterwards, please execute a necessary operation.
If a time-out error occurs when the mc_ctl command is in progress, the messages may be different from the processes. Take the actions described in the "Action" section of the message.
Automatic switching and disconnection by the enable-failover mode, the disable-failover mode, and the -f option of the start mode is effective only while Mirroring Controller is running. Therefore, please activate each time you start the Mirroring Controller if you want to enable automatic switching and disconnection.
In case of postgresql.conf has any incorrect parameter when this command is executed, this command will be abnormally terminated. If this is the case, please re-execute it again after correct the parameter in postgresql.conf.
Example
To start Mirroring Controller:
$ mc_ctl start -M /mcdir/inst1
mirroring status ---------------- (1) server_id host_role host host_status db_proc_status disk_status (2) (3) (4) (5) (6) (7)
(1) Multiplexing status switchable : Switchable switching : Switching switched : Switched (displayed when switching has finished and the degrading operations status has been enabled) not-switchable : Not switchable (displayed when a server is disconnected and switching is not possible) unknown : Unknown (*1) failover-disabled : Failover is disabled (2) Server identifier (3) Server role primary : Primary standby : Standby none(inactivated primary): No role (primary is stopped or being defined as primary) none(inactivated standby): No role (standby is stopped or being defined as primary) (4) Host name or IP address (5) Live/dead state of the server normal : Normal operation abnormal : Abnormal unknown : Unknown (*1) (6) DBMS process status normal : Normal abnormal (abnormal process name (*2)) : Abnormal unknown : Unknown (*1) (7) Disk status normal : Normal abnormal (abnormal disk type (*3)) : Abnormal unknown : Unknown (*1)
*1: Displayed when Mirroring Controller is stop state, the management network is abnormal, or Mirroring Controller has failed or is unresponsive.
*2: The names of the DBMS processes in which the abnormality was detected are output separated by a comma. The name has the following meaning: -postmaster: Process (postmaster) that accepts application connections -wal_sender or wal_receiver: Process (WAL sender or WAL receiver) that sends and receives transaction logs *3: The types of disks where the abnormality was detected are output separated by a comma. The type has the following meaning: -data: Data storage disk -tran_log: Transaction log storage disk -tablespace: Tablespace storage disk