HomeMogDBMogDB StackUqbar
v2.0

Documentation:v2.0

Supported Versions:

Other Versions:

Scale-in Cluster

Through a series of operations, reduce database nodes in the original cluster.

Purpose

PTK provides users with the function of cluster scale-in to meet their needs for business, cost, resource allocation, risk and other factors.

Scale-in Command

ptk cluster -n <CLUSTER_NAME> scale-in [-H|--host HOST] [-i|--id ID] [--skip-clear-user] [--skip-clear-db] [--force]

Sample Topology Before And After Scale-in

  • One primary N standby and M cascade

The original cluster topology is as follows:

         standby1 -- cascade_standby1, cascade_standby2
        /
primary
        \
         standby2 -- cascade_standby3

After deleting standy2 with the scale-in command, the structure changes to:

         standby1 -- cascade_standby1, cascade_standby2
        /         \
primary            \
                    \
         standby2    cascade_standby3

At this point, standby2 is not in the cluster, and the upstream of the downstream node of standby2 is changed to standby1.

PTK implementation: If the target node role is standby, if the node has downstream nodes and there are other standby nodes, then all the downstream nodes of the node to be scaled-in will point to the rest of the standby nodes in the upstream.

  • One primary one standby and one cascade

The original cluster topology is as follows:

primary -- standby -- cascade_standby

After deleting standy with the scale-in command, the structure changes to:

primary  standby  cascade_standby

At this point the 3 nodes are directly unrelated and are all independent.

QA

Can I scale-out a cluster?

Yes. Please refer to Cluster Scale-out.

Can a cluster be scaled out to empty by performing a scale-out all the time?

No, you cannot. After a scale-out, the cluster will have at least one available data node.

To get an empty cluster, see Create Empty Cluster, or refer to Throwout Node.

Can I directly scale-in the primary node?

No. There will be at least one node surviving after scaling-in, and that node will be the primary node.

What should I do if I want to scale-in the node where the primary node is located?

Consider using the following steps:

  1. Use the switchover command to switch primary and standby nodes.
  2. Scale-in the node on which the primary node used to reside (the node where the standby node now resides).

Can I scale-in a cluster with CM? If yes, is there a restriction?

Yes.

Restrictions: The database nodes of the scaled-in cluster should be at least 2 nodes, and the CM nodes should be at least 2 nodes, because the arbitration mechanism of CM needs to guarantee at least 2 nodes. ADDITIONAL: When scaling-in a cluster with CM, PTK will scale-in the database node and CM node on the target node.

What does --skip-clear-db do? When should it be used?

Usage: When scaling-in a target node, PTK by default kills the database processes on that node, clears the database related files, and rewrites the replication stream information in the postgresql.conf file for the remaining nodes. The purpose of --skip-clear-db is to skip the step of clearing database related files. When to use: When you want to keep information about the data node.

What does --skip-clear-user do? When should it be used?

Usage: When PTK scales-in a target node, it normally removes the database user under that node.

When to use: When you don't want to delete database user on the target node.

What does --force do? When should it be used?

Usage: There may be situations where the node to be scaled-in cannot be linked properly due to special reasons, and some of the checks performed during the scaling-in process cannot be passed, resulting in an error being thrown if the node cannot be scaled-in. The role of --force is to skip these checks. When to use it: Continue to perform scale-in tasks when some nodes cannot be linked.

If CM is currently deployed in the cluster and VIPs are configured, will scale-in affect VIPs?

No. PTK refreshes CM-VIP after scale-in for clusters that have VIPs configured to ensure that the basic CM-VIP information is correct.

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