| 1 | ### Understand the alert |
| 2 | |
| 3 | This alert indicates that your VerneMQ cluster has experienced a netsplit (split-brain) situation within the last minute. This can lead to inconsistencies in the cluster, and you need to troubleshoot the problem to maintain proper cluster operation. |
| 4 | |
| 5 | ### What is a netsplit? |
| 6 | |
| 7 | In distributed systems, a netsplit occurs when a cluster of nodes loses connectivity to one or more nodes due to a network failure, leaving the cluster to operate in a degraded state. In the context of VerneMQ, a netsplit can lead to inconsistencies in the subscription data and retained messages. |
| 8 | |
| 9 | ### Troubleshoot the alert |
| 10 | |
| 11 | - Confirm the alert issue |
| 12 | |
| 13 | Review the VerneMQ logs to check for any signs of network partitioning or netsplits. |
| 14 | |
| 15 | - Check connectivity between nodes |
| 16 | |
| 17 | Ensure that the network connectivity between your cluster nodes is restored. You can use tools like `ping` and `traceroute` to verify network connectivity. |
| 18 | |
| 19 | - Inspect node status |
| 20 | |
| 21 | Use the `vmq-admin cluster show` command to inspect the current status of the nodes in the VerneMQ cluster, and check for any disconnected nodes: |
| 22 | |
| 23 | ``` |
| 24 | vmq-admin cluster show |
| 25 | ``` |
| 26 | |
| 27 | - Reestablish connections and heal partitions |
| 28 | |
| 29 | If a node is disconnected, reconnect it using the `vmq-admin cluster join` command: |
| 30 | |
| 31 | ``` |
| 32 | vmq-admin cluster join discovery-node=IP_ADDRESS_OF_ANOTHER_NODE |
| 33 | ``` |
| 34 | |
| 35 | As soon as the partition is healed, and connectivity is reestablished, the VerneMQ nodes will replicate the latest changes made to the subscription data. |
| 36 | |
| 37 | - Ensure node connectivity remains active |
| 38 | |
| 39 | Monitor the cluster and network to maintain consistent connectivity between the nodes. Set up monitoring tools and consider using an auto-healing or auto-scaling framework to help maintain node connectivity. |
| 40 | |
| 41 | ### Useful resources |
| 42 | |
| 43 | 1. [VerneMQ Clustering Guide: Netsplits](https://docs.vernemq.com/v/master/vernemq-clustering/netsplits) |
| 44 | 2. [VerneMQ Documentation](https://docs.vernemq.com/) |