Negative Affinity can be enabled with both Read and Write affinity but has the opposite affect, namely ensuring Reads or Writes do NOT get routed to a specific service.
This feature can be configured in exactly the same way, just with the addition of - in front of the
service name. Below is an examples using east
and west
as
the example service names.
Allow writes to east but not west, allow reads from both, with preference to east:
affinity=east,-west:east
A typical use case for this feature would be when you want the flexibility of a Composite Active/Active topology but do not want writes into both clusters. This can be useful when you are unable to avoid potential write conflicts.