failover_db_cluster
async
¶
failover_db_cluster(
*,
config_overrides: Optional[AsyncRDSClientConfig] = None,
db_cluster_identifier: Optional[String] = None,
target_db_instance_identifier: Optional[String] = None,
) -> FailoverDBClusterResult
Forces a failover for a DB cluster.
For an Aurora DB cluster, failover for a DB cluster promotes one of the Aurora Replicas (read-only instances) in the DB cluster to be the primary DB instance (the cluster writer).
For a Multi-AZ DB cluster, after RDS terminates the primary DB instance, the internal monitoring system detects that the primary DB instance is unhealthy and promotes a readable standby (read-only instances) in the DB cluster to be the primary DB instance (the cluster writer). Failover times are typically less than 35 seconds.
An Amazon Aurora DB cluster automatically fails over to an Aurora Replica, if one exists, when the primary DB instance fails. A Multi-AZ DB cluster automatically fails over to a readable standby DB instance when the primary DB instance fails.
To simulate a failure of a primary instance for testing, you can force a failover. Because each instance in a DB cluster has its own endpoint address, make sure to clean up and re-establish any existing connections that use those endpoint addresses when the failover is complete.
For more information on Amazon Aurora DB clusters, see What is Amazon Aurora? in the Amazon Aurora User Guide.
For more information on Multi-AZ DB clusters, see Multi-AZ DB cluster deployments in the Amazon RDS User Guide.
Parameters:
-
db_cluster_identifier(Optional[String], default:None) –The identifier of the DB cluster to force a failover for. This parameter isn't case-sensitive.
Constraints:
-
Must match the identifier of an existing DB cluster.
-
-
target_db_instance_identifier(Optional[String], default:None) –The name of the DB instance to promote to the primary DB instance.
Specify the DB instance identifier for an Aurora Replica or a Multi-AZ readable standby in the DB cluster, for example
mydbcluster-replica1.This setting isn't supported for RDS for MySQL Multi-AZ DB clusters.
Raises:
-
DBClusterNotFoundFault–DBClusterIdentifierdoesn't refer to an existing DB cluster. -
InvalidDBClusterStateFault–The requested operation can't be performed while the cluster is in this state.
-
InvalidDBInstanceStateFault–The DB instance isn't in a valid state.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To perform a failover for a DB cluster This example performs a failover for the specified DB cluster to the specified DB instance.
>>> await client.failover_db_cluster(db_cluster_identifier='myaurorainstance-cluster', target_db_instance_identifier='myaurorareplica')
Source code in docs_src/capo_rds/_services/async_rds.py
10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 | |