HomeMogDBMogDB StackUqbar
v2.0

Documentation:v2.0

Supported Versions:

Other Versions:

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.

Copyright © 2011-2024 www.enmotech.com All rights reserved.