- About PTK
- Quick Start
- Guidance
- Preparing Configuration File
- Checking the System
- Deploy Database Cluster
- Manage Clusters
- Show Cluster List
- Show Cluster Status
- Start Database
- Stop Database
- Restart Database
- Rebuild Database
- Switchover
- Failover
- Show Plugin Information
- Install Plugins
- Upgrade Database
- Scale-out Cluster
- Scale-in Cluster
- Show Database HBA
- Set Database HBA
- Show Database Parameters
- Set Database Parameters
- Show Cluster Topology Configuration
- Show Cluster Meta Information
- Update Cluster Comment
- Update Database IP
- Role Management
- Install CM
- Uninstall CM
- Manage Cluster VIP
- Install MogHA Service
- Uninstall MogHA Service
- Rename Cluster
- Create Empty Cluster
- Throw Out A Node
- Takeover A Node
- Manage Cluster
- Uninstall Database Cluster
- Collect OS Information
- Download MogDB Installer
- Encrypt Sensitive Information
- Upgrade PTK
- PTKC
- Compatible With Higher Versions of MogDB
- Reference
- Samples of Configuration Files
- Commands
- ptk
- ptk completion
- ptk view-static-config
- 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 createdb
- ptk cluster uninstall-compat-tools
- ptk cluster install-compat-tools
- ptk cluster install-mogila
- 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 Notes
- Community
- Appendix: YAML Syntax
Role Management
Manages the roles of the database nodes in the cluster.
Purpose
To facilitate more flexible management of the roles of database nodes to meet the expectations of users.
Precautions
The role management of PTK gives more flexible operation to managers, so some of the following situations may occur:
- Cluster has no primary node after role change.
- Cluster has multiple primary nodes after a role change.
Managers need to ensure that they are aware of these scenarios and that they meet expectations.
Promote Role
Promote order:
cascade_standby -> standby -> primary
Note: When you promote the roles of a database node, the roles are promoted gradually in the order of promotion.
Promote Role Command
The command is as follows:
ptk cluster -n <CLUSTER_NAME> promote [-H|--host HOST] [-i|--id ID]
Options:
option name | option type | description |
---|---|---|
-H|--host | String | The IP of the database node where the role is to be promoted |
-i|--id | Integer | Database node ID of the role to be promoted |
Note: If -H
and -i
are specified, only the value of -i
is used to perform the operation.
Demote Role
Demote order:
primary -> standby -> cascade_standby
Note: When you demote the roles of a database node, the roles are demoted progressively in the order of demotion.
Demote Role Command
The command is as follows:
ptk cluster -n <CLUSTER_NAME> demote [-H|--host HOST] [-i|--id ID] [--upstream UPSTREAM_HOST]
Options:
option name | option type | description |
---|---|---|
-H|--host | String | IP of the database node where the role to be demoted is located |
-i|--id | Integer | ID of the database node of the role to be demoted |
--upstream | String | IP of the upstream node of the database node of the role to be demoted |
Note: If -H
, -i
both specify values, only the value of -i
is used to perform the operation. To demote a standby
node, specify the parameter --upstream
.
QA
Why is there no primary node? How to recover it?
Reason for no primary node: After demote
operation on the primary node of a cluster, there will be no primary node.
How to recover: Select a standby
node and perform a promote
operation to promote it to primary.
Why are there multiple primary nodes? How to recover to a single primary node?
Reason for multiple primary nodes: Multiple promote
operations on a cluster's non-primary nodes will result in multiple primary nodes.
How to recover: demote
the undesired primary node until one primary node is left.
After a role operation, will there be multiple cascades with one primary and no standby?
No. PTK has made a judgment for standby
node promotion or demotion operation to prevent this situation.