Replication Conventions
FailoverBehavior
This convention tells the client how it should behave in a replicated environment when the primary node is unreachable and needs a failover to a secondary node or nodes.
Conventions.FailoverBehavior = FailoverBehavior.AllowReadsFromSecondaries;
In a cluster environment, this convention lets the client know how to behave when a request is made.
Conventions.FailoverBehavior = FailoverBehavior.ReadFromAllWriteToLeader;
You will find a detailed description here.
ReplicationInformerFactory
This convention determines replication behavior for the client. You can customize this to inject your own replication / failover logic by implementing IDocumentStoreReplicationInformer
.
Conventions.ReplicationInformerFactory = (url, jsonRequestFactory, requestTimeMetricGetter) =>
icationInformer(Conventions, jsonRequestFactory, requestTimeMetricGetter);
IndexAndTransformerReplicationMode
This convention allows you to change the replication mode for index and transformer definitions when they are created (or changed) by the client code (AbstractIndexCreationTask.Execute
/ AbstractTransformerCreationTask.Execute
). It is an enum type with [Flags]
attributes applied. The possible values are:
None
- Neither indexes nor transformers are updated to replicated instances.Indexes
- All created indexes are replicated.Transformers
- All transformers are replicated.
By default, both indexes and transformers are uploaded to the replication nodes:
Conventions.IndexAndTransformerReplicationMode = IndexAndTransformerReplicationMode.Indexes |
IndexAndTransformerReplicationMode.Transformers;