- Overview
- Quick Start
- Install PTK
- Usage
- Configuration
- Config Samples
- Commands
- ptk
- ptk completion
- ptk register
- ptk init-cluster
- ptk collect
- ptk rec-guc
- ptk cache
- ptk gen-ptkc
- ptk manage
- ptk demo
- ptk meta
- ptk version
- ptk self
- ptk gen-om-xml
- ptk env
- ptk gen-static-config
- ptk cluster
- ptk cluster rename
- ptk cluster throwout
- ptk cluster takeover
- ptk cluster uninstall-cm
- ptk cluster install-cm
- ptk cluster gen-cert-files
- ptk cluster load-cm-vip
- ptk cluster del-kerberos-auth
- ptk cluster add-kerberos-auth
- ptk cluster uninstall-kerberos-server
- ptk cluster install-kerberos-server
- ptk cluster is-in-upgrade
- ptk cluster upgrade-rollback
- ptk cluster upgrade-commit
- ptk cluster upgrade
- ptk cluster demote
- ptk cluster promote
- ptk cluster refresh
- ptk cluster shell
- ptk cluster modify-comment
- ptk cluster show-config
- ptk cluster set-guc
- ptk cluster show-guc
- ptk cluster set-hba
- ptk cluster show-hba
- ptk cluster scale-out
- ptk cluster scale-in
- ptk cluster uninstall-mogha
- ptk cluster install-mogha
- ptk cluster list-plugins
- ptk cluster install-plugin
- ptk cluster inspect
- ptk cluster failover
- ptk cluster switchover
- ptk cluster build
- ptk cluster status
- ptk cluster restart
- ptk cluster stop
- ptk cluster start
- ptk uninstall
- ptk ls
- ptk install
- ptk exec
- ptk template
- ptk encrypt
- ptk checkos
- ptk download
- ptk candidate
- Troubleshooting
- FAQ
- Release Note
- GPTK - Graphical Deployment Tool
- Community
- Appendix: YAML Syntax
Instance-Level Cluster O&M Tool - ptkc
The tool is supported since PTK V0.8.
During installation of a database cluster, PTK will generate a tool named ptkc
under the database system user.
Comparison Among ptkc, gs_ctl, and gs_om
Function | ptkc | gs_ctl | gs_om |
---|---|---|---|
Query the database status | Support for cluster and instance | Support for the local instance only | Support for cluster and instance |
Start a database | Support for cluster and instance | Support for the local instance only | Support for cluster and instance |
Stop a database | Support for cluster and instance | Support for the local instance only | Support for cluster and instance |
Restart a database | Support for cluster and instance | Support for the local instance only | Support for cluster and instance |
Rebuild a database | Supported on the local and remote servers | Support for the local instance only | Supported on the local and remote servers |
Specify an upstream node to rebuild a database | Supported | Supported | Not supported |
Failover | Supported on the local and remote servers | Support for the local instance only | Not supported |
Switchover | Supported on the local and remote servers | Support for the local instance only | Not supported |
Query database parameters | Supported on the local and remote servers | Not supported | Not supported |
View HBA information | Supported on the local and remote servers | Not supported | Not supported |
ptkc Usage
ptkc usage is kept consistent with ptk usage. PTK is a multi-cluster management tool and ptkc is a single-cluster O&M tool. Therefore, the ptkc instructions are more simple than those of PTK.
Note: ptkc itself does not store any metadata and completely depends on the existing status file to parse cluster information. Because the current status information does not include the system user information, ptkc does not support such scenarios as multiple nodes, multiple users, and multiple instances on a single server.
The following shows some examples. For more commands, run ptkc -h
.
Query the Cluster Status
$ ptkc status
[ Cluster State ]
cluster_name : c1
cluster_state : Normal
database_version : MogDB 3.0.4 (build cc068866)
[ Datanode State ]
cluster_name | id | ip | port | user | nodename | db_role | state | upstream
---------------+------+-------------+-------+------+----------+---------+--------+-----------
c1 | 6001 | 172.23.1.87 | 33300 | vmx1 | dn_6001 | primary | Normal | -
| 6002 | 172.23.1.88 | 33300 | vmx1 | dn_6002 | standby | Normal | -
Restart a Cluster
ptkc restart
Perform Primary/Standby Switchover
$ ptkc switchover -H 172.23.1.88
INFO[2023-05-26T17:58:15.234] start switchover, please wait a few moments ...
INFO[2023-05-26T17:58:20.324] switchover output:
[2023-05-26 17:58:15.295][3035571][][gs_ctl]: gs_ctl switchover ,datadir is /home/vmx1/mogdb/data
[2023-05-26 17:58:15.295][3035571][][gs_ctl]: switchover term (1)
[2023-05-26 17:58:15.299][3035571][][gs_ctl]: waiting for server to switchover........
[2023-05-26 17:58:20.323][3035571][][gs_ctl]: done
[2023-05-26 17:58:20.323][3035571][][gs_ctl]: switchover completed (/home/vmx1/mogdb/data)
INFO[2023-05-26T17:58:20.324] switchover successfully
$ ptkc status
[ Cluster State ]
cluster_name : c1
cluster_state : Normal
database_version : MogDB 3.0.4 (build cc068866)
[ Datanode State ]
cluster_name | id | ip | port | user | nodename | db_role | state | upstream
---------------+------+-------------+-------+------+----------+---------+--------+-----------
c1 | 6001 | 172.23.1.87 | 33300 | vmx1 | dn_6001 | standby | Normal | -
| 6002 | 172.23.1.88 | 33300 | vmx1 | dn_6002 | primary | Normal | -
Query Database Parameters
$ ptkc show-guc -k port
port = 33300
Generate ptkc
The PTK installation package does not provide the ptkc tool by default. You need to generate the ptkc tool by running the following command.
ptk gen-ptkc