HomeMogDBMogDB StackUqbar
v2.0

Documentation:v2.0

Supported Versions:

Other Versions:

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.

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