- 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
Takeover A Node
In some specific scenarios, PTK may not be able to sense the addition of a new node and thus manage it. Since version 1.5.0, PTK provides a command to takeover a node.
The main purpose of this directive is that when a user manually adds a node to an existing PTK cluster and improves the relationship between the new node and the cluster, and then PTK is unable to sense the addition of the new node, then it is necessary to use the ptk cluster takeover
directive to takeover the user-installed new node into PTK's metadata, so as to realize effective management of the new node.
It is also possible to create an empty cluster and takeover a non-PTK installed cluster to allow PTK to manage it.
Usage
When you need to takeover a specified node, you can execute the following command:
ptk cluster -n <CLUSTER_NAME> takeover [-H|--host <IP>] [-U|--user <USERNAME>] [-i|--identity <IDENTITY FILE>] [--appdir <DIR>] [--datadir <DIR>] [--logdir <DIR>] [--tmpdir <DIR>] [--tooldir <DIR>]
[-H|--host <IP>]
: Specifies the host on which the node is to be taken over, required. This parameter specifies the IP address of the host where the node to be taken over resides.[-U|--user <USERNAME>]
: Specify the user who will takeover the node, required field. Specify the exact user corresponding to the node for effective connection and management.[-i|--identity <IDENTITY FILE>]
: SSH private key path. This helps establish a more secure connection method.[--appdir <DIR>]
: Directory of the database.[--datadir <DIR>]
: The data directory for the database that specifies exactly where the data is stored.[--logdir <DIR>]
: The log directory of the database, which is used to store related log information.[--tmpdir <DIR>]
: The temporary directory of the database, which handles the storage area for temporary data.[--tooldir <DIR>]
: The tools directory of the database, which deals with where the relevant tools are stored.
It should be noted that only two parameters in the takeover
command are required, and the other parameters can be filled in or not according to the actual situation.
PTK will connect to the machine based on the user and machine information provided, and then obtain the database information under the machine.
When -i|--identity
is not filled in, PTK will interactively instruct the user to enter a password or secret key to ensure the security and reliability of the connection. As follows:
$ ptk cluster -n test takeover -U mog -H <IP>
Use the arrow keys to navigate: ↓ ↑ → ←
? [retry: 1] please choose the auth method for connecting mog@<IP>:
▸ password
keyfile
In this case, you can choose the corresponding way to fill in.
In addition, in practice, users need to ensure that the information provided is accurate, especially the host IP and user information, which will directly affect the success of the takeover operation.
At the same time, if you fill in the directory of the database, you need to fill in according to the actual deployment situation to ensure the normal operation and effective management of the database. If you don't fill in the directory, as in the following example, PTK will automatically check the corresponding directory for users to confirm.
The following is a complete example:
$ ptk cluster -n test takeover -U mog -H <IP>
✔ [retry: 1] please choose the auth method for connecting mog@<IP>: password
✔ please enter the password: *********
Information about the node (mog@1<IP>) to be takeover:
1 | appdir | /opt/mogdb-mog/app
2 | datadir | /opt/mogdb-mog/data
3 | logdir | /opt/mogdb-mog/log
4 | tmpdir | /opt/mogdb-mog/tmp
5 | tooldir | /opt/mogdb-mog/tool
6 | port | 23419
✔ Do you want to modify them (default=n) [y/n]: n
INFO[2024-06-13T17:08:17.033] update cluster_static_file success
INFO[2024-06-13T17:08:17.111] update metadata success
INFO[2024-06-13T17:08:17.111] takeover success
During the takeover process, PTK will automatically handle some possible exceptions, but users still need to pay close attention to the operation process in order to find and solve possible problems in time. By properly using the commands of the takeover node, users can manage and expand the database cluster more flexibly to meet the needs of different scenarios.