Cluster management
This document mainly introduces the management tools of TuGraph HA cluster, including the functions of deleting nodes, leader transfer and generating snapshots.
1 Introduction
After the HA cluster is started, you can use the lgraph_peer
tool for cluster management, which can perform functions such as deleting nodes, transferring leaders, and generating snapshots.
2. Delete node
For nodes in the TuGraph HA cluster that are offline for a long time or have network partitions, you can use the remove_peer
command of lgraph_peer
to delete the node. An example command is as follows:
$ lgraph_peer --command remove_peer --peer {peer_id} --conf {group_conf}
in:
--command remove_peer
specifies that the operation to be performed is remove_peer, that is, delete the node.--peer {peer_id}
specifies the rpc network address of the node to be deleted, such as127.0.0.1:9092
.--conf {group_conf}
specifies the member configuration of the HA cluster (as long as it can be connected to the master node), such as127.0.0.1:9092,127.0.0.1:9093,127.0.0.1:9094
.
3. leader transfer
When you need to shut down or restart the master node, in order to reduce the unserviceable time of the cluster, you can use the transfer_leader
command of lgraph_peer
to transfer the master node. An example command is as follows:
$ lgraph_peer --command transfer_leader --peer {peer_id} --conf {group_conf}
in:
--command transfer_leader
specifies that the operation to be performed is transfer_leader, that is, transferring the master node.--peer {peer_id}
specifies the rpc network address to become the master node, such as127.0.0.1:9092
.--conf {group_conf}
specifies the member configuration of the HA cluster (as long as it can be connected to the master node), such as127.0.0.1:9092,127.0.0.1:9093,127.0.0.1:9094
.
4. Generate snapshot
For reasons such as setting ha_snapshot_interval_s to -1 when the node starts so that snapshots are not taken by default or other reasons,
when you need to tell a node generate a snapshot, you can use the snapshot
command of lgraph_peer
. An example command is as follows:
$ lgraph_peer --command snapshot --peer {peer_id}
in:
--command snapshot
specifies that the operation to be performed is snapshot, that is, generating a snapshot.--peer {peer_id}
specifies the rpc network address of the node to generate a snapshot, such as127.0.0.1:9092
.