Name
cm_ctl - Start, stop or display the status of the conmgr process
cm_ctl - Start, stop, and display the status of the conmgr process, or register and unregister it as a Windows service
Synopsis
cm_ctl start [-D diretory] [-W] [--complete] [-t seconds]
cm_ctl stop [-D diretory] [-W] [-m {smart | fast | immediate}] [-t seconds]
cm_ctl status [-D directory] [-t seconds] [-i {all | instance | application}]
cm_ctl register [-D directory] [-N servicename] [-U username] [-P password] [-S a[uto] | d[emand] ] [-e source] [-W] [--complete] [-t seconds]
cm_ctl unregister [-N servicename]
Description
The start mode starts the conmgr process. The command returns at least after the heartbeat monitoring connection is completed with the primary server's instance.
When --complete is specified, wait until all instances configured in conmgr.conf have completed their heartbeat monitoring connections. You can set a timeout for these waits. The default of timeout is 60 seconds. Can be changed using the -t option. If it times out, it simply gives up waiting and the conmgr process remains up.
Note
If the primary is not among the instances configured in the cmgr.conf, use the -W option when starting Connection Manager with the cm_ctl command. Without the -W option, the cm_ctl command will not return until the primary connection is complete.
The stop mode sends a signal to the conmgr process to shut down and wait until the process disappeares.
The default of wait time is 60 seconds. Can be changed using the -t option. If it times out, it simply gives up waiting. There are three shutdown methods, "smart", "fast", and "immediate", specify with the -m option. The "smart" waits until all applications using the conmgr process run out of SQL connections before shutting down. The "fast" forces all applications using the conmgr process to disconnect from the conmgr process before shutting it down. As a result, the SQL connection for the application receives an error. The "immediate" terminates the conmgr process immediately. If nothing is specified, it stops in fast mode.
The status mode, if the commgr process exists, queries the conmgr process for instance and application information known to the conmgr process, and display them to standard output along with the state of conmgr itself.
The -i option allows you to specify what information to query. The "instance" queries information about the instance; The "application" queries information about the application; The "all" queries information about both. conmgr's own information is always displayed. The default time to wait for a query to return is 60 seconds. Can be changed using the -t option.
The register mode registers the conmgr process as a system service on Windows. The -S option allows you to select the service start type, either "auto" (to start the service automatically when the system starts) or "demand" (to start the service upon request).
The unregister mode unregisters the conmgr process from the Windows service.
Options
Wait until all instances configured in conmgr.conf have completed their heartbeat monitoring connections. If the When used with the -W option, the -W option takes precedence.
Specify the directory where conmgr.conf is located. If omitted, it refers to the directory specified by the environment variable CMDATA. You cannot omit both.
Specify the information to display the status.
Specify the mode of shutdown. The default is fast.
Specify how long to wait for the operation to complete. The unit is seconds. The default is 60 seconds.
In start mode, cm_ctl command returns immediately after forking conmgr process. In stop mode, the cm_ctl command returns without waiting for the process to disappeare.
The name of the cm_ctl event source to use for output to the event log when running as a Windows service. The default is conmgr. Note that this only controls messages sent from cm_ctl itself. After the conmgr process starts, the event source specified in event_source in conmgr.conf is used. If a failure occurs very early in the conmgr process startup, you may want to use the default event source name conmgr before the event source specified in conmgr.conf is set.
The name of the Windows service to register. This name is used as both the system name and the display name. The default is conmgr.
The password for the user who starts the service.
Start type of the Windows service to register. The start-type can be auto, demand, or one of the first characters of these two words. If you omit this option, auto is the default.
Username of the user who starts the service. Use the DOMAIN\username format for domain users.
Diagnostics
0: Normal end
2: Timeout occurred
3: Unable to access the specified directory
Other than the above: None of the above
0: Normal end
3: Unable to access the specified directory
4: conmgr process does not exist
Other than the above: None of the above
0: Normal end
Other than 0: Abnormal end
0: Normal end
Other than 0: Abnormal end
Privileges
The conmgr process cannot be started by the administrator(e.g. superuser(root) on Linux, users with Windows administrator privileges).
Example
The block of information that can be specified with the -i option is used as a unit. There is one blank line between the blocks and no blank lines within the blocks. It includes one or more spaces between columns and between data.
$ cm_ctl status -i all conmgr_status: status pid (1) (2) ready 3456 instance_information: addr port database_attr (3) (4) (5) 192.0.2.100 27500 standby 192.0.2.110 27500 primary 192.0.2.120 27500 standby 192.0.2.130 27500 unknown application_information: addr port pid connected_time (6) (7) (8) (9) 127.0.0.1 12345 5678 2022-02-15 02:03:04
(1) Status of the conmgr process starting : The process is starting its startup sequence but is not ready to accept connections from clients. ready : Ready to accept connections from clients. stopping : It has received an end instruction and is starting the stop sequence. inactive : The conmgr process does not exist. (2) PID of the conmgr process (3) Host name or IP address of the instance (4) Port number the postmaster listens on (5) Status of the instance (primary | primary(read-only) | standby | unknown) primary : Primary server primary(read-only) : Primary server (default transaction mode is read-only) standby : Standby server unknown : Unknown (*1) (6) Connection source IP address for conmgr process (7) Connection source (ephemeral) port number for conmgr process (8) PID of the connection source (9) Date and time conmgr process connection The ISO 8601 compliant date is followed by a blank, followed by the ISO 8601 compliant second precision time. This representation is a PostgreSQL string representation of type timestamp.
*1) Displays when you cannot connect to the instance.