A method for processing a failure in at least one distributed cluster, wherein the at least one distributed cluster comprises a first distributed cluster, the first distributed cluster comprises a first Master node and a first Slave node, the first distributed cluster further comprises a first reference node and a first secondary node that serves as a backup of the first Master node, and the method comprises: receiving, by the first secondary node, a heartbeat message sent by the first reference node, wherein the heartbeat message comprises first indication information that is used to indicate that the first reference node is disconnected from the first Master node; determining, by the first secondary node according to the first indication information, that the first reference node is disconnected from the first Master node; detecting, by the first secondary node, whether a heartbeat message sent by the first Master node to the first secondary node is interrupted; when it is detected that the heartbeat message sent by the first Master node to the first secondary node is interrupted, determining, by the first secondary node, that the first secondary node is also disconnected from the first Master node; and determining, by the first secondary node, that the first Master node that is disconnected from both the first secondary node and the first reference node is faulty; characterized in that when it is determined that the first Master node is faulty, the method further comprises: sending, by the first secondary node, a broadcast message to all nodes in the first distributed cluster, wherein the broadcast message is used to indicate that the first secondary node is upgraded to a new first Master node, wherein the detecting, by the first secondary node, whether a heartbeat message sent by the first Master node to the first secondary node is interrupted comprises: detecting, by the first secondary node, whether a heartbeat message sent by the first Master node is received between a first moment and a second moment, wherein the first moment is a moment at which the first secondary node receives the heartbeat message that is sent by the first reference node and that comprises the first indication information, the second moment is earlier than the first moment, and a time interval between the first moment and the second moment is N times a heartbeat period of sending a heartbeat message by the first Master node to the first secondary node, wherein N is a positive integer. receiving, by the first secondary node, a heartbeat message sent by the first reference node, wherein the heartbeat message comprises first indication information that is used to indicate that the first reference node is disconnected from the first Master node; determining, by the first secondary node according to the first indication information, that the first reference node is disconnected from the first Master node; detecting, by the first secondary node, whether a heartbeat message sent by the first Master node to the first secondary node is interrupted; when it is detected that the heartbeat message sent by the first Master node to the first secondary node is interrupted, determining, by the first secondary node, that the first secondary node is also disconnected from the first Master node; and determining, by the first secondary node, that the first Master node that is disconnected from both the first secondary node and the first reference node is faulty; characterized in that when it is determined that the first Master node is faulty, the method further comprises: sending, by the first secondary node, a broadcast message to all nodes in the first distributed cluster, wherein the broadcast message is used to indicate that the first secondary node is upgraded to a new first Master node, wherein the detecting, by the first secondary node, whether a heartbeat message sent by the first Master node to the first secondary node is interrupted comprises: detecting, by the first secondary node, whether a heartbeat message sent by the first Master node is received between a first moment and a second moment, wherein the first moment is a moment at which the first secondary node receives the heartbeat message that is sent by the first reference node and that comprises the first indication information, the second moment is earlier than the first moment, and a time interval between the first moment and the second moment is N times a heartbeat period of sending a heartbeat message by the first Master node to the first secondary node, wherein N is a positive integer.