Skip to content

The Replica Node has SetTypeCmds record

0

When I tested using the primary-replica setup, I noticed that the SetTypeCmds metric on the replica node also had values.

As I understand it, the replica should only handle read operations and not perform any write operations.

Is this because the replica is executing write commands during the replication process from the primary node?

asked a year ago236 views

2 Answers
0

Yes, you're correct in your understanding. In MemoryDB, replica nodes are designed to handle read operations only, while primary nodes handle both read and write operations.

The SetTypeCmds metric that you're seeing on the replica node doesn't indicate that the replica is accepting write commands directly from clients. Instead, it reflects the write commands that the replica is executing as part of the replication process from the primary node.

When write operations are performed on the primary node, these changes need to be propagated to all replica nodes to maintain data consistency. The replica nodes execute these same commands to ensure their data matches the primary. This is part of the replication mechanism that ensures eventual consistency between the primary and replica nodes.

In MemoryDB, successful write operations take effect on each replica in the same order they were executed on the primary. The replication lag (how far behind a replica is in applying changes from the primary) is measured in seconds and is available as the ReplicationLag metric in CloudWatch.
Sources
Consistency - Amazon MemoryDB for Redis

answered a year ago

  • Not MemoryDB, is ElastiCache for Redis

0

In regards to ElastiCache for Redis,

Yes, that's correct! The SetTypeCmds metric appearing on the replica node is due to the replication process, not from direct client write operations.

Here's a detailed explanation:

1. Replication Process:

  • When the primary node performs write operations, these changes need to be synchronized to the replica nodes
  • The primary node sends these write commands to the replicas
  • The replica nodes execute these commands to maintain data consistency
  • This execution of write commands during replication is what gets recorded in the SetTypeCmds metric

2. Important Points:

  • Clients cannot directly write to replica nodes
  • Only the primary node accepts write operations from clients
  • The SetTypeCmds on replicas are from internal replication, not client operations
  • This behavior is normal and expected

3. CloudWatch Metrics:

SetTypeCmds = Number of set operations

  • Primary node: Shows both client writes and replication
  • Replica nodes: Shows only replication-related writes

4. Example Flow:

Client → Primary Node (write operation)
↓
Primary Node executes write → SetTypeCmds++
↓
Primary Node replicates to Replica
↓
Replica executes replication → SetTypeCmds++

So seeing SetTypeCmds on replica nodes is completely normal and is part of Redis's replication mechanism to maintain data consistency across the cluster.

AWS
SUPPORT ENGINEER

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.