Represents the input of a TestFailover operation which tests automatic failover on a specified node group (called shard in the console) in a replication group (called cluster in the console).
This API is designed for testing the behavior of your application in case of ElastiCache failover. It is not designed to be an operational tool for initiating a failover to overcome a problem you may have with the cluster. Moreover, in certain conditions such as large-scale operational events, Amazon may block this API.
Note the following
-
A customer can use this operation to test automatic failover on up to 15 shards (called node groups in the ElastiCache API and Amazon CLI) in any rolling 24-hour period.
-
If calling this operation on shards in different clusters (called replication groups in the API and CLI), the calls can be made concurrently.
-
If calling this operation multiple times on different shards in the same Valkey or Redis OSS (cluster mode enabled) replication group, the first node replacement must complete before a subsequent call can be made.
-
To determine whether the node replacement is complete you can check Events using the Amazon ElastiCache console, the Amazon CLI, or the ElastiCache API. Look for the following automatic failover related events, listed here in order of occurrance:
-
Replication group message: Test Failover API called for node group
-
Cache cluster message: Failover from primary node to replica node completed
-
Replication group message: Failover from primary node to replica node completed
-
Cache cluster message: Recovering cache nodes
-
Cache cluster message: Finished recovery for cache nodes
For more information see:
Also see, Testing Multi-AZ in the ElastiCache User Guide.
Parameters:
-
replication_group_id
(Optional[String], default:
None
)
–
The name of the replication group (console: cluster) whose automatic failover is being tested by this operation.
-
node_group_id
(Optional[AllowedNodeGroupId], default:
None
)
–
The name of the node group (called shard in the console) in this replication group on which automatic failover is to be tested. You may test automatic failover on up to 15 node groups in any rolling 24-hour period.
Raises:
Source code in docs_src/capo_elasticache/_services/elasti_cache.py
| def test_failover(
self,
*,
config_overrides: Optional[ElastiCacheClientConfig] = None,
replication_group_id: Optional["capo_elasticache.types.string.String"] = None,
node_group_id: Optional[
"capo_elasticache.types.allowed_node_group_id.AllowedNodeGroupId"
] = None,
) -> "capo_elasticache.types.test_failover_result.TestFailoverResult":
"""<p>Represents the input of a <code>TestFailover</code> operation which tests automatic failover on a specified node group (called shard in the console) in a replication group (called cluster in the console).</p> <p>This API is designed for testing the behavior of your application in case of ElastiCache failover. It is not designed to be an operational tool for initiating a failover to overcome a problem you may have with the cluster. Moreover, in certain conditions such as large-scale operational events, Amazon may block this API. </p> <p class="title"> <b>Note the following</b> </p> <ul> <li> <p>A customer can use this operation to test automatic failover on up to 15 shards (called node groups in the ElastiCache API and Amazon CLI) in any rolling 24-hour period.</p> </li> <li> <p>If calling this operation on shards in different clusters (called replication groups in the API and CLI), the calls can be made concurrently.</p> <p> </p> </li> <li> <p>If calling this operation multiple times on different shards in the same Valkey or Redis OSS (cluster mode enabled) replication group, the first node replacement must complete before a subsequent call can be made.</p> </li> <li> <p>To determine whether the node replacement is complete you can check Events using the Amazon ElastiCache console, the Amazon CLI, or the ElastiCache API. Look for the following automatic failover related events, listed here in order of occurrance:</p> <ol> <li> <p>Replication group message: <code>Test Failover API called for node group <node-group-id></code> </p> </li> <li> <p>Cache cluster message: <code>Failover from primary node <primary-node-id> to replica node <node-id> completed</code> </p> </li> <li> <p>Replication group message: <code>Failover from primary node <primary-node-id> to replica node <node-id> completed</code> </p> </li> <li> <p>Cache cluster message: <code>Recovering cache nodes <node-id></code> </p> </li> <li> <p>Cache cluster message: <code>Finished recovery for cache nodes <node-id></code> </p> </li> </ol> <p>For more information see:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/ECEvents.Viewing.html">Viewing ElastiCache Events</a> in the <i>ElastiCache User Guide</i> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeEvents.html">DescribeEvents</a> in the ElastiCache API Reference</p> </li> </ul> </li> </ul> <p>Also see, <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/AutoFailover.html#auto-failover-test">Testing Multi-AZ </a> in the <i>ElastiCache User Guide</i>.</p>
Args:
replication_group_id: <p>The name of the replication group (console: cluster) whose automatic failover is being tested by this operation.</p>
node_group_id: <p>The name of the node group (called shard in the console) in this replication group on which automatic failover is to be tested. You may test automatic failover on up to 15 node groups in any rolling 24-hour period.</p>
Raises:
capo_elasticache.errors.api_call_rate_for_customer_exceeded_fault.APICallRateForCustomerExceededFault: <p>The customer has exceeded the allowed rate of API calls.</p>
capo_elasticache.errors.invalid_cache_cluster_state_fault.InvalidCacheClusterStateFault: <p>The requested cluster is not in the <code>available</code> state.</p>
capo_elasticache.errors.invalid_kms_key_fault.InvalidKMSKeyFault: <p>The KMS key supplied is not valid.</p>
capo_elasticache.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>Two or more incompatible parameters were specified.</p>
capo_elasticache.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value for a parameter is invalid.</p>
capo_elasticache.errors.invalid_replication_group_state_fault.InvalidReplicationGroupStateFault: <p>The requested replication group is not in the <code>available</code> state.</p>
capo_elasticache.errors.node_group_not_found_fault.NodeGroupNotFoundFault: <p>The node group specified by the <code>NodeGroupId</code> parameter could not be found. Please verify that the node group exists and that you spelled the <code>NodeGroupId</code> value correctly.</p>
capo_elasticache.errors.replication_group_not_found_fault.ReplicationGroupNotFoundFault: <p>The specified replication group does not exist.</p>
capo_elasticache.errors.test_failover_not_available_fault.TestFailoverNotAvailableFault: <p>The <code>TestFailover</code> action is not available.</p>
capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_elasticache.types.test_failover_message.TestFailoverMessage]",
) -> OperationResponse[
"capo_elasticache.types.test_failover_result.TestFailoverResult"
]:
import capo_elasticache._operations.amazon_elasti_cache_v9.test_failover
output, http_response = (
capo_elasticache._operations.amazon_elasti_cache_v9.test_failover.test_failover(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("TestFailover")
)
input_: capo_elasticache.types.test_failover_message.TestFailoverMessage = {}
if replication_group_id is not None:
input_["replication_group_id"] = replication_group_id
if node_group_id is not None:
input_["node_group_id"] = node_group_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|