How to use the command pvecm (with examples)
The pvecm
command, also known as the Proxmox VE Cluster Manager, is a tool used for managing a Proxmox VE cluster. It allows users to add or remove nodes from a cluster, generate new cluster configurations, and display information about the cluster status.
Use case 1: Adding the current node to an existing cluster
Code:
pvecm add hostname_or_ip
Motivation: The pvecm add
command is used to add the current node to an existing Proxmox VE cluster. This is useful when setting up a new node that needs to join an existing cluster.
Explanation: The hostname_or_ip
argument should be replaced with the hostname or IP address of the node that you want to add to the cluster. This command will initiate the process of adding the specified node to the cluster.
Example output:
Node 'hostname_or_ip' added
Use case 2: Adding a node to the cluster configuration (internal use)
Code:
pvecm addnode node
Motivation: The pvecm addnode
command is used by Proxmox VE internally to add a node to the cluster configuration. This command is not typically used by users directly.
Explanation: The node
argument should be replaced with the name of the node that you want to add to the cluster configuration. This command will update the cluster configuration to include the specified node.
Example output:
Node 'node' added to cluster configuration
Use case 3: Returning the version of the cluster join API available on this node
Code:
pvecm apiver
Motivation: The pvecm apiver
command is used to determine the version of the cluster join API available on the current node. This can be useful for troubleshooting or compatibility purposes.
Explanation: This command does not require any arguments. It will return the version of the cluster join API available on the current node.
Example output:
2
Use case 4: Generating a new cluster configuration
Code:
pvecm create clustername
Motivation: The pvecm create
command is used to generate a new cluster configuration. This is useful when setting up a new Proxmox VE cluster.
Explanation: The clustername
argument should be replaced with the desired name for the new cluster. This command will generate a new cluster configuration with the specified name.
Example output:
Cluster configuration 'clustername' created
Use case 5: Removing a node from the cluster configuration
Code:
pvecm delnode node
Motivation: The pvecm delnode
command is used to remove a node from the cluster configuration. This can be useful when decommissioning a node or reconfiguring the cluster.
Explanation: The node
argument should be replaced with the name of the node that you want to remove from the cluster configuration. This command will update the cluster configuration to exclude the specified node.
Example output:
Node 'node' removed from cluster configuration
Use case 6: Displaying the local view of the cluster nodes
Code:
pvecm nodes
Motivation: The pvecm nodes
command is used to display the local view of the cluster nodes. This provides information about the nodes currently connected to the cluster.
Explanation: This command does not require any arguments. It will display a list of the cluster nodes, including their names and status.
Example output:
Node 1: hostname1 (online)
Node 2: hostname2 (offline)
Use case 7: Displaying the local view of the cluster status
Code:
pvecm status
Motivation: The pvecm status
command is used to display the local view of the cluster status. This provides information about the current state of the cluster.
Explanation: This command does not require any arguments. It will display information about the cluster, including the number of nodes, quorum status, and cluster generation.
Example output:
Cluster nodes: 2
Quorum: Yes
Generation: 4
Conclusion:
The pvecm
command is a powerful tool for managing a Proxmox VE cluster. It allows users to add or remove nodes from a cluster, generate new cluster configurations, and display important information about the cluster status. By understanding the various use cases of the command, users can effectively manage their Proxmox VE clusters.