gs_om
Background
openGauss provides the gs_om tool to help maintain the database, including starting the openGauss, stopping the openGauss, querying the openGauss status, querying the static configuration, generating the static configuration file, querying the openGauss status details, generating the dynamic configuration file, replacing the SSL certificate, and displaying the help information and version number.
Prerequisites
Log in to the OS as the OS user omm to run the gs_om command.
Syntax
Start openGauss.
gs_om -t start [-h HOSTNAME] [-D dataDir] [--time-out=SECS] [--security-mode=MODE] [--cluster-number=None] [-l LOGFILE]
Stop openGauss.
gs_om -t stop [-h HOSTNAME] [-D dataDir] [--time-out=SECS] [-m MODE] [-l LOGFILE]
Restart openGauss.
gs_om -t restart [-h HOSTNAME] [-D dataDir] [--time-out=SECS] [--security-mode=MODE] [-l LOGFILE] [-m MODE]
Query the openGauss status.
gs_om -t status [-h HOSTNAME] [-o OUTPUT] [--detail] [--all] [-l LOGFILE]
Generate a static configuration file.
gs_om -t generateconf -X XMLFILE [--distribute] [-l LOGFILE] gs_om -t generateconf --old-values=old --new-values=new [--distribute] [-l LOGFILE]
Generate a dynamic configuration file. Perform this operation after the failover or switchover from the standby node to the primary node.
gs_om -t refreshconf
Display the static configurations.
gs_om -t view [-o OUTPUT]
Query openGauss status details.
gs_om -t query [-o OUTPUT]
Replace SSL certificates.
gs_om -t cert --cert-file=CERTFILE [-l LOGFILE] gs_om -t cert --rollback
Enable or disable the Kerberos authentication in the database.
gs_om -t kerberos -m [install|uninstall] -U USER [-l LOGFILE] [--krb-client|--krb-server]
Display help information.
gs_om -? | --help
Display the version number.
gs_om -V | --version
Parameter Description
The gs_om tool can use the following types of parameters:
Common parameters
-t
Specifies the gs_om command type.
Value range: start, stop, status, generateconf, cert, view, query, refreshconf, and kerberos
-l
Specifies a log file and its storage path.
Default value: $GAUSSLOG**/om/gs_om-YYYY-MM-DD_hhmmss.log** (default value for virtualip: /tmp/gs_virtualip/gs_om-YYYY-MM-DD_hhmmss.log)
-?, --help
Displays help information.
-V, --version
Displays version information.
Parameters for starting the openGauss:
-h
Specifies the name of the server to be started. Only one server can be started at a time.
Value range: a server name
If no server name is specified, openGauss is started.
-D
Specifies the path of the database node.
Value range: database node path.
If the database node path is not specified, the database node path in the static file is used.
NOTE: For a cluster where the CM tool is deployed, if the -D parameter is specified when you start or stop a single instance, only the database process is started or stopped, and the CM process is not affected.
Assume that the database and CM processes of the current instance are stopped. If the -D parameter is specified when the instance is started, only the database process will be started. In this case, the database process fails to be started because the CM process does not exist. You can remove the -D parameter to start the entire instance.
--time-out=SECS
Specifies the timeout threshold. gs_om exits when times out. (Unit: second)
Value range: a positive integer. The recommended value is 300.
Default value: 300
--security-mode
Specifies whether to start the database in security mode.
Value range:
- on: security mode enabled
- off: security mode disabled. By default, the security mode is disabled.
--cluster-number
Specifies the kernel running version during startup.
Value range: kernel version
Parameters for stopping the openGauss:
-h
Specifies the name of the server where the instance to be stopped is located. Only one server can be stopped at a time.
Value range: the name of the server where the instance is located.
If no server name is specified, openGauss is stopped.
-m, --mode=MODE
Sets the stop mode.
Value range: the following stop modes are supported.
- fast: The data of the primary and standby instance relationship is ensured to be consistent.
- immediate: The data of the primary and standby instance relationship is not ensured to be consistent.
Default value: fast
--time-out=SECS
Specifies the timeout threshold. gs_om exits when times out. (Unit: second)
Value range: a positive integer. The recommended value is 300.
Default value: 300
Parameters for checking the status:
Table 1 describes parameters in the query result.
-h
Specifies the name of the server to be queried.
Value range: a server name.
If no server is specified, openGauss is queried.
--az
Specifies the name of the AZ to be queried, for example, --az=AZ1.
Value: name of the AZ. If no AZ name is specified, all AZs are queried.
-o
Outputs status information to the specified output file.
If the parameter is not output to the specified file, it is displayed on the screen.
--detail
Displays detailed information. If the parameter is not specified, only a prompt is displayed indicating whether the server is normal.
You can run the gs_ctl query command on each database node to query and summarize the results to obtain the detailed information about openGauss.
--all
Displays information about all openGauss nodes. You can run the **gsql **command on each database node to query the system catalog and summarize the results to obtain information about all openGauss nodes. Ensure that **gsql **can be used to query the correct information before using this parameter.
Parameters for generating the configuration file:
-X
Specifies the path of the openGauss configuration file.
Value range: path of the clusterconfig.xml file
--old-values=old
Specifies the old value in the static file to be modified.
Value range: port, ip, hostname. You can enter multiple values and separate them with commas (,).
--new-values=new
Specifies the new value in the static file to be modified.
Value range: port, ip, hostname. You can enter multiple values and separate them with commas (,). The values correspond to old-values.
--distribute
Publishes the static configuration file to the installation directory of the openGauss instance.
Enable or disable the Kerberos authentication in the database:
-U
Specifies a database deployment user.
Value range: a database deployment user
-m
Specifies the operation to be performed.
Value range:
install: enables the Kerberos authentication in a database.
uninstall: disables the Kerberos authentication in a database.
--krb-server: installs the Kerberos server authentication.
--krb-client: installs the Kerberos client authentication.
Note: You need to use --krb-server to install the server authentication first. These two parameters are not required during the uninstallation because the server and client are uninstalled at the same time.
Parameters for replacing the SSL certificate:
--cert-file
Specifies the path of the local SSL certificate .zip package.
--rollback
The certificate is rolled back to the last successfully backup status.
-L
If this parameter is specified, the operation is performed only on the current node.
Table 1 Status description
Table 2 Feature ID description
openGaussHA in openGauss (one primary and multiple standbys) | ||
Examples
Start openGauss.
gs_om -t start Starting cluster. ====================================================================== . ====================================================================== Successfully started .
Stop openGauss.
gs_om -t stop Stopping cluster. ========================================= Successfully stopped cluster. ========================================= End stop cluster.
View openGauss status details, including instance status.
gs_om -t status --detail [ Cluster State ] cluster_state : Normal redistributing : No current_az : AZ_ALL [ Datanode State ] node node_ip port instance state ----------------------------------------------------------------------------------------------------------------- 1 pekpopgsci00235 10.244.62.204 5432 6001 /opt/gaussdb/cluster/data/dn1 P Primary Normal 2 pekpopgsci00238 10.244.61.81 5432 6002 /opt/gaussdb/cluster/data/dn1 S Standby Normal
Run the following command on openGauss to generate the configuration file.
gs_om -t generateconf -X /opt/software/openGauss/clusterconfig.xml --distribute Generating static configuration files for all nodes. Creating temp directory to store static configuration files. Successfully created the temp directory. Generating static configuration files. Successfully generated static configuration files. Static configuration files for all nodes are saved in /opt/opengauss/Bigdata/gaussdb/wisequery/script/static_config_files. Distributing static configuration files to all nodes. Successfully distributed static configuration files.
Run the following command on openGauss to modify the configuration file. To modify a dynamic configuration file, run the gs_om -t refreshconf command and modify the GUC parameter to make the actual port or IP address take effect.
gs_om -t generateconf --old-values=26000,192.168.1.1 --new-values=36000,192.168.1.2 --distribute Generating static configuration files for all nodes. Creating temp directory to store static configuration files. Successfully created the temp directory. Generating static configuration files. Successfully generated static configuration files. Static configuration files for all nodes are saved in /opt/huawei/Bigdata/gaussdb/wisequery/script/static_config_files. Distributing static configuration files to all nodes. Successfully distributed static configuration files.
Open the generated configuration file directory. You can see three new files.
cd /opt/opengauss/Bigdata/gaussdb/wisequery/script/static_config_files ll total 456 -rwxr-xr-x 1 omm dbgrp 155648 2016-07-13 15:51 cluster_static_config_plat1 -rwxr-xr-x 1 omm dbgrp 155648 2016-07-13 15:51 cluster_static_config_plat2 -rwxr-xr-x 1 omm dbgrp 155648 2016-07-13 15:51 cluster_static_config_plat3
Roll back SSL certificates.
gs_om -t cert --rollback [plat1] SSL cert files rollback successfully. [plat2] SSL cert files rollback successfully. [plat3] SSL cert files rollback successfully.
Register a license.
gs_om -t license -m register -f MTgsMTkK Preparing for the program initialization. Lock the OPS operation of OM components. Check and make sure the consistency of the license file. Backup the license file on all of the cluster hosts. Encrypt the product feature information and generate the license file. Send message to the *database node* instances to reload the license file. Remove the backup license file on all of the cluster hosts. License register successfully.
Deregister a license.
gs_om -t license -m unregister -f MTgsMTkK Preparing for the program initialization. Lock the OPS operation of OM components. Check and make sure the consistency of the license file. Backup the license file on all of the cluster hosts. Encrypt the product feature information and generate the license file. Send message to the *database node* instances to reload the license file. Remove the backup license file on all of the cluster hosts. License unregister successfully.