Enabling/disabling NATS clustering without losing Jetstream data #822
Replies: 3 comments
-
This is fundamentally how
True, the level of replication must be chosen on a per-stream (and even per-consumer) basis. Consumers will default to the same number of replicas as their Stream if no Consumer replicas are specified. But there may be cases where you want to trade of availability for speed. Any multi-replica stream forms a RAFT group and will perform slower than a single-replica stream. So Replicas are editable on a per-stream (and per-consumer) basis for this reason. It is common for teams to centralize the configuration of Streams with tools like NACK or terraform-provider-jetstream to ensure that settings such as replication can be configured in a repeatable manner. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your quick reply!
So the data loss when changing standalone to cluster mode is only related to the server information that is stored? Couldn't the stream data itself stay persisted (perhaps as a future feature)? Right now, it seems all the data is just wiped.
It is sometimes hard to foresee whether clustering mode will be required at some point. It seems a waste of resources if one runs a cluster of 3 just to be able to potentially use clustering without some manual data backup.
Not sure if I got this right. Why would a consumer care about the number of replicas? I would expect that the availability increases if there are more stream replicas but the write speed, i.e. producer speed, decreases. Why is the "read speed" by consumers affected?
Thank you for this pointer! |
Beta Was this translation helpful? Give feedback.
-
Because the 'state' of the consumers is persisted on the nats server itself - so the # of replicas for a consumer is the # of replicas the read state is replicated to. Kafka for eg makes the consumers read state the consumers problem to deal with. |
Beta Was this translation helpful? Give feedback.
-
Hey all,
We have NATS running in non-clustering mode in our Kubernetes cluster and use its Jetstream feature to persist events. I am currently investigating the clustering mode NATS offers and have a few questions:
In general, it would be great to be flexible with how many nats replicas one runs and have Jetstream being able to automatically adjust to it.
Best,
Simon
Beta Was this translation helpful? Give feedback.
All reactions