decreaseReplicaCount method
Dynamically decreases the number of replicas in a Valkey or Redis OSS (cluster mode disabled) replication group or the number of replica nodes in one or more node groups (shards) of a Valkey or Redis OSS (cluster mode enabled) replication group. This operation is performed with no cluster down time.
May throw ClusterQuotaForCustomerExceededFault.
May throw InsufficientCacheClusterCapacityFault.
May throw InvalidCacheClusterStateFault.
May throw InvalidParameterCombinationException.
May throw InvalidParameterValueException.
May throw InvalidReplicationGroupStateFault.
May throw InvalidVPCNetworkStateFault.
May throw NodeGroupsPerReplicationGroupQuotaExceededFault.
May throw NodeQuotaForCustomerExceededFault.
May throw NoOperationFault.
May throw ReplicationGroupNotFoundFault.
May throw ServiceLinkedRoleNotFoundFault.
Parameter applyImmediately :
If True, the number of replica nodes is decreased
immediately. ApplyImmediately=False is not currently
supported.
Parameter replicationGroupId :
The id of the replication group from which you want to remove replica
nodes.
Parameter newReplicaCount :
The number of read replica nodes you want at the completion of this
operation. For Valkey or Redis OSS (cluster mode disabled) replication
groups, this is the number of replica nodes in the replication group. For
Valkey or Redis OSS (cluster mode enabled) replication groups, this is the
number of replica nodes in each of the replication group's node groups.
The minimum number of replicas in a shard or replication group is:
-
Valkey or Redis OSS (cluster mode disabled)
- If Multi-AZ is enabled: 1
- If Multi-AZ is not enabled: 0
- Valkey or Redis OSS (cluster mode enabled): 0 (though you will not be able to failover to a replica if your primary node fails)
Parameter replicaConfiguration :
A list of ConfigureShard objects that can be used to
configure each shard in a Valkey or Redis OSS replication group. The
ConfigureShard has three members:
NewReplicaCount, NodeGroupId, and
PreferredAvailabilityZones.
Parameter replicasToRemove :
A list of the node ids to remove from the replication group or node group
(shard).
Implementation
Future<DecreaseReplicaCountResult> decreaseReplicaCount({
required bool applyImmediately,
required String replicationGroupId,
int? newReplicaCount,
List<ConfigureShard>? replicaConfiguration,
List<String>? replicasToRemove,
}) async {
final $request = <String, String>{
'ApplyImmediately': applyImmediately.toString(),
'ReplicationGroupId': replicationGroupId,
if (newReplicaCount != null)
'NewReplicaCount': newReplicaCount.toString(),
if (replicaConfiguration != null)
if (replicaConfiguration.isEmpty)
'ReplicaConfiguration': ''
else
for (var i1 = 0; i1 < replicaConfiguration.length; i1++)
for (var e3 in replicaConfiguration[i1].toQueryMap().entries)
'ReplicaConfiguration.ConfigureShard.${i1 + 1}.${e3.key}':
e3.value,
if (replicasToRemove != null)
if (replicasToRemove.isEmpty)
'ReplicasToRemove': ''
else
for (var i1 = 0; i1 < replicasToRemove.length; i1++)
'ReplicasToRemove.member.${i1 + 1}': replicasToRemove[i1],
};
final $result = await _protocol.send(
$request,
action: 'DecreaseReplicaCount',
version: '2015-02-02',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
resultWrapper: 'DecreaseReplicaCountResult',
);
return DecreaseReplicaCountResult.fromXml($result);
}