# Managing PCS Cluster

## **Pacemaker Enable or Disable Maintenance Mode or Freeze Cluster**

Managing a PCS cluster involves the coordination of a group of interconnected computers to work together as a Highly availability. It requires expertise in various areas, including hardware and software configuration, performance tuning, security, and troubleshooting. One of the main challenges of managing a PCS cluster is ensuring that all the nodes in the cluster work together seamlessly and efficiently. This can be achieved by implementing a reliable cluster management software, using automation tools to simplify management tasks, and regularly monitoring and maintaining the health of the cluster. With proper management, a PC cluster can provide organizations with a cost-effective way to tackle complex computing problems that require vast amounts of computational resources.

This write-up details the process of placing a Pacemaker cluster into maintenance mode or freezing the cluster and managing it .

## **Enable Maintenance Mode**

1 – Run the command to place the cluster into maintenance mode.

```bash
pcs property set maintenance-mode=true
```

2 – Next run the  command to verity that it displays `maintenance-mode: true` which means the cluster is in maintenance mode.

```bash
pcs property
```

Example Output :

```plaintext
Cluster Properties:
cluster-infrastructure: cman
dc-version: 1.1.15-5.el6-e174ec8
have-watchdog: false
last-lrm-refresh: 1527095308
maintenance-mode: true
no-quorum-policy: freeze
```

3 – Next run the  command and you will see an alert at the top of the status output showing the cluster is in maintenance mode.

```bash
pcs status --full
```

Example Output :

```plaintext
Cluster name: TEST_CLUSTER
Stack: cman
Current DC: server01-cpn (version 1.1.15-5.el6-e174ec8) - partition with quorum
Last updated: Fri Jun  1 09:25:24 2018          Last change: Fri Jun  1 09:20:51 2018 by root via cibadmin on server01-cpn
​              *** Resource management is DISABLED ***
  The cluster will not attempt to start, stop or recover services
2 nodes and 44 resources configured
```

*Disable Maintenance Mode*

1 – Run the  command to take the cluster out of maintenance mode.

```bash
pcs property set maintenance-mode=false
```

2 – Next run the  command to verity that it does not display `maintenance-mode: true` which means the cluster is not in maintenance mode.

```bash
pcs property
```

## **File and Directory Locations**

| **LOCATION** | **DESCRIPTION** |
| --- | --- |
| /var/lib/pacemaker/cib/cib.xml | Primary cluster configuration file |
| /var/log/cluster/corosync.log | Primary cluster log file |
| /usr/lib/ocf/resource.d/heartbeat/ | Directory where resource scripts are located |

## **Check Cluster Status**

| **COMMAND** | **DESCRIPTION** |
| --- | --- |
| pcs cluster status | Display status of cluster nodes |
| pcs status –full (double dashes) | Display detailed cluster status of nodes and resources |
| pcs resource | Display status of all resources and resource groups |

## **Modify Cluster Nodes**

| **COMMAND** | **DESCRIPTION** |
| --- | --- |
| pcs cluster standby | Place node in standby mode |
| pcs cluster unstandby | Remove node from standby mode |

## **Managing Running Resources**

| **COMMAND** | **DESCRIPTION** |
| --- | --- |
| pcs resource move \[resource\_name\] node name | Move resource to another node |
| pcs resource restart \[resource\_name\] | Restart resource on current node |
| pcs resource enable \[resource\_name\] | Start resource on current node |
| pcs resource disable \[resource\_name\] | Stop resource on current node |

## **Debugging Resources**

| **COMMAND** | **DESCRIPTION** |
| --- | --- |
| pcs resource debug-start \[source\_name\] | Force resource to start on node where command is executed showing debug information. Use --full for even more verbose output. |
| pcs resource debug-stop \[source\_name\] | Force resource to stop on node where command is executed showing debug information. Use --full for even more verbose output. |
| pcs resource debug-monitor \[source\_name\] | Force resource to be monitored on node where command is executed showing debug information. Use --full for even more verbose output. |

## **Creating and Modifying Resources**

| **COMMAND** | **DESCRIPTION** |
| --- | --- |
| pcs resource agents | List available resource agents |
| pcs resource describe \[resource\] | List configuration setting for resource |
| pcs resource create \[resource id\]\[resource\] options… | Create resource |
| pcs resource show \[resource id\] | Display currently configured setting of resource |
| pcs resource update \[resource id\] options…. | Update resource configuration |
| pcs resource delete \[resource id\] | Delete resource |
| pcs resource cleanup \[resource id\] | Cleanup resource failures |

## **Creating and Modifying Stonith Resources**

| **COMMAND** | **DESCRIPTION** |
| --- | --- |
| pcs stonith list | List available fence agents |
| pcs stonith describe \[fence agent\] | List configuration settings for fence agent |
| pcs stonith describe \[stonith\_id\] | List configuration setting for stonith agent |
| pcs stonith create \[stonith\_id\]\[resource\] options… | Create stonith agent |
| pcs stonith show \[stonith\_id\] | Display currently configured setting of stonith agent |
| pcs stonith update \[stonith\_id\] options…. | Update stonith configuration |
| pcs stonith delete \[stonith\_id\] | Delete stonith agent |
| pcs stonith cleanup \[stonith\_id\] | Cleanup stonith agent failures |
