diff --git a/docs/client-api/configuration/load-balance/content/_read-balance-behavior-csharp.mdx b/docs/client-api/configuration/load-balance/content/_read-balance-behavior-csharp.mdx
index d740865fb1..c85fc19787 100644
--- a/docs/client-api/configuration/load-balance/content/_read-balance-behavior-csharp.mdx
+++ b/docs/client-api/configuration/load-balance/content/_read-balance-behavior-csharp.mdx
@@ -31,7 +31,7 @@ import CodeBlock from '@theme/CodeBlock';
No read balancing will occur.
The client will always send _Read_ requests to the [preferred node](../../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node).
* **Failover**
- The client will failover nodes in the order they appear in the [topology nodes list](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
+ The client will fail over to the nodes in the order of the [topology list](../../../../studio/database/settings/manage-database-group.mdx#the-database-group-view).
### `RoundRobin`
* **Read-balance**
diff --git a/docs/client-api/configuration/load-balance/content/_read-balance-behavior-nodejs.mdx b/docs/client-api/configuration/load-balance/content/_read-balance-behavior-nodejs.mdx
index b7d516cc38..c786ce392e 100644
--- a/docs/client-api/configuration/load-balance/content/_read-balance-behavior-nodejs.mdx
+++ b/docs/client-api/configuration/load-balance/content/_read-balance-behavior-nodejs.mdx
@@ -31,7 +31,7 @@ import CodeBlock from '@theme/CodeBlock';
No read balancing will occur.
The client will always send _Read_ requests to the [preferred node](../../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node).
* **Failover**
- The client will failover nodes in the order they appear in the [topology nodes list](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
+ The client will fail over to the nodes in the order of the [topology list](../../../../studio/database/settings/manage-database-group.mdx#the-database-group-view).
### `RoundRobin`
* **Read-balance**
diff --git a/docs/client-api/configuration/load-balance/content/_read-balance-behavior-php.mdx b/docs/client-api/configuration/load-balance/content/_read-balance-behavior-php.mdx
index 67dfe4cc31..4fa636b7a3 100644
--- a/docs/client-api/configuration/load-balance/content/_read-balance-behavior-php.mdx
+++ b/docs/client-api/configuration/load-balance/content/_read-balance-behavior-php.mdx
@@ -31,7 +31,7 @@ import CodeBlock from '@theme/CodeBlock';
No read balancing will occur.
The client will always send _Read_ requests to the [preferred node](../../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node).
* **Failover**
- The client will failover nodes in the order they appear in the [topology nodes list](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
+ The client will fail over to the nodes in the order of the [topology list](../../../../studio/database/settings/manage-database-group.mdx#the-database-group-view).
### `RoundRobin`
* **Read-balance**
diff --git a/docs/client-api/configuration/load-balance/content/_read-balance-behavior-python.mdx b/docs/client-api/configuration/load-balance/content/_read-balance-behavior-python.mdx
index 51148c9204..89a2763815 100644
--- a/docs/client-api/configuration/load-balance/content/_read-balance-behavior-python.mdx
+++ b/docs/client-api/configuration/load-balance/content/_read-balance-behavior-python.mdx
@@ -31,7 +31,7 @@ import CodeBlock from '@theme/CodeBlock';
No read balancing will occur.
The client will always send _Read_ requests to the [preferred node](../../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node).
* **Failover**
- The client will failover nodes in the order they appear in the [topology nodes list](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
+ The client will fail over to the nodes in the order of the [topology list](../../../../studio/database/settings/manage-database-group.mdx#the-database-group-view).
### `RoundRobin`
* **Read-balance**
diff --git a/docs/client-api/configuration/load-balance/load-balance-behavior.mdx b/docs/client-api/configuration/load-balance/load-balance-behavior.mdx
index a579d803a9..2aa7f49fe9 100644
--- a/docs/client-api/configuration/load-balance/load-balance-behavior.mdx
+++ b/docs/client-api/configuration/load-balance/load-balance-behavior.mdx
@@ -33,8 +33,8 @@ see_also:
link: "studio/database/settings/client-configuration-per-database"
source: "docs"
path: "Studio > Database Management > Settings"
- - title: "Database-group-topology"
- link: "studio/database/settings/manage-database-group#database-group-topology---view"
+ - title: "Manage Database Group"
+ link: "studio/database/settings/manage-database-group#the-database-group-view"
source: "docs"
path: "Studio > Database Management > Settings"
---
diff --git a/docs/client-api/configuration/load-balance/overview.mdx b/docs/client-api/configuration/load-balance/overview.mdx
index 9053bfb06d..0253aee855 100644
--- a/docs/client-api/configuration/load-balance/overview.mdx
+++ b/docs/client-api/configuration/load-balance/overview.mdx
@@ -6,11 +6,7 @@ sidebar_position: 0
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
# Load balancing client requests - Overview
@@ -18,89 +14,98 @@ import LanguageContent from "@site/src/components/LanguageContent";
* A database can have multiple instances, each one residing on a different cluster node.
Each instance is a complete replica of the database.
-* The [database-group-topology](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view) is the list of nodes that contain those database replicas.
+* The [database group topology](../../../studio/database/settings/manage-database-group.mdx#the-database-group-view) is the list of nodes that contain the database's replicas.
The first node in this list is called the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node).
* The client is kept up-to-date with this topology list.
- __The client decides which node from this list to access__ when making requests to the RavenDB cluster.
+ **The client decides which node from this list to access** when making requests to the RavenDB cluster.
* By default, the client will access the preferred node for all _Read & Write_ requests it makes.
This default behavior can be changed by configuring:
* [ReadBalanceBehavior](../../../client-api/configuration/load-balance/read-balance-behavior.mdx) - load balancing `Read` requests only
* [LoadBalanceBehavior](../../../client-api/configuration/load-balance/load-balance-behavior.mdx) - load balancing `Read & Write` requests
-* In this page:
- * [Keeping the client topology up-to-date](../../../client-api/configuration/load-balance/overview.mdx#keeping-the-client-topology-up-to-date)
- * [Client logic for choosing a node](../../../client-api/configuration/load-balance/overview.mdx#client-logic-for-choosing-a-node)
- * [The preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
- * [Single-node session usage](../../../client-api/configuration/load-balance/overview.mdx#single-node-session-usage)
-
+
+* In this article:
+ * [Keeping the client topology up-to-date](../../../client-api/configuration/load-balance/overview.mdx#keeping-the-client-topology-up-to-date)
+ * [Client logic for choosing a node](../../../client-api/configuration/load-balance/overview.mdx#client-logic-for-choosing-a-node)
+ * [The preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
+ * [Single-node session usage](../../../client-api/configuration/load-balance/overview.mdx#single-node-session-usage)
+
-## Keeping the client topology up-to-date
-* Upon Document Store initialization, the client receives the __initial topology list__,
+
+
+* Upon Document Store initialization, the client receives the **initial topology list**,
after which the client is kept updated at all times for any changes made to it.
-* If the topology list has changed on the server, (or any other client configuration),
- the client will learn about it upon making its __next request__ to the server,
+* If the topology list (or any other client configuration) has changed on the server,
+ the client will learn about the change from the server's response to its **next request**,
and will update its configuration accordingly.
* In addition, every 5 minutes, the client will fetch the current topology from the server
if no requests were made within that time frame.
-* Any client-configuration settings that are set on the server side __override__ the settings made on the client-side.
+* Any client-configuration settings that are set on the server side **override** the settings made on the client side.
* For more information see [Topology in the client](../../../client-api/cluster/how-client-integrates-with-replication-and-cluster.mdx#cluster-topology-in-the-client).
+
-
-## Client logic for choosing a node
+
The client uses the following logic (from top to bottom) to determine which node to send the request to:
-* Use the __specified node__:
+* Use the **specified node**:
A client can explicitly specify the target node when executing a [server-maintenance operation](../../../client-api/operations/what-are-operations.mdx#server-maintenance-operations).
- Learn more in [switch operation to a different node](../../../client-api/operations/how-to/switch-operations-to-a-different-node.mdx).
-* Else, if using-session-context is defined, use __LoadBalanceBehavior__:
+ Learn more in [Switch Operations to a Different Node](../../../client-api/operations/how-to/switch-operations-to-a-different-node.mdx).
+* Else, if **LoadBalanceBehavior** is set to `UseSessionContext`, use the session context:
Per session, the client will select a node based on the [session context](../../../client-api/configuration/load-balance/load-balance-behavior.mdx#loadbalancebehavior-options).
- All `Read & Write` requests made on the session will be directed to that node.
-* Else, if defined, use __ReadBalanceBehavior__:
+ All `Read & Write` requests made on the session will be directed to the selected node.
+* Else, if defined, use **ReadBalanceBehavior**:
`Read` requests: The client will select a node based on the [read balance options](../../../client-api/configuration/load-balance/read-balance-behavior.mdx#readbalancebehavior-options).
- `Write` requests: All _Write_ requests will be directed to the preferred node.
-* Else, use the __preferred node__:
+ `Write` requests: All _Write_ requests will be directed to the preferred node.
+* Else, use the **preferred node**:
Use the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node) for both `Read & Write` requests.
+
+
-## The preferred node
-
-* The preferred node is simply the __first__ node in the [topology nodes list](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view).
-* __By default__, when no load balancing strategy is defined,
+* The preferred node is the **first** node in the [topology list](../../../studio/database/settings/manage-database-group.mdx#the-database-group-view).
+* **By default**, when no load balancing strategy is defined,
the client will send all `Read & Write` requests to this node.
-* When the preferred node is in a failure state,
- the cluster will update the topology, assigning another node to be the preferred one.
+* When the preferred node is in a failure state,
+ the client will send its requests to the first node in the topology list that is not in a failure state.
+ If the failed node stays down, the cluster will change the node's state to `Rehab` and move it to the end of the list,
+ so the second node in the list will become the preferred node.
* Once the preferred node is back up and has caught up with all data,
- it will be placed __last__ in the topology list.
-* If all the nodes in the topology list are in a failure state then the first node in the list will be the 'preferred'.
- The user would get an error, or recover if the error was transient.
+ the cluster will [randomly reorder](../../../server/clustering/distribution/distributed-database.mdx#nodes-order) the topology list of every database the recovered node hosts,
+ so the node may be placed anywhere in each list.
+ As a result, the preferred-node role of the node's databases will be spread among the cluster's nodes,
+ instead of remaining with the nodes that stayed up.
+ * If you set a [fixed order](../../../client-api/operations/server-wide/reorder-database-members.mdx) for the topology list, the cluster will restore the fixed order instead,
+ and the recovered node will return to its position in the fixed order.
+* If all the nodes in the topology list are in a [failure state](../../../client-api/cluster/how-client-integrates-with-replication-and-cluster.mdx#failover-behavior),
+ the client will send each request to the next node in the list, in turn.
+ The request will fail, unless the node it is sent to has recovered (e.g., from a temporary network outage).
* The preferred node can be explicitly set by:
- * Reordering the topology list from the [Database Group view](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
+ * Reordering the topology list from the [Database Group view](../../../studio/database/settings/manage-database-group.mdx#reordering-nodes).
* Sending [ReorderDatabaseMembersOperation](../../../client-api/operations/server-wide/reorder-database-members.mdx) from the client code.
-* The cluster may assign a different preferred node when removing/adding new nodes to the database-group.
-
+* The cluster may assign a different preferred node when nodes join the database group or leave it.
+
-## Single-node session usage
+
* When using a [single-node session](../../../client-api/session/cluster-transaction/overview.mdx#single-node),
- a short delay in replicating changes to all nodes in the cluster is acceptable in most cases.
+ a short delay in replicating changes to all nodes in the cluster is acceptable in most cases.
* If `ReadBalanceBehavior` or `LoadBalanceBehavior` are defined,
then the next session you open may access a different node.
So if you need to ensure that the next request will be able to _immediately_ read what you just wrote,
then use [Write Assurance](../../../client-api/session/saving-changes.mdx#waiting-for-replication---write-assurance).
-
-
+
diff --git a/docs/client-api/configuration/load-balance/read-balance-behavior.mdx b/docs/client-api/configuration/load-balance/read-balance-behavior.mdx
index 4d6357154d..339aa07892 100644
--- a/docs/client-api/configuration/load-balance/read-balance-behavior.mdx
+++ b/docs/client-api/configuration/load-balance/read-balance-behavior.mdx
@@ -33,8 +33,8 @@ see_also:
link: "studio/database/settings/client-configuration-per-database"
source: "docs"
path: "Studio > Database Management > Settings"
- - title: "Database-group-topology"
- link: "studio/database/settings/manage-database-group#database-group-topology---view"
+ - title: "Manage Database Group"
+ link: "studio/database/settings/manage-database-group#the-database-group-view"
source: "docs"
path: "Studio > Database Management > Settings"
---
diff --git a/docs/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx b/docs/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
index 58de528cdf..e013e66c99 100644
--- a/docs/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
+++ b/docs/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
@@ -1,53 +1,89 @@
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-**ReorderDatabaseMembersOperation** allows you to change the order of nodes in the [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
-## Syntax
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
-
-
-{`public ReorderDatabaseMembersOperation(string database, List order)
-`}
-
-
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixedTopology` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
-| Parameters | | |
-| ------------- | ------------- | ----- |
-| **database** | string | Name of a database to operate on |
-| **order** | List\<string> | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `ArgumentException` is the reordered list doesn't correspond to the existing nodes of the database group |
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
-## Example I
+
-
-
-{`// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+
+#### Example: Set a new order
+
+```csharp
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
// Change the order of database group nodes to : ["C", "A", "B"]
store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind",
new List
- \{
+ {
"C", "A", "B"
- \}));
-`}
-
-
+ }));
+```
+
+
-## Example II
+
-
-
-{`// Get the current DatabaseTopology from database record
+#### Example: Reverse the current order
+
+```csharp
+// Get the current DatabaseTopology from database record
var topology = store.Maintenance.Server.Send(new GetDatabaseRecordOperation("Northwind")).Topology;
// Reverse the order of database group nodes
topology.Members.Reverse();
store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind", topology.Members));
-`}
-
-
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```csharp
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind",
+ new List
+ {
+ "C", "A", "B"
+ },
+ fixedTopology: true));
+```
+
+
+
+
+
+
+
+```csharp
+public ReorderDatabaseMembersOperation(string database, List order)
+
+public ReorderDatabaseMembersOperation(string database, List order, bool fixedTopology)
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `string` | Name of a database to operate on |
+| **order** | `List` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `ArgumentException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixedTopology** | `bool` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (the first constructor's value): the order may change later, and the server clears any fixed order set earlier. |
+
diff --git a/docs/client-api/operations/server-wide/content/_reorder-database-members-java.mdx b/docs/client-api/operations/server-wide/content/_reorder-database-members-java.mdx
new file mode 100644
index 0000000000..f5d94f6b0f
--- /dev/null
+++ b/docs/client-api/operations/server-wide/content/_reorder-database-members-java.mdx
@@ -0,0 +1,83 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```java
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+// Change the order of database group nodes to : ["C", "A", "B"]
+
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind",
+ Arrays.asList("C", "A", "B")));
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```java
+// Get the current DatabaseTopology from database record
+DatabaseTopology topology = store.maintenance().server().send(new GetDatabaseRecordOperation("Northwind")).getTopology();
+
+// Reverse the order of database group nodes
+Collections.reverse(topology.getMembers());
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind", topology.getMembers()));
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```java
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind",
+ Arrays.asList("C", "A", "B"),
+ true));
+```
+
+
+
+
+
+
+
+```java
+public ReorderDatabaseMembersOperation(String database, List order)
+
+public ReorderDatabaseMembersOperation(String database, List order, boolean fixed)
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `String` | Name of a database to operate on |
+| **order** | `List` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `boolean` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (the first constructor's value): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/docs/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx b/docs/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx
new file mode 100644
index 0000000000..a1fd36a0c0
--- /dev/null
+++ b/docs/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx
@@ -0,0 +1,82 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```js
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+// Change the order of database group nodes to : ["C", "A", "B"]
+
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"]));
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```js
+// Get the current DatabaseTopology from database record
+const databaseRecord = await store.maintenance.server.send(new GetDatabaseRecordOperation("Northwind"));
+const members = databaseRecord.topology.members;
+
+// Reverse the order of database group nodes
+members.reverse();
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind", members));
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```js
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"],
+ true));
+```
+
+
+
+
+
+
+
+```js
+const operation = new ReorderDatabaseMembersOperation(database, order, fixed?);
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `string` | Name of a database to operate on |
+| **order** | `string[]` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `boolean` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (default): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/docs/client-api/operations/server-wide/content/_reorder-database-members-python.mdx b/docs/client-api/operations/server-wide/content/_reorder-database-members-python.mdx
new file mode 100644
index 0000000000..4f2e7c081d
--- /dev/null
+++ b/docs/client-api/operations/server-wide/content/_reorder-database-members-python.mdx
@@ -0,0 +1,83 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `True`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```python
+# Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+# Change the order of database group nodes to : ["C", "A", "B"]
+
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"]))
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```python
+# Get the current topology from database record
+topology = store.maintenance.server.send(GetDatabaseRecordOperation("Northwind")).topology
+members = topology["Members"]
+
+# Reverse the order of database group nodes
+members.reverse()
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind", members))
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```python
+# Set the order of database group nodes to ["C", "A", "B"],
+# and keep this order when the Cluster Observer reorders the nodes
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"],
+ fixed=True))
+```
+
+
+
+
+
+
+
+```python
+class ReorderDatabaseMembersOperation(VoidServerOperation):
+ def __init__(self, database: str = None, order: List[str] = None, fixed: bool = False): ...
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `str` | Name of a database to operate on |
+| **order** | `List[str]` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `bool` | `True`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`False` (default): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/docs/client-api/operations/server-wide/content/_toggle-dynamic-database-distribution-csharp.mdx b/docs/client-api/operations/server-wide/content/_toggle-dynamic-database-distribution-csharp.mdx
index 5d621c11e3..fd5e93c2b6 100644
--- a/docs/client-api/operations/server-wide/content/_toggle-dynamic-database-distribution-csharp.mdx
+++ b/docs/client-api/operations/server-wide/content/_toggle-dynamic-database-distribution-csharp.mdx
@@ -11,8 +11,7 @@ if a database node is down, another cluster node is added to the database group
* Use this operation to toggle dynamic distribution for a particular database group.
-* This can also be done [in the studio](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions) under
-database group settings.
+* You can also toggle dynamic distribution from the Database Group view in [Studio](../../../../studio/database/settings/manage-database-group.mdx#dynamic-database-distribution).
diff --git a/docs/client-api/operations/server-wide/reorder-database-members.mdx b/docs/client-api/operations/server-wide/reorder-database-members.mdx
index e78feb8e20..39477faada 100644
--- a/docs/client-api/operations/server-wide/reorder-database-members.mdx
+++ b/docs/client-api/operations/server-wide/reorder-database-members.mdx
@@ -1,15 +1,18 @@
---
-title: "Operations: Server: How to reoder database members?"
+title: "Operations: Server: How to reorder database members?"
sidebar_label: Reorder Database Members
description: "Reorder the RavenDB database group member priority list to control which nodes are preferred for client operations."
sidebar_position: 10
-supported_languages: ["csharp"]
+supported_languages: ["csharp", "java", "python", "nodejs"]
---
import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
import LanguageContent from "@site/src/components/LanguageContent";
import ReorderDatabaseMembersCsharp from './content/_reorder-database-members-csharp.mdx';
+import ReorderDatabaseMembersJava from './content/_reorder-database-members-java.mdx';
+import ReorderDatabaseMembersPython from './content/_reorder-database-members-python.mdx';
+import ReorderDatabaseMembersNodejs from './content/_reorder-database-members-nodejs.mdx';
@@ -17,3 +20,14 @@ import ReorderDatabaseMembersCsharp from './content/_reorder-database-members-cs
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/server/clustering/distribution/distributed-database.mdx b/docs/server/clustering/distribution/distributed-database.mdx
index 78c50fdae6..57444e27e0 100644
--- a/docs/server/clustering/distribution/distributed-database.mdx
+++ b/docs/server/clustering/distribution/distributed-database.mdx
@@ -6,11 +6,8 @@ sidebar_position: 0
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
# Distributed Database
@@ -18,21 +15,24 @@ import LanguageContent from "@site/src/components/LanguageContent";
* In RavenDB, a database can be replicated across multiple nodes, depending on its [Replication Factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor).
* A node where a database resides is referred to as a `Database Node`.
- The group of _Database Nodes_ that assemble the distributed database, is called a [Database Group](../../../studio/database/settings/manage-database-group.mdx).
+ The group of _Database Nodes_ that assemble the distributed database is called a [Database Group](../../../studio/database/settings/manage-database-group.mdx).
* Unless [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding) is employed,
each Database Node has a **full copy** of the database, containing **all** the database documents, and indexes them **locally**.
This greatly simplifies executing query requests, as there is no need to aggregate data from multiple nodes.
-
-* In this page:
- * [The Database Record](../../../server/clustering/distribution/distributed-database.mdx#the-database-record)
- * [Replication Factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor)
- * [Database Topology](../../../server/clustering/distribution/distributed-database.mdx#database-topology)
- * [Dynamic Database Distribution](../../../server/clustering/distribution/distributed-database.mdx#dynamic-database-distribution)
- * [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding)
+
+* In this article:
+ * [The database record](../../../server/clustering/distribution/distributed-database.mdx#the-database-record)
+ * [Replication factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor)
+ * [Database topology](../../../server/clustering/distribution/distributed-database.mdx#database-topology)
+ * [States flow](../../../server/clustering/distribution/distributed-database.mdx#states-flow)
+ * [Nodes order](../../../server/clustering/distribution/distributed-database.mdx#nodes-order)
+ * [Dynamic database distribution](../../../server/clustering/distribution/distributed-database.mdx#dynamic-database-distribution)
+ * [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding)
-## The Database Record
+
+
Each database instance keeps its configuration (e.g. Index definitions, Database topology) in a [Database Record](../../../client-api/operations/server-wide/create-database.mdx) object.
Upon database creation, this object is propagated through Rachis to all nodes in the cluster.
@@ -40,9 +40,9 @@ Upon database creation, this object is propagated through Rachis to all nodes in
After that, each node updates its own `Database Record` independently upon receiving any new Raft command,
e.g. when an index has changed.
+
-
-## Replication Factor
+
When creating a database, you can either:
@@ -53,11 +53,11 @@ When creating a database, you can either:
In either case, the number of nodes will represent the `Replication Factor`.
Once the database is created by getting a [Consensus](../../../server/clustering/rachis/consensus-operations.mdx),
-the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) begins monitoring the _Database Group_ in order to maintain this Replication Factor.
+the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) begins monitoring the _Database Group_ to maintain this Replication Factor.
+
-
-## Database Topology
+
The `Database Topology` describes the relationships between the Database Nodes within the [Database Group](../../../studio/database/settings/manage-database-group.mdx).
Each **Database Node** can be in one of the following states:
@@ -68,48 +68,60 @@ Each **Database Node** can be in one of the following states:
| **Promotable** | A node that has been recently added to the group and is being updated. |
| **Rehab** | A former Member node that is assumed to be _not_ up-to-date due to a partition. |
-
+
+
+All `Members` have master-master [Replication](../../../server/clustering/replication/replication-overview.mdx) to keep the documents in sync across the nodes.
+
+
+
+
+
+### States flow
* In general, all nodes in a newly created database are in a `Member` state.
-* When adding a new Database Node to an already existing database group, a `Mentor Node` is selected in order to update it.
+* When you add a new Database Node to an existing database group, a `Member` node becomes the new node's `Mentor Node` and updates the new node.
The new node will be in a `Promotable` state until it receives _and_ indexes all the documents from the mentor node.
* Learn more in:
* [Cluster node types](../../../studio/cluster/cluster-view.mdx#cluster-nodes-types)
* [Cluster node states and types flow](../../../studio/cluster/cluster-view.mdx#cluster-nodes-states--types-flow)
-
+
-
+
+
+### Nodes order
* The database topology is kept in a list that is always ordered with `Member` nodes first,
- then `Rehabs` and `Promotables` are last.
+ then `Rehabs` and `Promotables` are last.
* The order is important since it defines the client's order of access into the Database Group,
(see [Load balancing client requests](../../../client-api/configuration/load-balance/overview.mdx)).
-* The order can be modified using the [Client-API](../../../client-api/operations/server-wide/reorder-database-members.mdx)
- or via the [Studio](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
-
-
+* You can modify the order using the [client API](../../../client-api/operations/server-wide/reorder-database-members.mdx)
+ or [Studio](../../../studio/database/settings/manage-database-group.mdx#reordering-nodes).
+ When you modify the order, you can set the new order as fixed.
+* When the Cluster Observer promotes a database node to `Member` (a newly added node, or a node that has recovered from `Rehab`),
+ the observer randomly reorders the `Member` nodes in the database's topology list.
+ A recovered node is promoted in every database the node hosts, so the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
+ role of these databases is spread among the cluster's nodes instead of remaining with the nodes that stayed up.
+ * If you set the order as fixed, the observer restores the fixed order after the random reorder.
-
-
-All `Members` have master-master [Replication](../../../server/clustering/replication/replication-overview.mdx) in order to keep the documents in sync across the nodes.
+
-
+
-
-## Dynamic Database Distribution
+
If any of the `Database Nodes` is down or partitioned, the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) will recognize it and act as follows:
1. If the time that is defined in [TimeBeforeMovingToRehabInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforemovingtorehabinsec) (default: 60 seconds) has passed
- and the node is still unreachable, the node will be moved to a `Rehab` state.
-
-2. If the node remains in `Rehab` for the time defined in [TimeBeforeAddingReplicaInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforeaddingreplicainsec) (default: 900 seconds),
- a new database node will be automatically added to the database group to replace the `Rehab` node.
+ and the node is still unreachable, the observer will change the node's state to `Rehab`.
+
+2. If dynamic database distribution is on and the node remains in `Rehab` state for the time defined in
+ [TimeBeforeAddingReplicaInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforeaddingreplicainsec) (default: 900 seconds),
+ the observer will add another cluster node to the database group to replace the `Rehab` node, if a suitable cluster node is available.
-3. If the `Rehab` node is online again, it will be assigned a [Mentor Node](../../../server/clustering/distribution/highly-available-tasks.mdx#responsible-node) to update it with the recent changes.
+3. If the `Rehab` node is online again, it will be assigned a [Mentor Node](../../../studio/database/settings/manage-database-group.mdx#member-node-duties) to update it with the recent changes.
-4. The first node to be up-to-date stays, while the other is deleted.
+4. If a replacement node was added in step 2, the first of the two nodes to be up-to-date stays, while the other is deleted.
@@ -118,20 +130,21 @@ and only AFTER it has finished sending all new documents it may have (while disc
-The _Dynamic Database Distribution_ feature can be toggled on and off with the following request:
+To turn dynamic database distribution on or off, use the
+[SetDatabaseDynamicDistributionOperation](../../../client-api/operations/server-wide/toggle-dynamic-database-distribution.mdx) client API operation,
+[Studio](../../../studio/database/settings/manage-database-group.mdx#dynamic-database-distribution), or the following request:
| URL | Method | URL Params |
|--------------------------------------------|----------|-----------------------------------------|
| /admin/databases/dynamic-node-distribution | `POST` | name=[`database-name`], enable=[`bool`] |
+
-
-## Sharding
+
* Sharding, supported by RavenDB as an out-of-the-box solution starting with version **6.0**,
is the distribution of a database's content across autonomous shards.
* Learn more about sharding in this dedicated [Sharding overview](../../../sharding/overview.mdx) article.
-
-
+
diff --git a/docs/sharding/external-replication.mdx b/docs/sharding/external-replication.mdx
index e9f31b68d0..2db328b7cd 100644
--- a/docs/sharding/external-replication.mdx
+++ b/docs/sharding/external-replication.mdx
@@ -6,74 +6,72 @@ sidebar_position: 9
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
# Sharding: External Replication
-* [External Replication](../server/ongoing-tasks/external-replication.mdx) is an
- ongoing RavenDB task that you can create and run to maintain a live replica
+* [External Replication](../server/ongoing-tasks/external-replication.mdx) is an
+ ongoing RavenDB task that you can create and run to maintain a live replica
of your database on another RavenDB server.
-* Defining an external replication task via [Studio](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#definition)
- or [API](../server/ongoing-tasks/external-replication.mdx#code-sample) under a
+* Defining an external replication task via [Studio](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#definition)
+ or [API](../server/ongoing-tasks/external-replication.mdx#code-sample) under a
sharded database is similar to defining such tasks under a non-sharded database.
-* Sharded and non-sharded databases can replicate data to each other, providing
- their version is at least 6.0.
+* Sharded and non-sharded databases can replicate data to each other, provided that the non-sharded databases
+ are of version 5.4 or higher.
-* In this page:
- * [Supported Versions](../sharding/external-replication.mdx#supported-versions)
- * [External Replication Types](../sharding/external-replication.mdx#external-replication-types)
- * [Non-Sharded Database to Sharded Database](../sharding/external-replication.mdx#non-sharded-database-to-sharded-database)
- * [Sharded Database to Sharded Database](../sharding/external-replication.mdx#sharded-database-to-sharded-database)
- * [Performance Considerations](../sharding/external-replication.mdx#performance-considerations)
+* In this article:
+ * [Supported versions](../sharding/external-replication.mdx#supported-versions)
+ * [External replication types](../sharding/external-replication.mdx#external-replication-types)
+ * [Non-sharded database to sharded database](../sharding/external-replication.mdx#non-sharded-database-to-sharded-database)
+ * [Sharded database to sharded database](../sharding/external-replication.mdx#sharded-database-to-sharded-database)
+ * [Performance considerations](../sharding/external-replication.mdx#performance-considerations)
-## Supported Versions
-* A sharded database and a non-sharded database **can** replicate data to each
- other, providing their versions are 6.0 or higher.
-* Replicating data between a sharded database and a RavenDB version earlier
+
+
+* A sharded database and a non-sharded database **can** replicate data to each other, provided that the non-sharded database
+ is of version 5.4 or higher.
+* Replicating data between a sharded database and a RavenDB version earlier
than 5.4 is **not supported**.
-* Non-sharded databases **can** replicate data to each other regardless of
- their version. E.g., a non-sharded 6.0 database can replicate data to a 5.2
+* Non-sharded databases **can** replicate data to each other regardless of
+ their version. E.g., a non-sharded 6.0 database can replicate data to a 5.2
database and vice versa.
+
-
-## External Replication Types
+
-* **Internal replication** is applied automatically when the replication
- factor is larger than 1, to make the shard database more available by
+* **Internal replication** is applied automatically when the replication
+ factor is larger than 1, to make the shard database more available by
maintaining multiple accessible copies of it.
- Learn more about shards internal replication in the [overview](../sharding/overview.mdx#shard-replication)
- article and administration [Studio](../sharding/administration/studio-admin.mdx)
+ Learn more about shards internal replication in the [overview](../sharding/overview.mdx#shard-replication)
+ article and administration [Studio](../sharding/administration/studio-admin.mdx)
and [API](../sharding/administration/api-admin.mdx) articles.
* **External replication** is applied when a dedicated task is defined for it.
- Read more about it and follow a step-by-step guide
- [here](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#step-by-step-guide).
+ To learn more about external replication and follow a step-by-step guide,
+ see [External Replication Task](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#step-by-step-guide).
-All data replicated by or to a sharded database is mediated via
-[orchestrators](../sharding/overview.mdx#client-server-communication).
-The shards themselves are oblivious to their being shards: from
-a shard's perspective, it is just a regular RavenDB database that
+All data replicated to a sharded database is mediated via
+[orchestrators](../sharding/overview.mdx#client-server-communication).
+The shards themselves are oblivious to their being shards: from
+a shard's perspective, it is just a regular RavenDB database that
can, among its other ordinary RavenDB features, replicate data.
-External replication from and to non-sharded databases requires
-no special syntax or preparations. It does, however, cost the server
-some additional work, that, especially when the database is large
-and every extra operation counts, should be taken into account by
-the administrator. Here is how external replication works behind
-the scenes.
+External replication from and to sharded databases requires no special syntax or preparations.
+It does, however, cost the server some additional work. Take this additional work into account,
+especially when the database is large and every extra operation counts.
+Here is how external replication works behind the scenes.
-## Non-Sharded Database to Sharded Database
+
+
+### Non-sharded database to sharded database
The image below depicts a non-sharded database replicating data to a 5-shard database.
@@ -81,22 +79,26 @@ The image below depicts a non-sharded database replicating data to a 5-shard dat
1. **Non-Sharded Database**
2. **Replication to Sharded Database**
- The database is unaware that the destination database is sharded,
- no special syntax or preparation is needed.
+ The database is unaware that the destination database is sharded,
+ so no special syntax or preparation is needed.
3. **Orchestrator**
- The orchestrator receives and prepares the replicated data,
- grouping documents and document extensions by document IDs so each
+ The orchestrator receives and prepares the replicated data,
+ grouping documents and document extensions by document IDs so each
entity can be stored in the correct shard.
4. **Transfer to Shard**
The orchestrator transfers each destination shard its data.
- Optimization routines are applied to make the process as
+ Optimization routines are applied to make the process as
effective as possible.
5. **Shard**
- Document and document extensions are assigned to buckets by document ID.
- Shard replies to replicated data and replication attempts are similar
+ Documents and document extensions are assigned to buckets by document ID.
+ Shard replies to replicated data and replication attempts are similar
to replies made by non-sharded databases.
-## Sharded Database to Sharded Database
+
+
+
+
+### Sharded database to sharded database
* The image below depicts a 3-shard database replicating data to a 5-shard database.
* Each shard replicates its data as an autonomous database.
@@ -106,33 +108,55 @@ The image below depicts a non-sharded database replicating data to a 5-shard dat
1. **DB 1 Shard**
The shard is unaware that the destination database is sharded.
2. **Replication to DB 2**
- The database is unaware that the destination database is sharded,
- no special syntax or preparation is needed.
+ The database is unaware that the destination database is sharded,
+ so no special syntax or preparation is needed.
3. **DB 2 Orchestrator**
- The orchestrator receives and prepares the replicated data,
- grouping documents and document extensions by document IDs so each
+ The orchestrator receives and prepares the replicated data,
+ grouping documents and document extensions by document IDs so each
entity can be stored in the correct shard.
4. **Transfer to Shard**
The orchestrator transfers each destination shard its data.
- Optimization routines are applied to make the process as
+ Optimization routines are applied to make the process as
effective as possible.
5. **DB 2 Shard**
Documents and document extensions are assigned to buckets by document ID.
- Shard replies to replicated data and replication attempts are similar
+ Shard replies to replicated data and replication attempts are similar
to replies made by non-sharded databases.
+
+
+
+
-## Performance Considerations
+When two databases replicate data to each other, whether they are sharded or not, the target database sends each data item it receives
+back to the original sender. The original sender recognizes that the data item is already stored locally, ignores the data item, and
+ends the cycle.
-When external replication tasks are defined in two different sharded databases,
-so they replicate their data to each other, each data item sent from one of the
-databases to the other will then be sent back from the target database to the
-original sender. The original sender will then recognize that the data item is
-already stored locally, ignore it, and end the cycle.
+The data items that the target database sends back depend on the target database type:
-In this specific case, of two external databases replicating data to each other,
-please consider this overhead in your performance considerations and tests.
+* **Non-sharded target database**
+ The database sends back only the data items it receives while its replication task to the original sender is running.
+* **Sharded target database**
+ The database sends back every data item it received from the original sender, regardless of when it received the data item.
+Each shard adds its own entry to the [change vector](../server/clustering/replication/change-vector.mdx) of every data item it receives
+by external replication. When the sharded database replicates data onward to another database, the sharded database uses the shards'
+entries to send the destination every data item from every shard, so no data item is lost.
+The original sender's [global change vector](../server/clustering/replication/change-vector.mdx#database-global-change-vector) does not
+include the shards' entries, so the sharded database sends every data item received from the original sender back to the original sender.
+For example:
+
+* A non-sharded database replicates 1,000 documents to a sharded database.
+* You then create a replication task from the sharded database back to the non-sharded database.
+* The sharded database will send all 1,000 documents back to the non-sharded database
+ (whereas a non-sharded target database would send back none of the 1,000 documents).
+
+
+
+Take the additional replication traffic into account in your performance planning and tests.
+
+
+
diff --git a/docs/studio/database/settings/assets/database-group-1.png b/docs/studio/database/settings/assets/database-group-1.png
deleted file mode 100644
index 0b70b8b523..0000000000
Binary files a/docs/studio/database/settings/assets/database-group-1.png and /dev/null differ
diff --git a/docs/studio/database/settings/assets/database-group-2.png b/docs/studio/database/settings/assets/database-group-2.png
deleted file mode 100644
index a6cb87e721..0000000000
Binary files a/docs/studio/database/settings/assets/database-group-2.png and /dev/null differ
diff --git a/docs/studio/database/settings/assets/database-group-3.png b/docs/studio/database/settings/assets/database-group-3.png
deleted file mode 100644
index e8a832ebb9..0000000000
Binary files a/docs/studio/database/settings/assets/database-group-3.png and /dev/null differ
diff --git a/docs/studio/database/settings/assets/database-group-4.png b/docs/studio/database/settings/assets/database-group-4.png
deleted file mode 100644
index 2b6e68dd17..0000000000
Binary files a/docs/studio/database/settings/assets/database-group-4.png and /dev/null differ
diff --git a/docs/studio/database/settings/assets/manage-database-group_add-node.png b/docs/studio/database/settings/assets/manage-database-group_add-node.png
new file mode 100644
index 0000000000..0f0f439c64
Binary files /dev/null and b/docs/studio/database/settings/assets/manage-database-group_add-node.png differ
diff --git a/docs/studio/database/settings/assets/manage-database-group_delete-from-group.png b/docs/studio/database/settings/assets/manage-database-group_delete-from-group.png
new file mode 100644
index 0000000000..5d74add79a
Binary files /dev/null and b/docs/studio/database/settings/assets/manage-database-group_delete-from-group.png differ
diff --git a/docs/studio/database/settings/assets/manage-database-group_navigation.png b/docs/studio/database/settings/assets/manage-database-group_navigation.png
new file mode 100644
index 0000000000..0ed6a0a06d
Binary files /dev/null and b/docs/studio/database/settings/assets/manage-database-group_navigation.png differ
diff --git a/docs/studio/database/settings/assets/manage-database-group_promotable.png b/docs/studio/database/settings/assets/manage-database-group_promotable.png
new file mode 100644
index 0000000000..c6ed17061f
Binary files /dev/null and b/docs/studio/database/settings/assets/manage-database-group_promotable.png differ
diff --git a/docs/studio/database/settings/assets/manage-database-group_rehab.png b/docs/studio/database/settings/assets/manage-database-group_rehab.png
new file mode 100644
index 0000000000..00e9e094ba
Binary files /dev/null and b/docs/studio/database/settings/assets/manage-database-group_rehab.png differ
diff --git a/docs/studio/database/settings/assets/manage-database-group_reorder.png b/docs/studio/database/settings/assets/manage-database-group_reorder.png
new file mode 100644
index 0000000000..1286d5b1b1
Binary files /dev/null and b/docs/studio/database/settings/assets/manage-database-group_reorder.png differ
diff --git a/docs/studio/database/settings/assets/manage-database-group_settings.png b/docs/studio/database/settings/assets/manage-database-group_settings.png
new file mode 100644
index 0000000000..c7a1541767
Binary files /dev/null and b/docs/studio/database/settings/assets/manage-database-group_settings.png differ
diff --git a/docs/studio/database/settings/assets/manage-database-group_view.png b/docs/studio/database/settings/assets/manage-database-group_view.png
new file mode 100644
index 0000000000..e33d1a2dde
Binary files /dev/null and b/docs/studio/database/settings/assets/manage-database-group_view.png differ
diff --git a/docs/studio/database/settings/assets/snagit/manage-database-group_add-node.snagx b/docs/studio/database/settings/assets/snagit/manage-database-group_add-node.snagx
new file mode 100644
index 0000000000..48bcad8df1
Binary files /dev/null and b/docs/studio/database/settings/assets/snagit/manage-database-group_add-node.snagx differ
diff --git a/docs/studio/database/settings/assets/snagit/manage-database-group_navigation.snagx b/docs/studio/database/settings/assets/snagit/manage-database-group_navigation.snagx
new file mode 100644
index 0000000000..4909a3dba8
Binary files /dev/null and b/docs/studio/database/settings/assets/snagit/manage-database-group_navigation.snagx differ
diff --git a/docs/studio/database/settings/assets/snagit/manage-database-group_promotable.snagx b/docs/studio/database/settings/assets/snagit/manage-database-group_promotable.snagx
new file mode 100644
index 0000000000..c3888cc880
Binary files /dev/null and b/docs/studio/database/settings/assets/snagit/manage-database-group_promotable.snagx differ
diff --git a/docs/studio/database/settings/assets/snagit/manage-database-group_rehab.snagx b/docs/studio/database/settings/assets/snagit/manage-database-group_rehab.snagx
new file mode 100644
index 0000000000..57bdee2885
Binary files /dev/null and b/docs/studio/database/settings/assets/snagit/manage-database-group_rehab.snagx differ
diff --git a/docs/studio/database/settings/assets/snagit/manage-database-group_reorder.snagx b/docs/studio/database/settings/assets/snagit/manage-database-group_reorder.snagx
new file mode 100644
index 0000000000..9fa456f7cc
Binary files /dev/null and b/docs/studio/database/settings/assets/snagit/manage-database-group_reorder.snagx differ
diff --git a/docs/studio/database/settings/assets/snagit/manage-database-group_view.snagx b/docs/studio/database/settings/assets/snagit/manage-database-group_view.snagx
new file mode 100644
index 0000000000..a9da507987
Binary files /dev/null and b/docs/studio/database/settings/assets/snagit/manage-database-group_view.snagx differ
diff --git a/docs/studio/database/settings/manage-database-group.mdx b/docs/studio/database/settings/manage-database-group.mdx
index 78a8863278..31654f6068 100644
--- a/docs/studio/database/settings/manage-database-group.mdx
+++ b/docs/studio/database/settings/manage-database-group.mdx
@@ -6,139 +6,258 @@ sidebar_position: 9
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
# Manage Database Group
-* A **Database instance** can reside on a single node, on a number of nodes, or on all cluster nodes,
- depending on the replication factor defined when [creating the database](../../../studio/database/create-new-database/general-flow.mdx).
- The replication factor determines the number of copies we hold for that database in the cluster,
- so we still have a copy of the data when a node goes down.
+* A **database instance** can reside on a single node, on a number of nodes, or on all cluster nodes,
+ depending on the [replication factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor) defined when [creating the database](../../../studio/database/create-new-database/general-flow.mdx).
+ The replication factor determines the number of copies of the database the cluster keeps,
+ so a copy of the data remains available when a node goes down.
-* The **Database Group** refers to all the database instances in the cluster.
- Every node in a Database Group will have a _full copy_ of all the data,
- including documents, indexes, [tombstones](../../../monitoring/tombstones/overview.mdx) (which is how we replicate deletes),
- attachments and revisions,
- and is able to serve all queries, operations and write requests.
+* The **database group** refers to all the database instances in the cluster.
+ Every [member node](../../../studio/database/settings/manage-database-group.mdx#node-states) in a database group holds a _full copy_ of all database data,
+ including documents, indexes, [tombstones](../../../monitoring/tombstones/overview.mdx) (the records RavenDB uses to replicate deletions),
+ attachments, and revisions, and is able to serve all queries, operations and write requests.
-* The **Database Group Topology** is the specification of nodes that contain the database in the cluster in a particular point in time.
+* The **database group topology** is the specification of nodes that contain the database in the cluster at a specific point in time.
-* At the **Database Group Level**, all the nodes are working cooperatively together.
+ Although not all nodes in the cluster belong to the database group, each node in the cluster holds a full copy of all database group topologies.
+
+* At the **database group level**, all nodes work together.
The connections between the databases on the different nodes do not go through any consensus protocol.
- Instead of selecting a leader, as in the [Cluster Level](../../../studio/cluster/cluster-view.mdx),
- there is a direct TCP connection among the various nodes that hold a particular database.
- Whenever there is a write on one of the databases instances, it will immediately be recorded and replicated (sent) to all the other nodes in the Database Group.
+ Instead of selecting a leader, as at the [cluster level](../../../studio/cluster/cluster-view.mdx),
+ there is a direct TCP connection between the nodes that hold a particular database.
+ Whenever there is a write on one of the database instances, it will immediately be recorded and replicated to all other nodes in the database group.
+
+ If a database instance is unable to replicate the data for some reason, it will still accept the data and send it later.
+
+* To open the Database Group view, select the database and go to **`Settings` > `Manage Database Group`**.
+
+* In this article:
+ * [The Database Group view](../../../studio/database/settings/manage-database-group.mdx#the-database-group-view)
+ * [Node states](../../../studio/database/settings/manage-database-group.mdx#node-states)
+ * [Promotable node](../../../studio/database/settings/manage-database-group.mdx#promotable-node)
+ * [Node in rehab](../../../studio/database/settings/manage-database-group.mdx#node-in-rehab)
+ * [Database group actions](../../../studio/database/settings/manage-database-group.mdx#database-group-actions)
+ * [Reordering nodes](../../../studio/database/settings/manage-database-group.mdx#reordering-nodes)
+ * [Adding a node](../../../studio/database/settings/manage-database-group.mdx#adding-a-node)
+ * [Deleting a node from the group](../../../studio/database/settings/manage-database-group.mdx#deleting-a-node-from-the-group)
+ * [Dynamic database distribution](../../../studio/database/settings/manage-database-group.mdx#dynamic-database-distribution)
+ * [Member node duties](../../../studio/database/settings/manage-database-group.mdx#member-node-duties)
-* Note 1: If the database instance is unable to replicate the data for some reason, it will still accept that data and send it later.
+
-* Note 2: Although not all nodes in the cluster belong to the Database Group, each node in the cluster _has_ a full copy of _all_ Database Group Topologies.
+
-* In this page:
- * [Database Group Topology - View](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view)
- * [Database Group Topology - Actions](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions)
- * [Database Group Topology - Add New Node](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---add-new-node)
- * [Database Group Topology - Members Duties](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)
-
-## Database Group Topology - View
+To manage the database group, open the Database Group view from the database's Settings menu.
-
+
-1. **List of nodes** that are in the Database Group Topology.
- In this example, database _db1_ exists on nodes: A, B, C, D, and E as well.
- Note: There are other nodes defined in the cluster but they do not belong to this database group.
+1. **Settings**
+ Click the gear icon in the left rail to open the Settings menu.
+2. **Manage Database Group**
+ Click to open the Database Group view.
-2. **Tasks** for which a node is responsible for.
- i.e. Node 'A' is responsible for an 'External Replication Task'.
- See more about the database tasks in [Ongoing Tasks](../../../studio/database/tasks/ongoing-tasks/general-info.mdx)
+The Database Group view shows the nodes of the database group and the actions you can take on the group.
-3. A node is marked as ***Rehab*** if it is down or unreachable.
- i.e. Node 'E'
+
-4. This is the **responsible node** that will update the _Rehabed_ node once its up again.
- Once Node 'E' will be up again, Node 'A' will update the database instance on 'E' with all changes that occurred while it was down.
+1. **Settings**
+ Click to turn [dynamic database distribution](../../../studio/database/settings/manage-database-group.mdx#dynamic-database-distribution) on or off.
+2. **Reorder nodes**
+ Click to [change the order](../../../studio/database/settings/manage-database-group.mdx#reordering-nodes) of the nodes in the database group topology.
+ The order matters to clients: by default, a client sends all its requests to the first node in the list,
+ the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node) (node `C` in the above image).
+3. **Add node**
+ Click to [add a cluster node](../../../studio/database/settings/manage-database-group.mdx#adding-a-node) to the database group.
+ The **Add node** button is disabled when all cluster nodes already belong to the database group.
+4. **Node state and promotion status**
+ Each node card shows the node's tag, state, and promotion status.
+ The node cards appear in the order of the database group topology.
+ Learn about node states and promotion statuses in [Node states](../../../studio/database/settings/manage-database-group.mdx#node-states).
+5. **Delete from group**
+ Click to [remove the node](../../../studio/database/settings/manage-database-group.mdx#deleting-a-node-from-the-group) from the database group.
+
+
+Each node of the database group is in one of these [states](../../../server/clustering/distribution/distributed-database.mdx#database-topology):
+`Member`, `Promotable`, or `Rehab`.
+A `Member` node is fully updated and functional, and the node card shows the **Active** promotion status.
+`Promotable` and `Rehab` node cards show additional details, explained below.
-## Database Group Topology - Actions
+
-
+### Promotable node
-1. **Reorder Nodes**
- The order of the nodes is relevant for the client, as it selects which node to contact from this list.
- Click this button to reorder the nodes order.
+When you add a node to the database group, the node joins the group in `Promotable` state.
+Once the node has caught up with the database's data and indexed the data it received,
+the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) will promote the node to `Member` state.
-2. **Add a Node to the database group** - See [below](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---add-new-node)
+
-3. **Settings**
- Open settings to set ***Dynamic Database Distribution***
- When _Dynamic Database Distribution_ is turned on, then once a node is down,
- the cluster observer will handle finding a replacement node in order to maintain database replication factor.
- See [States Flow](../../../server/clustering/distribution/cluster-observer.mdx#states-flow)
+1. **Promotable**
+ The node's state, and its promotion status (**Catching up**).
+ The node tag next to the promotion status names the node's mentor, the member node that sends the node the database's data
+ (**Catching up** `A` in the above image).
+2. **Promote**
+ Click to promote the node to `Member` state immediately, without waiting for the node to catch up.
+ Studio shows this button to users with [Operator](../../../server/security/authorization/security-clearance-and-permissions.mdx#operator)
+ security clearance or higher.
+3. **Error**
+ The latest status message the cluster reported for the node.
+ Studio shows this message under an **Error** label even when the message reports no failure, as in the above image.
+ Click **Error Details** to see the full message.
-4. **Delete From Database Group**
- Deleting the database from the group will:
- 1. Remove the node from the database group topology
- 2. Delete the database from that node, by either:
- **Soft** Delete: The physical file will be kept on the removed node's disk.
- **Hard** Delete: All database files are deleted on this removed node.
- 3. No more replication will occur from the other nodes to this node that is removed.
+
-5. **Full Screen**
- Click to view graph in a full-screen mode. (Esc to exit)
+
+### Node in rehab
+When a member node is down or unreachable for longer than
+[Cluster.TimeBeforeMovingToRehabInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforemovingtorehabinsec)
+(60 seconds by default), the Cluster Observer will change the node's state to `Rehab`.
+The node card will then appear after the member node cards.
+Once the node is reachable again and has caught up with the database group, the observer will promote the node back to `Member` state
+and [randomly reorder](../../../server/clustering/distribution/distributed-database.mdx#nodes-order) the topology list.
-## Database Group Topology - Add New Node
+
-
+1. **Rehab**
+ The node's state, and its promotion status (**Error**).
+ The node tag next to the promotion status names the node's mentor, the member node that will update the node with the changes made while the node was down
+ (**Error** `B` in the above image).
+2. **Error**
+ The reason the node's state was changed to `Rehab`.
+ Click **Error Details** to see the full message.
-1. **Node:**
- Select the cluster Node to add to the Database Group Topology
- Note: Node should be already part of the Cluster Topology. See [Adding a node to the Cluster](../../../studio/cluster/setting-a-cluster.mdx#add-another-node-to-the-cluster)
+
-2. **Preferred Mentor:**
- Check the 'Choose preferred mentor node manually' checkbox in order to specify which node will be the preferred mentor for the newly added node.
- If not checked, then any one of the already existing Member nodes in the group will become the mentor node.
- The preferred mentor will be responsible for updating the new node with all the database data and its state.
- See [Members Duties](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)
+
+
+
-
+### Reordering nodes
-**Note**:
+To change the order of the nodes in the database group topology, click **Reorder nodes** in the Database Group view.
+The view switches to reorder mode.
-* The new node is added as a `Promotable`
-* Once the new node is fully updated and has finished indexing the last data that was sent to it,
- it will be promoted to a full `Member`.
+
+1. **Order toggle**
+ Select what happens to the order when the Cluster Observer promotes a node to `Member` state,
+ for example after a node recovers from `Rehab` state:
+ * **Shuffle nodes order after failure recovery**
+ The observer [randomly reorders](../../../server/clustering/distribution/distributed-database.mdx#nodes-order) the nodes.
+ * **Try to maintain nodes order**
+ The observer puts the member nodes back in the order you set (a [fixed order](../../../client-api/operations/server-wide/reorder-database-members.mdx)).
+ A node that is not a member at the time of the reorder (for example, a node in `Rehab` state) is skipped,
+ and will return to its position once the observer promotes the node back to `Member` state.
+ A member node you did not place in the order (for example, a node added later) is placed after the ordered nodes.
+2. **Node cards**
+ Drag a node card to change the node's position in the topology list.
+3. **Save reorder**
+ Click to save the new order and the selected toggle option.
+4. **Cancel**
+ Click to leave reorder mode without saving.
+
-## Database Group Topology - Members Duties
+
-#### Members Duties Are:
+### Adding a node
-* Replication of the database data to all other nodes in Database Group (Done by ***all*** nodes)
+To add a node to the database group, click **Add node** in the Database Group view.
+The node must already belong to the cluster.
+To learn how to add a node to the cluster, see [Add Another Node to the Cluster](../../../studio/cluster/setting-a-cluster.mdx#add-another-node-to-the-cluster).
-* Becoming a mentor for newly added nodes or nodes that came back from _Rehab_ state
+
-* Be responsible for tasks defined on the database
- i.e. external replication, subscriptions, ETL Replication, Backups, etc.
+1. **Node tag**
+ Select the cluster node to add to the database group.
+2. **Set preferred mentor node**
+ Turn on to select the new node's mentor from the existing member nodes, under **Preferred Mentor**.
+ The mentor sends the new node the database's data and state.
+ When the toggle is off, any existing member node can become the mentor.
+ See [Member node duties](../../../studio/database/settings/manage-database-group.mdx#member-node-duties).
-
+Click **Add node** at the bottom of the dialog to add the node.
+The node joins the database group in `Promotable` state (see [Promotable node](../../../studio/database/settings/manage-database-group.mdx#promotable-node)).
-* Topology changes (i.e. new node in the database group, delete node from Database Group),
-as well as tasks that are defined on the database, are written to the [Database Record](../../../studio/database/settings/database-record.mdx).
-The database record exists in each node in the cluster.
+
-* When a new node is added and a mentor is needed for the new node, or when a new task is added,
- each node in the Database Group checks the Database Record and determines (based on a pre-defined algorithm) if it is the task owner.
-
+
+
+### Deleting a node from the group
+
+To remove a node from the database group, click **Delete from group** on the node card and select a deletion mode.
+
+
+
+Deleting a node from the group will:
+
+* Remove the node from the database group topology.
+* Delete the database from the node, by either:
+ * **Soft Delete**: The database files are kept on the node's disk.
+ * **Hard Delete**: All database files are deleted from the node.
+* Stop replication from the other nodes to the node.
+
+The **Delete from group** button is disabled when the database's delete lock mode prevents deletion
+(see **Delete lock mode** in [Database actions](../../../studio/database/databases-list-view.mdx#database-actions)).
+
+
+
+
+### Dynamic database distribution
+
+To turn dynamic database distribution on or off, click **Settings** in the Database Group view
+and set the **Dynamic database distribution** toggle.
+
+
+
+When dynamic database distribution is on and a node in `Rehab` state has been unavailable for longer than
+[Cluster.TimeBeforeAddingReplicaInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforeaddingreplicainsec)
+(15 minutes by default), the Cluster Observer will add another cluster node to the database group, if one is available,
+to maintain the [replication factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor).
+Learn more in [States flow](../../../server/clustering/distribution/cluster-observer.mdx#states-flow).
+
+
+
+
+
+
+
+Member nodes of the database group carry out these duties:
+
+* **Replicating the database's data**
+ Every member node replicates the database's data to all other member nodes of the group.
+* **Mentoring nodes**
+ Each node in `Promotable` or `Rehab` state gets a member node as its mentor.
+ The mentor sends the node the database's data until the Cluster Observer promotes the node to `Member` state.
+* **Running ongoing tasks**
+ Each [ongoing task](../../../studio/database/tasks/ongoing-tasks/general-info.mdx) defined on the database
+ (e.g., an external replication task, a data subscription, an ETL task, or a periodic backup task)
+ runs on one member node, the task's **responsible node**.
+
+
+
+* Every cluster node keeps a copy of the database group topology and of the definitions of the database's ongoing tasks.
+ The cluster updates every copy whenever the topology changes (e.g., when you add a node to the database group
+ or delete a node from the group) or a task definition changes.
+* When you do not select a mentor node as you add a node, or a responsible node as you define a task,
+ each node of the database group runs a predefined algorithm on the node's copy of the topology
+ to pick the mentor or the responsible node from the member nodes.
+ Since all nodes run the same algorithm over the same topology, they all pick the same member node
+ without communicating with each other.
+
+
+
diff --git a/docs/studio/database/tasks/ongoing-tasks/amazon-sqs-etl.mdx b/docs/studio/database/tasks/ongoing-tasks/amazon-sqs-etl.mdx
index b209630f34..948a65b2e0 100644
--- a/docs/studio/database/tasks/ongoing-tasks/amazon-sqs-etl.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/amazon-sqs-etl.mdx
@@ -62,7 +62,7 @@ import LanguageContent from "@site/src/components/LanguageContent";
3. **Set Responsible Node** (Optional)
* Select a node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx) to be responsible for this task.
- * If no node is selected, the cluster will assign a responsible node (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)).
+ * If you do not select a node, the cluster will assign a responsible node (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
4. **Connection string and Authentication**
The connection string contains the necessary information to connect to an SQS destination.
diff --git a/docs/studio/database/tasks/ongoing-tasks/azure-queue-storage-etl.mdx b/docs/studio/database/tasks/ongoing-tasks/azure-queue-storage-etl.mdx
index fab151d084..b74ad446ba 100644
--- a/docs/studio/database/tasks/ongoing-tasks/azure-queue-storage-etl.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/azure-queue-storage-etl.mdx
@@ -66,7 +66,7 @@ import LanguageContent from "@site/src/components/LanguageContent";
3. **Set Responsible Node** (Optional)
* Select a node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx) to be responsible for this task.
- * If no node is selected, the cluster will assign a responsible node (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)).
+ * If you do not select a node, the cluster will assign a responsible node (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
4. **Create new Azure Queue Storage connection String**
* The connection string contains the necessary information to connect to an Azure storage account.
diff --git a/docs/studio/database/tasks/ongoing-tasks/azure-service-bus-queue-sink.mdx b/docs/studio/database/tasks/ongoing-tasks/azure-service-bus-queue-sink.mdx
index 893bc569d0..7594da9d66 100644
--- a/docs/studio/database/tasks/ongoing-tasks/azure-service-bus-queue-sink.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/azure-service-bus-queue-sink.mdx
@@ -67,7 +67,7 @@ To open the ongoing tasks view:
4. **Set responsible node** (Optional)
* Select a node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx) to be responsible for this task, e.g., node `A`.
- * If no node is selected, the cluster will assign a responsible node (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)).
+ * If you do not select a node, the cluster will assign a responsible node (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
5. **Connection String**
The connection string holds the details RavenDB needs to reach your Azure Service Bus namespace.
diff --git a/docs/studio/database/tasks/ongoing-tasks/elasticsearch-etl-task.mdx b/docs/studio/database/tasks/ongoing-tasks/elasticsearch-etl-task.mdx
index 2cf2368ebc..4a008c55cc 100644
--- a/docs/studio/database/tasks/ongoing-tasks/elasticsearch-etl-task.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/elasticsearch-etl-task.mdx
@@ -60,7 +60,7 @@ To begin creating your Elasticsearch ETL task:
3. **Responsible Node** (Optional)
* Select a node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx) to be responsible for this task.
- * If no node is selected, the cluster will assign a responsible node (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)).
+ * If you do not select a node, the cluster will assign a responsible node (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
4. **Connection String**
* Select an existing connection string from the list or create a new one.
diff --git a/docs/studio/database/tasks/ongoing-tasks/external-replication-task.mdx b/docs/studio/database/tasks/ongoing-tasks/external-replication-task.mdx
index 797d5d957f..dbcbc28e33 100644
--- a/docs/studio/database/tasks/ongoing-tasks/external-replication-task.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/external-replication-task.mdx
@@ -144,7 +144,7 @@ f. Click **External Replication** to access the following interface.
4. **Set Preferred Responsible Node** (Optional)
* Select a preferred mentor node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx) to be the responsible node for this External Replication Task
- * If not selected, then the cluster will assign a responsible node (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties))
+ * If you do not select a node, the cluster will assign a responsible node (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
5. **Create a new RavenDB connection string**
* Select a connection string from the pre-defined list -or- create a new connection string to be used.
diff --git a/docs/studio/database/tasks/ongoing-tasks/general-info.mdx b/docs/studio/database/tasks/ongoing-tasks/general-info.mdx
index 8a8c3a68f9..a5f82431e3 100644
--- a/docs/studio/database/tasks/ongoing-tasks/general-info.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/general-info.mdx
@@ -20,7 +20,7 @@ import ContentFrame from "@site/src/components/ContentFrame";
* Ongoing tasks are **work tasks** defined for the database.
* Each task is assigned a responsible node from the [Database Group nodes](../../../../studio/database/settings/manage-database-group.mdx) to handle the work.
- * If not specified by the user, the cluster decides which node will be responsible for the task. See [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties).
+ * If you do not select a responsible node, the cluster will assign one to the task (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
* If a node is down, the cluster will reassign the work to another node.
* Once enabled, an **ongoing task** runs in the background and executes its defined
diff --git a/docs/studio/database/tasks/ongoing-tasks/kafka-etl-task.mdx b/docs/studio/database/tasks/ongoing-tasks/kafka-etl-task.mdx
index 8ff472f54e..b084c0527d 100644
--- a/docs/studio/database/tasks/ongoing-tasks/kafka-etl-task.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/kafka-etl-task.mdx
@@ -100,7 +100,7 @@ import ContentFrame from "@site/src/components/ContentFrame";
3. **Responsible Node** (Optional)
* Select a node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx) to be responsible for this task.
- * If no node is selected, the cluster will assign a responsible node (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)).
+ * If you do not select a node, the cluster will assign a responsible node (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
4. **Create new Kafka connection String**
* Select an existing connection string from the list or create a new one.
diff --git a/docs/studio/database/tasks/ongoing-tasks/kafka-queue-sink.mdx b/docs/studio/database/tasks/ongoing-tasks/kafka-queue-sink.mdx
index 4daa721d56..553d7de420 100644
--- a/docs/studio/database/tasks/ongoing-tasks/kafka-queue-sink.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/kafka-queue-sink.mdx
@@ -78,8 +78,8 @@ To open the ongoing tasks view:
4. **Responsible Node** (Optional)
* Select a node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx)
to be responsible for this task.
- * If no node is selected, the cluster will assign a responsible node
- (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)).
+ * If you do not select a node, the cluster will assign a responsible node
+ (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
5. **Create a new Kafka connection String**
The connection string defines the source Kafka brokers URLs.
diff --git a/docs/studio/database/tasks/ongoing-tasks/rabbitmq-etl-task.mdx b/docs/studio/database/tasks/ongoing-tasks/rabbitmq-etl-task.mdx
index 751fe8a3a0..4f87654578 100644
--- a/docs/studio/database/tasks/ongoing-tasks/rabbitmq-etl-task.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/rabbitmq-etl-task.mdx
@@ -67,7 +67,7 @@ import LanguageContent from "@site/src/components/LanguageContent";
3. **Set Preferred Responsible Node** (Optional)
* Select a node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx) to be responsible for this task.
- * If no node is selected, the cluster will assign a responsible node (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)).
+ * If you do not select a node, the cluster will assign a responsible node (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
4. **Skip Automatic Exchange/Queue Declaration**
When enabled:
diff --git a/docs/studio/database/tasks/ongoing-tasks/rabbitmq-queue-sink.mdx b/docs/studio/database/tasks/ongoing-tasks/rabbitmq-queue-sink.mdx
index e4616b2d03..7ebe47f5f7 100644
--- a/docs/studio/database/tasks/ongoing-tasks/rabbitmq-queue-sink.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/rabbitmq-queue-sink.mdx
@@ -80,8 +80,8 @@ To open the ongoing tasks view:
4. **Responsible Node** (Optional)
* Select a node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx)
to be responsible for this task.
- * If no node is selected, the cluster will assign a responsible node
- (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)).
+ * If you do not select a node, the cluster will assign a responsible node
+ (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
5. **Create a new RabbitMQ connection String**
The connection string defines the source RabbitMQ brokers URLs.
diff --git a/docs/studio/database/tasks/ongoing-tasks/ravendb-etl-task.mdx b/docs/studio/database/tasks/ongoing-tasks/ravendb-etl-task.mdx
index d025e6cc76..e64fac3d1e 100644
--- a/docs/studio/database/tasks/ongoing-tasks/ravendb-etl-task.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/ravendb-etl-task.mdx
@@ -54,7 +54,7 @@ import ContentFrame from "@site/src/components/ContentFrame";
3. **Set responsible node** (Optional)
Select a preferred node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx) to be the responsible node for this RavenDB ETL task.
- If not selected, then the cluster will assign a responsible node (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)).
+ If you do not select a node, the cluster will assign a responsible node (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
4. **Connection string**
Select an existing connection string from the list or create a new one.
diff --git a/docs/studio/database/tasks/ongoing-tasks/snowflake-etl-task.mdx b/docs/studio/database/tasks/ongoing-tasks/snowflake-etl-task.mdx
index 27ad83e9b0..8abc61b73c 100644
--- a/docs/studio/database/tasks/ongoing-tasks/snowflake-etl-task.mdx
+++ b/docs/studio/database/tasks/ongoing-tasks/snowflake-etl-task.mdx
@@ -60,7 +60,7 @@ import LanguageContent from "@site/src/components/LanguageContent";
3. **Set responsible node** (Optional)
* Select a node from the [Database Group](../../../../studio/database/settings/manage-database-group.mdx) to be responsible for this task.
- * If no node is selected, the cluster will assign a responsible node (see [Members Duties](../../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties)).
+ * If you do not select a node, the cluster will assign a responsible node (see [Member node duties](../../../../studio/database/settings/manage-database-group.mdx#member-node-duties)).
4. **Connection String**
The connection string defines the location of the destination warehouse.
diff --git a/versioned_docs/version-6.2/client-api/configuration/load-balance/overview.mdx b/versioned_docs/version-6.2/client-api/configuration/load-balance/overview.mdx
index fee668b5de..07bdb9340e 100644
--- a/versioned_docs/version-6.2/client-api/configuration/load-balance/overview.mdx
+++ b/versioned_docs/version-6.2/client-api/configuration/load-balance/overview.mdx
@@ -5,11 +5,7 @@ sidebar_position: 0
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
# Load balancing client requests - Overview
@@ -17,89 +13,98 @@ import LanguageContent from "@site/src/components/LanguageContent";
* A database can have multiple instances, each one residing on a different cluster node.
Each instance is a complete replica of the database.
-* The [database-group-topology](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view) is the list of nodes that contain those database replicas.
+* The [database group topology](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view) is the list of nodes that contain the database's replicas.
The first node in this list is called the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node).
* The client is kept up-to-date with this topology list.
- __The client decides which node from this list to access__ when making requests to the RavenDB cluster.
+ **The client decides which node from this list to access** when making requests to the RavenDB cluster.
* By default, the client will access the preferred node for all _Read & Write_ requests it makes.
This default behavior can be changed by configuring:
* [ReadBalanceBehavior](../../../client-api/configuration/load-balance/read-balance-behavior.mdx) - load balancing `Read` requests only
* [LoadBalanceBehavior](../../../client-api/configuration/load-balance/load-balance-behavior.mdx) - load balancing `Read & Write` requests
-* In this page:
- * [Keeping the client topology up-to-date](../../../client-api/configuration/load-balance/overview.mdx#keeping-the-client-topology-up-to-date)
- * [Client logic for choosing a node](../../../client-api/configuration/load-balance/overview.mdx#client-logic-for-choosing-a-node)
- * [The preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
- * [Single-node session usage](../../../client-api/configuration/load-balance/overview.mdx#single-node-session-usage)
-
+
+* In this article:
+ * [Keeping the client topology up-to-date](../../../client-api/configuration/load-balance/overview.mdx#keeping-the-client-topology-up-to-date)
+ * [Client logic for choosing a node](../../../client-api/configuration/load-balance/overview.mdx#client-logic-for-choosing-a-node)
+ * [The preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
+ * [Single-node session usage](../../../client-api/configuration/load-balance/overview.mdx#single-node-session-usage)
+
-## Keeping the client topology up-to-date
-* Upon Document Store initialization, the client receives the __initial topology list__,
+
+
+* Upon Document Store initialization, the client receives the **initial topology list**,
after which the client is kept updated at all times for any changes made to it.
-* If the topology list has changed on the server, (or any other client configuration),
- the client will learn about it upon making its __next request__ to the server,
+* If the topology list (or any other client configuration) has changed on the server,
+ the client will learn about the change from the server's response to its **next request**,
and will update its configuration accordingly.
* In addition, every 5 minutes, the client will fetch the current topology from the server
if no requests were made within that time frame.
-* Any client-configuration settings that are set on the server side __override__ the settings made on the client-side.
+* Any client-configuration settings that are set on the server side **override** the settings made on the client side.
* For more information see [Topology in the client](../../../client-api/cluster/how-client-integrates-with-replication-and-cluster.mdx#cluster-topology-in-the-client).
+
-
-## Client logic for choosing a node
+
The client uses the following logic (from top to bottom) to determine which node to send the request to:
-* Use the __specified node__:
+* Use the **specified node**:
A client can explicitly specify the target node when executing a [server-maintenance operation](../../../client-api/operations/what-are-operations.mdx#server-maintenance-operations).
- Learn more in [switch operation to a different node](../../../client-api/operations/how-to/switch-operations-to-a-different-node.mdx).
-* Else, if using-session-context is defined, use __LoadBalanceBehavior__:
+ Learn more in [Switch Operations to a Different Node](../../../client-api/operations/how-to/switch-operations-to-a-different-node.mdx).
+* Else, if **LoadBalanceBehavior** is set to `UseSessionContext`, use the session context:
Per session, the client will select a node based on the [session context](../../../client-api/configuration/load-balance/load-balance-behavior.mdx#loadbalancebehavior-options).
- All `Read & Write` requests made on the session will be directed to that node.
-* Else, if defined, use __ReadBalanceBehavior__:
+ All `Read & Write` requests made on the session will be directed to the selected node.
+* Else, if defined, use **ReadBalanceBehavior**:
`Read` requests: The client will select a node based on the [read balance options](../../../client-api/configuration/load-balance/read-balance-behavior.mdx#readbalancebehavior-options).
- `Write` requests: All _Write_ requests will be directed to the preferred node.
-* Else, use the __preferred node__:
+ `Write` requests: All _Write_ requests will be directed to the preferred node.
+* Else, use the **preferred node**:
Use the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node) for both `Read & Write` requests.
+
+
-## The preferred node
-
-* The preferred node is simply the __first__ node in the [topology nodes list](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view).
-* __By default__, when no load balancing strategy is defined,
+* The preferred node is the **first** node in the [topology list](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view).
+* **By default**, when no load balancing strategy is defined,
the client will send all `Read & Write` requests to this node.
-* When the preferred node is in a failure state,
- the cluster will update the topology, assigning another node to be the preferred one.
+* When the preferred node is in a failure state,
+ the client will send its requests to the first node in the topology list that is not in a failure state.
+ If the failed node stays down, the cluster will change the node's state to `Rehab` and move it to the end of the list,
+ so the second node in the list will become the preferred node.
* Once the preferred node is back up and has caught up with all data,
- it will be placed __last__ in the topology list.
-* If all the nodes in the topology list are in a failure state then the first node in the list will be the 'preferred'.
- The user would get an error, or recover if the error was transient.
+ the cluster will [randomly reorder](../../../server/clustering/distribution/distributed-database.mdx#nodes-order) the topology list of every database the recovered node hosts,
+ so the node may be placed anywhere in each list.
+ As a result, the preferred-node role of the node's databases will be spread among the cluster's nodes,
+ instead of remaining with the nodes that stayed up.
+ * If you set a [fixed order](../../../client-api/operations/server-wide/reorder-database-members.mdx) for the topology list, the cluster will restore the fixed order instead,
+ and the recovered node will return to its position in the fixed order.
+* If all the nodes in the topology list are in a [failure state](../../../client-api/cluster/how-client-integrates-with-replication-and-cluster.mdx#failover-behavior),
+ the client will send each request to the next node in the list, in turn.
+ The request will fail, unless the node it is sent to has recovered (e.g., from a temporary network outage).
* The preferred node can be explicitly set by:
* Reordering the topology list from the [Database Group view](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
* Sending [ReorderDatabaseMembersOperation](../../../client-api/operations/server-wide/reorder-database-members.mdx) from the client code.
-* The cluster may assign a different preferred node when removing/adding new nodes to the database-group.
-
+* The cluster may assign a different preferred node when nodes join the database group or leave it.
+
-## Single-node session usage
+
* When using a [single-node session](../../../client-api/session/cluster-transaction/overview.mdx#single-node),
- a short delay in replicating changes to all nodes in the cluster is acceptable in most cases.
+ a short delay in replicating changes to all nodes in the cluster is acceptable in most cases.
* If `ReadBalanceBehavior` or `LoadBalanceBehavior` are defined,
then the next session you open may access a different node.
So if you need to ensure that the next request will be able to _immediately_ read what you just wrote,
then use [Write Assurance](../../../client-api/session/saving-changes.mdx#waiting-for-replication---write-assurance).
-
-
+
diff --git a/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx b/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
index 58de528cdf..e013e66c99 100644
--- a/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
+++ b/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
@@ -1,53 +1,89 @@
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-**ReorderDatabaseMembersOperation** allows you to change the order of nodes in the [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
-## Syntax
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
-
-
-{`public ReorderDatabaseMembersOperation(string database, List order)
-`}
-
-
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixedTopology` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
-| Parameters | | |
-| ------------- | ------------- | ----- |
-| **database** | string | Name of a database to operate on |
-| **order** | List\<string> | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `ArgumentException` is the reordered list doesn't correspond to the existing nodes of the database group |
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
-## Example I
+
-
-
-{`// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+
+#### Example: Set a new order
+
+```csharp
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
// Change the order of database group nodes to : ["C", "A", "B"]
store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind",
new List
- \{
+ {
"C", "A", "B"
- \}));
-`}
-
-
+ }));
+```
+
+
-## Example II
+
-
-
-{`// Get the current DatabaseTopology from database record
+#### Example: Reverse the current order
+
+```csharp
+// Get the current DatabaseTopology from database record
var topology = store.Maintenance.Server.Send(new GetDatabaseRecordOperation("Northwind")).Topology;
// Reverse the order of database group nodes
topology.Members.Reverse();
store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind", topology.Members));
-`}
-
-
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```csharp
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind",
+ new List
+ {
+ "C", "A", "B"
+ },
+ fixedTopology: true));
+```
+
+
+
+
+
+
+
+```csharp
+public ReorderDatabaseMembersOperation(string database, List order)
+
+public ReorderDatabaseMembersOperation(string database, List order, bool fixedTopology)
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `string` | Name of a database to operate on |
+| **order** | `List` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `ArgumentException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixedTopology** | `bool` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (the first constructor's value): the order may change later, and the server clears any fixed order set earlier. |
+
diff --git a/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-java.mdx b/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-java.mdx
new file mode 100644
index 0000000000..f5d94f6b0f
--- /dev/null
+++ b/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-java.mdx
@@ -0,0 +1,83 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```java
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+// Change the order of database group nodes to : ["C", "A", "B"]
+
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind",
+ Arrays.asList("C", "A", "B")));
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```java
+// Get the current DatabaseTopology from database record
+DatabaseTopology topology = store.maintenance().server().send(new GetDatabaseRecordOperation("Northwind")).getTopology();
+
+// Reverse the order of database group nodes
+Collections.reverse(topology.getMembers());
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind", topology.getMembers()));
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```java
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind",
+ Arrays.asList("C", "A", "B"),
+ true));
+```
+
+
+
+
+
+
+
+```java
+public ReorderDatabaseMembersOperation(String database, List order)
+
+public ReorderDatabaseMembersOperation(String database, List order, boolean fixed)
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `String` | Name of a database to operate on |
+| **order** | `List` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `boolean` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (the first constructor's value): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx b/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx
new file mode 100644
index 0000000000..a1fd36a0c0
--- /dev/null
+++ b/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx
@@ -0,0 +1,82 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```js
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+// Change the order of database group nodes to : ["C", "A", "B"]
+
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"]));
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```js
+// Get the current DatabaseTopology from database record
+const databaseRecord = await store.maintenance.server.send(new GetDatabaseRecordOperation("Northwind"));
+const members = databaseRecord.topology.members;
+
+// Reverse the order of database group nodes
+members.reverse();
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind", members));
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```js
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"],
+ true));
+```
+
+
+
+
+
+
+
+```js
+const operation = new ReorderDatabaseMembersOperation(database, order, fixed?);
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `string` | Name of a database to operate on |
+| **order** | `string[]` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `boolean` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (default): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-python.mdx b/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-python.mdx
new file mode 100644
index 0000000000..4f2e7c081d
--- /dev/null
+++ b/versioned_docs/version-6.2/client-api/operations/server-wide/content/_reorder-database-members-python.mdx
@@ -0,0 +1,83 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `True`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```python
+# Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+# Change the order of database group nodes to : ["C", "A", "B"]
+
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"]))
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```python
+# Get the current topology from database record
+topology = store.maintenance.server.send(GetDatabaseRecordOperation("Northwind")).topology
+members = topology["Members"]
+
+# Reverse the order of database group nodes
+members.reverse()
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind", members))
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```python
+# Set the order of database group nodes to ["C", "A", "B"],
+# and keep this order when the Cluster Observer reorders the nodes
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"],
+ fixed=True))
+```
+
+
+
+
+
+
+
+```python
+class ReorderDatabaseMembersOperation(VoidServerOperation):
+ def __init__(self, database: str = None, order: List[str] = None, fixed: bool = False): ...
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `str` | Name of a database to operate on |
+| **order** | `List[str]` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `bool` | `True`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`False` (default): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/versioned_docs/version-6.2/client-api/operations/server-wide/reorder-database-members.mdx b/versioned_docs/version-6.2/client-api/operations/server-wide/reorder-database-members.mdx
index 9edbcb0ad3..fed98069ad 100644
--- a/versioned_docs/version-6.2/client-api/operations/server-wide/reorder-database-members.mdx
+++ b/versioned_docs/version-6.2/client-api/operations/server-wide/reorder-database-members.mdx
@@ -1,15 +1,17 @@
---
-title: "Operations: Server: How to reoder database members?"
+title: "Operations: Server: How to reorder database members?"
sidebar_label: Reorder Database Members
sidebar_position: 10
-supported_languages: ["csharp"]
+supported_languages: ["csharp", "java", "python", "nodejs"]
---
import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
import LanguageContent from "@site/src/components/LanguageContent";
import ReorderDatabaseMembersCsharp from './content/_reorder-database-members-csharp.mdx';
-
+import ReorderDatabaseMembersJava from './content/_reorder-database-members-java.mdx';
+import ReorderDatabaseMembersPython from './content/_reorder-database-members-python.mdx';
+import ReorderDatabaseMembersNodejs from './content/_reorder-database-members-nodejs.mdx';
@@ -17,7 +19,14 @@ import ReorderDatabaseMembersCsharp from './content/_reorder-database-members-cs
+
+
+
-
+
+
+
diff --git a/versioned_docs/version-6.2/server/clustering/distribution/distributed-database.mdx b/versioned_docs/version-6.2/server/clustering/distribution/distributed-database.mdx
index 903275f53f..ad2dc66d2a 100644
--- a/versioned_docs/version-6.2/server/clustering/distribution/distributed-database.mdx
+++ b/versioned_docs/version-6.2/server/clustering/distribution/distributed-database.mdx
@@ -5,11 +5,8 @@ sidebar_position: 0
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
# Distributed Database
@@ -17,21 +14,24 @@ import LanguageContent from "@site/src/components/LanguageContent";
* In RavenDB, a database can be replicated across multiple nodes, depending on its [Replication Factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor).
* A node where a database resides is referred to as a `Database Node`.
- The group of _Database Nodes_ that assemble the distributed database, is called a [Database Group](../../../studio/database/settings/manage-database-group.mdx).
+ The group of _Database Nodes_ that assemble the distributed database is called a [Database Group](../../../studio/database/settings/manage-database-group.mdx).
* Unless [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding) is employed,
each Database Node has a **full copy** of the database, containing **all** the database documents, and indexes them **locally**.
This greatly simplifies executing query requests, as there is no need to aggregate data from multiple nodes.
-
-* In this page:
- * [The Database Record](../../../server/clustering/distribution/distributed-database.mdx#the-database-record)
- * [Replication Factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor)
- * [Database Topology](../../../server/clustering/distribution/distributed-database.mdx#database-topology)
- * [Dynamic Database Distribution](../../../server/clustering/distribution/distributed-database.mdx#dynamic-database-distribution)
- * [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding)
+
+* In this article:
+ * [The database record](../../../server/clustering/distribution/distributed-database.mdx#the-database-record)
+ * [Replication factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor)
+ * [Database topology](../../../server/clustering/distribution/distributed-database.mdx#database-topology)
+ * [States flow](../../../server/clustering/distribution/distributed-database.mdx#states-flow)
+ * [Nodes order](../../../server/clustering/distribution/distributed-database.mdx#nodes-order)
+ * [Dynamic database distribution](../../../server/clustering/distribution/distributed-database.mdx#dynamic-database-distribution)
+ * [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding)
-## The Database Record
+
+
Each database instance keeps its configuration (e.g. Index definitions, Database topology) in a [Database Record](../../../client-api/operations/server-wide/create-database.mdx) object.
Upon database creation, this object is propagated through Rachis to all nodes in the cluster.
@@ -39,9 +39,9 @@ Upon database creation, this object is propagated through Rachis to all nodes in
After that, each node updates its own `Database Record` independently upon receiving any new Raft command,
e.g. when an index has changed.
+
-
-## Replication Factor
+
When creating a database, you can either:
@@ -52,11 +52,11 @@ When creating a database, you can either:
In either case, the number of nodes will represent the `Replication Factor`.
Once the database is created by getting a [Consensus](../../../server/clustering/rachis/consensus-operations.mdx),
-the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) begins monitoring the _Database Group_ in order to maintain this Replication Factor.
+the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) begins monitoring the _Database Group_ to maintain this Replication Factor.
+
-
-## Database Topology
+
The `Database Topology` describes the relationships between the Database Nodes within the [Database Group](../../../studio/database/settings/manage-database-group.mdx).
Each **Database Node** can be in one of the following states:
@@ -67,48 +67,60 @@ Each **Database Node** can be in one of the following states:
| **Promotable** | A node that has been recently added to the group and is being updated. |
| **Rehab** | A former Member node that is assumed to be _not_ up-to-date due to a partition. |
-
+
+
+All `Members` have master-master [Replication](../../../server/clustering/replication/replication-overview.mdx) to keep the documents in sync across the nodes.
+
+
+
+
+
+### States flow
* In general, all nodes in a newly created database are in a `Member` state.
-* When adding a new Database Node to an already existing database group, a `Mentor Node` is selected in order to update it.
+* When you add a new Database Node to an existing database group, a `Member` node becomes the new node's `Mentor Node` and updates the new node.
The new node will be in a `Promotable` state until it receives _and_ indexes all the documents from the mentor node.
* Learn more in:
* [Cluster node types](../../../studio/cluster/cluster-view.mdx#cluster-nodes-types)
* [Cluster node states and types flow](../../../studio/cluster/cluster-view.mdx#cluster-nodes-states--types-flow)
-
+
-
+
+
+### Nodes order
* The database topology is kept in a list that is always ordered with `Member` nodes first,
- then `Rehabs` and `Promotables` are last.
+ then `Rehabs` and `Promotables` are last.
* The order is important since it defines the client's order of access into the Database Group,
(see [Load balancing client requests](../../../client-api/configuration/load-balance/overview.mdx)).
-* The order can be modified using the [Client-API](../../../client-api/operations/server-wide/reorder-database-members.mdx)
- or via the [Studio](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
-
-
+* You can modify the order using the [client API](../../../client-api/operations/server-wide/reorder-database-members.mdx)
+ or [Studio](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
+ When you modify the order, you can set the new order as fixed.
+* When the Cluster Observer promotes a database node to `Member` (a newly added node, or a node that has recovered from `Rehab`),
+ the observer randomly reorders the `Member` nodes in the database's topology list.
+ A recovered node is promoted in every database the node hosts, so the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
+ role of these databases is spread among the cluster's nodes instead of remaining with the nodes that stayed up.
+ * If you set the order as fixed, the observer restores the fixed order after the random reorder.
-
-
-All `Members` have master-master [Replication](../../../server/clustering/replication/replication-overview.mdx) in order to keep the documents in sync across the nodes.
+
-
+
-
-## Dynamic Database Distribution
+
If any of the `Database Nodes` is down or partitioned, the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) will recognize it and act as follows:
1. If the time that is defined in [TimeBeforeMovingToRehabInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforemovingtorehabinsec) (default: 60 seconds) has passed
- and the node is still unreachable, the node will be moved to a `Rehab` state.
-
-2. If the node remains in `Rehab` for the time defined in [TimeBeforeAddingReplicaInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforeaddingreplicainsec) (default: 900 seconds),
- a new database node will be automatically added to the database group to replace the `Rehab` node.
+ and the node is still unreachable, the observer will change the node's state to `Rehab`.
+
+2. If dynamic database distribution is on and the node remains in `Rehab` state for the time defined in
+ [TimeBeforeAddingReplicaInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforeaddingreplicainsec) (default: 900 seconds),
+ the observer will add another cluster node to the database group to replace the `Rehab` node, if a suitable cluster node is available.
-3. If the `Rehab` node is online again, it will be assigned a [Mentor Node](../../../server/clustering/distribution/highly-available-tasks.mdx#responsible-node) to update it with the recent changes.
+3. If the `Rehab` node is online again, it will be assigned a [Mentor Node](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties) to update it with the recent changes.
-4. The first node to be up-to-date stays, while the other is deleted.
+4. If a replacement node was added in step 2, the first of the two nodes to be up-to-date stays, while the other is deleted.
@@ -117,20 +129,21 @@ and only AFTER it has finished sending all new documents it may have (while disc
-The _Dynamic Database Distribution_ feature can be toggled on and off with the following request:
+To turn dynamic database distribution on or off, use the
+[SetDatabaseDynamicDistributionOperation](../../../client-api/operations/server-wide/toggle-dynamic-database-distribution.mdx) client API operation,
+[Studio](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions), or the following request:
| URL | Method | URL Params |
|--------------------------------------------|----------|-----------------------------------------|
| /admin/databases/dynamic-node-distribution | `POST` | name=[`database-name`], enable=[`bool`] |
+
-
-## Sharding
+
* Sharding, supported by RavenDB as an out-of-the-box solution starting with version **6.0**,
is the distribution of a database's content across autonomous shards.
* Learn more about sharding in this dedicated [Sharding overview](../../../sharding/overview.mdx) article.
-
-
+
diff --git a/versioned_docs/version-6.2/sharding/external-replication.mdx b/versioned_docs/version-6.2/sharding/external-replication.mdx
index 90e8c80962..f565ffcca2 100644
--- a/versioned_docs/version-6.2/sharding/external-replication.mdx
+++ b/versioned_docs/version-6.2/sharding/external-replication.mdx
@@ -5,74 +5,72 @@ sidebar_position: 9
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
# Sharding: External Replication
-* [External Replication](../server/ongoing-tasks/external-replication.mdx) is an
- ongoing RavenDB task that you can create and run to maintain a live replica
+* [External Replication](../server/ongoing-tasks/external-replication.mdx) is an
+ ongoing RavenDB task that you can create and run to maintain a live replica
of your database on another RavenDB server.
-* Defining an external replication task via [Studio](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#definition)
- or [API](../server/ongoing-tasks/external-replication.mdx#code-sample) under a
+* Defining an external replication task via [Studio](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#definition)
+ or [API](../server/ongoing-tasks/external-replication.mdx#code-sample) under a
sharded database is similar to defining such tasks under a non-sharded database.
-* Sharded and non-sharded databases can replicate data to each other, providing
- their version is at least 6.0.
+* Sharded and non-sharded databases can replicate data to each other, provided that the non-sharded databases
+ are of version 5.4 or higher.
-* In this page:
- * [Supported Versions](../sharding/external-replication.mdx#supported-versions)
- * [External Replication Types](../sharding/external-replication.mdx#external-replication-types)
- * [Non-Sharded Database to Sharded Database](../sharding/external-replication.mdx#non-sharded-database-to-sharded-database)
- * [Sharded Database to Sharded Database](../sharding/external-replication.mdx#sharded-database-to-sharded-database)
- * [Performance Considerations](../sharding/external-replication.mdx#performance-considerations)
+* In this article:
+ * [Supported versions](../sharding/external-replication.mdx#supported-versions)
+ * [External replication types](../sharding/external-replication.mdx#external-replication-types)
+ * [Non-sharded database to sharded database](../sharding/external-replication.mdx#non-sharded-database-to-sharded-database)
+ * [Sharded database to sharded database](../sharding/external-replication.mdx#sharded-database-to-sharded-database)
+ * [Performance considerations](../sharding/external-replication.mdx#performance-considerations)
-## Supported Versions
-* A sharded database and a non-sharded database **can** replicate data to each
- other, providing their versions are 6.0 or higher.
-* Replicating data between a sharded database and a RavenDB version earlier
+
+
+* A sharded database and a non-sharded database **can** replicate data to each other, provided that the non-sharded database
+ is of version 5.4 or higher.
+* Replicating data between a sharded database and a RavenDB version earlier
than 5.4 is **not supported**.
-* Non-sharded databases **can** replicate data to each other regardless of
- their version. E.g., a non-sharded 6.0 database can replicate data to a 5.2
+* Non-sharded databases **can** replicate data to each other regardless of
+ their version. E.g., a non-sharded 6.0 database can replicate data to a 5.2
database and vice versa.
+
-
-## External Replication Types
+
-* **Internal replication** is applied automatically when the replication
- factor is larger than 1, to make the shard database more available by
+* **Internal replication** is applied automatically when the replication
+ factor is larger than 1, to make the shard database more available by
maintaining multiple accessible copies of it.
- Learn more about shards internal replication in the [overview](../sharding/overview.mdx#shard-replication)
- article and administration [Studio](../sharding/administration/studio-admin.mdx)
+ Learn more about shards internal replication in the [overview](../sharding/overview.mdx#shard-replication)
+ article and administration [Studio](../sharding/administration/studio-admin.mdx)
and [API](../sharding/administration/api-admin.mdx) articles.
* **External replication** is applied when a dedicated task is defined for it.
- Read more about it and follow a step-by-step guide
- [here](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#step-by-step-guide).
+ To learn more about external replication and follow a step-by-step guide,
+ see [External Replication Task](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#step-by-step-guide).
-All data replicated by or to a sharded database is mediated via
-[orchestrators](../sharding/overview.mdx#client-server-communication).
-The shards themselves are oblivious to their being shards: from
-a shard's perspective, it is just a regular RavenDB database that
+All data replicated to a sharded database is mediated via
+[orchestrators](../sharding/overview.mdx#client-server-communication).
+The shards themselves are oblivious to their being shards: from
+a shard's perspective, it is just a regular RavenDB database that
can, among its other ordinary RavenDB features, replicate data.
-External replication from and to non-sharded databases requires
-no special syntax or preparations. It does, however, cost the server
-some additional work, that, especially when the database is large
-and every extra operation counts, should be taken into account by
-the administrator. Here is how external replication works behind
-the scenes.
+External replication from and to sharded databases requires no special syntax or preparations.
+It does, however, cost the server some additional work. Take this additional work into account,
+especially when the database is large and every extra operation counts.
+Here is how external replication works behind the scenes.
-## Non-Sharded Database to Sharded Database
+
+
+### Non-sharded database to sharded database
The image below depicts a non-sharded database replicating data to a 5-shard database.
@@ -80,22 +78,26 @@ The image below depicts a non-sharded database replicating data to a 5-shard dat
1. **Non-Sharded Database**
2. **Replication to Sharded Database**
- The database is unaware that the destination database is sharded,
- no special syntax or preparation is needed.
+ The database is unaware that the destination database is sharded,
+ so no special syntax or preparation is needed.
3. **Orchestrator**
- The orchestrator receives and prepares the replicated data,
- grouping documents and document extensions by document IDs so each
+ The orchestrator receives and prepares the replicated data,
+ grouping documents and document extensions by document IDs so each
entity can be stored in the correct shard.
4. **Transfer to Shard**
The orchestrator transfers each destination shard its data.
- Optimization routines are applied to make the process as
+ Optimization routines are applied to make the process as
effective as possible.
5. **Shard**
- Document and document extensions are assigned to buckets by document ID.
- Shard replies to replicated data and replication attempts are similar
+ Documents and document extensions are assigned to buckets by document ID.
+ Shard replies to replicated data and replication attempts are similar
to replies made by non-sharded databases.
-## Sharded Database to Sharded Database
+
+
+
+
+### Sharded database to sharded database
* The image below depicts a 3-shard database replicating data to a 5-shard database.
* Each shard replicates its data as an autonomous database.
@@ -105,33 +107,55 @@ The image below depicts a non-sharded database replicating data to a 5-shard dat
1. **DB 1 Shard**
The shard is unaware that the destination database is sharded.
2. **Replication to DB 2**
- The database is unaware that the destination database is sharded,
- no special syntax or preparation is needed.
+ The database is unaware that the destination database is sharded,
+ so no special syntax or preparation is needed.
3. **DB 2 Orchestrator**
- The orchestrator receives and prepares the replicated data,
- grouping documents and document extensions by document IDs so each
+ The orchestrator receives and prepares the replicated data,
+ grouping documents and document extensions by document IDs so each
entity can be stored in the correct shard.
4. **Transfer to Shard**
The orchestrator transfers each destination shard its data.
- Optimization routines are applied to make the process as
+ Optimization routines are applied to make the process as
effective as possible.
5. **DB 2 Shard**
Documents and document extensions are assigned to buckets by document ID.
- Shard replies to replicated data and replication attempts are similar
+ Shard replies to replicated data and replication attempts are similar
to replies made by non-sharded databases.
+
+
+
+
-## Performance Considerations
+When two databases replicate data to each other, whether they are sharded or not, the target database sends each data item it receives
+back to the original sender. The original sender recognizes that the data item is already stored locally, ignores the data item, and
+ends the cycle.
-When external replication tasks are defined in two different sharded databases,
-so they replicate their data to each other, each data item sent from one of the
-databases to the other will then be sent back from the target database to the
-original sender. The original sender will then recognize that the data item is
-already stored locally, ignore it, and end the cycle.
+The data items that the target database sends back depend on the target database type:
-In this specific case, of two external databases replicating data to each other,
-please consider this overhead in your performance considerations and tests.
+* **Non-sharded target database**
+ The database sends back only the data items it receives while its replication task to the original sender is running.
+* **Sharded target database**
+ The database sends back every data item it received from the original sender, regardless of when it received the data item.
+Each shard adds its own entry to the [change vector](../server/clustering/replication/change-vector.mdx) of every data item it receives
+by external replication. When the sharded database replicates data onward to another database, the sharded database uses the shards'
+entries to send the destination every data item from every shard, so no data item is lost.
+The original sender's [global change vector](../server/clustering/replication/change-vector.mdx#database-global-change-vector) does not
+include the shards' entries, so the sharded database sends every data item received from the original sender back to the original sender.
+For example:
+
+* A non-sharded database replicates 1,000 documents to a sharded database.
+* You then create a replication task from the sharded database back to the non-sharded database.
+* The sharded database will send all 1,000 documents back to the non-sharded database
+ (whereas a non-sharded target database would send back none of the 1,000 documents).
+
+
+
+Take the additional replication traffic into account in your performance planning and tests.
+
+
+
diff --git a/versioned_docs/version-7.0/client-api/configuration/load-balance/overview.mdx b/versioned_docs/version-7.0/client-api/configuration/load-balance/overview.mdx
index fee668b5de..07bdb9340e 100644
--- a/versioned_docs/version-7.0/client-api/configuration/load-balance/overview.mdx
+++ b/versioned_docs/version-7.0/client-api/configuration/load-balance/overview.mdx
@@ -5,11 +5,7 @@ sidebar_position: 0
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
# Load balancing client requests - Overview
@@ -17,89 +13,98 @@ import LanguageContent from "@site/src/components/LanguageContent";
* A database can have multiple instances, each one residing on a different cluster node.
Each instance is a complete replica of the database.
-* The [database-group-topology](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view) is the list of nodes that contain those database replicas.
+* The [database group topology](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view) is the list of nodes that contain the database's replicas.
The first node in this list is called the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node).
* The client is kept up-to-date with this topology list.
- __The client decides which node from this list to access__ when making requests to the RavenDB cluster.
+ **The client decides which node from this list to access** when making requests to the RavenDB cluster.
* By default, the client will access the preferred node for all _Read & Write_ requests it makes.
This default behavior can be changed by configuring:
* [ReadBalanceBehavior](../../../client-api/configuration/load-balance/read-balance-behavior.mdx) - load balancing `Read` requests only
* [LoadBalanceBehavior](../../../client-api/configuration/load-balance/load-balance-behavior.mdx) - load balancing `Read & Write` requests
-* In this page:
- * [Keeping the client topology up-to-date](../../../client-api/configuration/load-balance/overview.mdx#keeping-the-client-topology-up-to-date)
- * [Client logic for choosing a node](../../../client-api/configuration/load-balance/overview.mdx#client-logic-for-choosing-a-node)
- * [The preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
- * [Single-node session usage](../../../client-api/configuration/load-balance/overview.mdx#single-node-session-usage)
-
+
+* In this article:
+ * [Keeping the client topology up-to-date](../../../client-api/configuration/load-balance/overview.mdx#keeping-the-client-topology-up-to-date)
+ * [Client logic for choosing a node](../../../client-api/configuration/load-balance/overview.mdx#client-logic-for-choosing-a-node)
+ * [The preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
+ * [Single-node session usage](../../../client-api/configuration/load-balance/overview.mdx#single-node-session-usage)
+
-## Keeping the client topology up-to-date
-* Upon Document Store initialization, the client receives the __initial topology list__,
+
+
+* Upon Document Store initialization, the client receives the **initial topology list**,
after which the client is kept updated at all times for any changes made to it.
-* If the topology list has changed on the server, (or any other client configuration),
- the client will learn about it upon making its __next request__ to the server,
+* If the topology list (or any other client configuration) has changed on the server,
+ the client will learn about the change from the server's response to its **next request**,
and will update its configuration accordingly.
* In addition, every 5 minutes, the client will fetch the current topology from the server
if no requests were made within that time frame.
-* Any client-configuration settings that are set on the server side __override__ the settings made on the client-side.
+* Any client-configuration settings that are set on the server side **override** the settings made on the client side.
* For more information see [Topology in the client](../../../client-api/cluster/how-client-integrates-with-replication-and-cluster.mdx#cluster-topology-in-the-client).
+
-
-## Client logic for choosing a node
+
The client uses the following logic (from top to bottom) to determine which node to send the request to:
-* Use the __specified node__:
+* Use the **specified node**:
A client can explicitly specify the target node when executing a [server-maintenance operation](../../../client-api/operations/what-are-operations.mdx#server-maintenance-operations).
- Learn more in [switch operation to a different node](../../../client-api/operations/how-to/switch-operations-to-a-different-node.mdx).
-* Else, if using-session-context is defined, use __LoadBalanceBehavior__:
+ Learn more in [Switch Operations to a Different Node](../../../client-api/operations/how-to/switch-operations-to-a-different-node.mdx).
+* Else, if **LoadBalanceBehavior** is set to `UseSessionContext`, use the session context:
Per session, the client will select a node based on the [session context](../../../client-api/configuration/load-balance/load-balance-behavior.mdx#loadbalancebehavior-options).
- All `Read & Write` requests made on the session will be directed to that node.
-* Else, if defined, use __ReadBalanceBehavior__:
+ All `Read & Write` requests made on the session will be directed to the selected node.
+* Else, if defined, use **ReadBalanceBehavior**:
`Read` requests: The client will select a node based on the [read balance options](../../../client-api/configuration/load-balance/read-balance-behavior.mdx#readbalancebehavior-options).
- `Write` requests: All _Write_ requests will be directed to the preferred node.
-* Else, use the __preferred node__:
+ `Write` requests: All _Write_ requests will be directed to the preferred node.
+* Else, use the **preferred node**:
Use the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node) for both `Read & Write` requests.
+
+
-## The preferred node
-
-* The preferred node is simply the __first__ node in the [topology nodes list](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view).
-* __By default__, when no load balancing strategy is defined,
+* The preferred node is the **first** node in the [topology list](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view).
+* **By default**, when no load balancing strategy is defined,
the client will send all `Read & Write` requests to this node.
-* When the preferred node is in a failure state,
- the cluster will update the topology, assigning another node to be the preferred one.
+* When the preferred node is in a failure state,
+ the client will send its requests to the first node in the topology list that is not in a failure state.
+ If the failed node stays down, the cluster will change the node's state to `Rehab` and move it to the end of the list,
+ so the second node in the list will become the preferred node.
* Once the preferred node is back up and has caught up with all data,
- it will be placed __last__ in the topology list.
-* If all the nodes in the topology list are in a failure state then the first node in the list will be the 'preferred'.
- The user would get an error, or recover if the error was transient.
+ the cluster will [randomly reorder](../../../server/clustering/distribution/distributed-database.mdx#nodes-order) the topology list of every database the recovered node hosts,
+ so the node may be placed anywhere in each list.
+ As a result, the preferred-node role of the node's databases will be spread among the cluster's nodes,
+ instead of remaining with the nodes that stayed up.
+ * If you set a [fixed order](../../../client-api/operations/server-wide/reorder-database-members.mdx) for the topology list, the cluster will restore the fixed order instead,
+ and the recovered node will return to its position in the fixed order.
+* If all the nodes in the topology list are in a [failure state](../../../client-api/cluster/how-client-integrates-with-replication-and-cluster.mdx#failover-behavior),
+ the client will send each request to the next node in the list, in turn.
+ The request will fail, unless the node it is sent to has recovered (e.g., from a temporary network outage).
* The preferred node can be explicitly set by:
* Reordering the topology list from the [Database Group view](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
* Sending [ReorderDatabaseMembersOperation](../../../client-api/operations/server-wide/reorder-database-members.mdx) from the client code.
-* The cluster may assign a different preferred node when removing/adding new nodes to the database-group.
-
+* The cluster may assign a different preferred node when nodes join the database group or leave it.
+
-## Single-node session usage
+
* When using a [single-node session](../../../client-api/session/cluster-transaction/overview.mdx#single-node),
- a short delay in replicating changes to all nodes in the cluster is acceptable in most cases.
+ a short delay in replicating changes to all nodes in the cluster is acceptable in most cases.
* If `ReadBalanceBehavior` or `LoadBalanceBehavior` are defined,
then the next session you open may access a different node.
So if you need to ensure that the next request will be able to _immediately_ read what you just wrote,
then use [Write Assurance](../../../client-api/session/saving-changes.mdx#waiting-for-replication---write-assurance).
-
-
+
diff --git a/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx b/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
index 58de528cdf..e013e66c99 100644
--- a/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
+++ b/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
@@ -1,53 +1,89 @@
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-**ReorderDatabaseMembersOperation** allows you to change the order of nodes in the [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
-## Syntax
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
-
-
-{`public ReorderDatabaseMembersOperation(string database, List order)
-`}
-
-
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixedTopology` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
-| Parameters | | |
-| ------------- | ------------- | ----- |
-| **database** | string | Name of a database to operate on |
-| **order** | List\<string> | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `ArgumentException` is the reordered list doesn't correspond to the existing nodes of the database group |
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
-## Example I
+
-
-
-{`// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+
+#### Example: Set a new order
+
+```csharp
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
// Change the order of database group nodes to : ["C", "A", "B"]
store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind",
new List
- \{
+ {
"C", "A", "B"
- \}));
-`}
-
-
+ }));
+```
+
+
-## Example II
+
-
-
-{`// Get the current DatabaseTopology from database record
+#### Example: Reverse the current order
+
+```csharp
+// Get the current DatabaseTopology from database record
var topology = store.Maintenance.Server.Send(new GetDatabaseRecordOperation("Northwind")).Topology;
// Reverse the order of database group nodes
topology.Members.Reverse();
store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind", topology.Members));
-`}
-
-
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```csharp
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind",
+ new List
+ {
+ "C", "A", "B"
+ },
+ fixedTopology: true));
+```
+
+
+
+
+
+
+
+```csharp
+public ReorderDatabaseMembersOperation(string database, List order)
+
+public ReorderDatabaseMembersOperation(string database, List order, bool fixedTopology)
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `string` | Name of a database to operate on |
+| **order** | `List` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `ArgumentException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixedTopology** | `bool` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (the first constructor's value): the order may change later, and the server clears any fixed order set earlier. |
+
diff --git a/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-java.mdx b/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-java.mdx
new file mode 100644
index 0000000000..f5d94f6b0f
--- /dev/null
+++ b/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-java.mdx
@@ -0,0 +1,83 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```java
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+// Change the order of database group nodes to : ["C", "A", "B"]
+
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind",
+ Arrays.asList("C", "A", "B")));
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```java
+// Get the current DatabaseTopology from database record
+DatabaseTopology topology = store.maintenance().server().send(new GetDatabaseRecordOperation("Northwind")).getTopology();
+
+// Reverse the order of database group nodes
+Collections.reverse(topology.getMembers());
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind", topology.getMembers()));
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```java
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind",
+ Arrays.asList("C", "A", "B"),
+ true));
+```
+
+
+
+
+
+
+
+```java
+public ReorderDatabaseMembersOperation(String database, List order)
+
+public ReorderDatabaseMembersOperation(String database, List order, boolean fixed)
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `String` | Name of a database to operate on |
+| **order** | `List` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `boolean` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (the first constructor's value): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx b/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx
new file mode 100644
index 0000000000..a1fd36a0c0
--- /dev/null
+++ b/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx
@@ -0,0 +1,82 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```js
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+// Change the order of database group nodes to : ["C", "A", "B"]
+
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"]));
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```js
+// Get the current DatabaseTopology from database record
+const databaseRecord = await store.maintenance.server.send(new GetDatabaseRecordOperation("Northwind"));
+const members = databaseRecord.topology.members;
+
+// Reverse the order of database group nodes
+members.reverse();
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind", members));
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```js
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"],
+ true));
+```
+
+
+
+
+
+
+
+```js
+const operation = new ReorderDatabaseMembersOperation(database, order, fixed?);
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `string` | Name of a database to operate on |
+| **order** | `string[]` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `boolean` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (default): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-python.mdx b/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-python.mdx
new file mode 100644
index 0000000000..4f2e7c081d
--- /dev/null
+++ b/versioned_docs/version-7.0/client-api/operations/server-wide/content/_reorder-database-members-python.mdx
@@ -0,0 +1,83 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `True`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```python
+# Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+# Change the order of database group nodes to : ["C", "A", "B"]
+
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"]))
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```python
+# Get the current topology from database record
+topology = store.maintenance.server.send(GetDatabaseRecordOperation("Northwind")).topology
+members = topology["Members"]
+
+# Reverse the order of database group nodes
+members.reverse()
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind", members))
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```python
+# Set the order of database group nodes to ["C", "A", "B"],
+# and keep this order when the Cluster Observer reorders the nodes
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"],
+ fixed=True))
+```
+
+
+
+
+
+
+
+```python
+class ReorderDatabaseMembersOperation(VoidServerOperation):
+ def __init__(self, database: str = None, order: List[str] = None, fixed: bool = False): ...
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `str` | Name of a database to operate on |
+| **order** | `List[str]` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `bool` | `True`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`False` (default): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/versioned_docs/version-7.0/client-api/operations/server-wide/reorder-database-members.mdx b/versioned_docs/version-7.0/client-api/operations/server-wide/reorder-database-members.mdx
index 9edbcb0ad3..fed98069ad 100644
--- a/versioned_docs/version-7.0/client-api/operations/server-wide/reorder-database-members.mdx
+++ b/versioned_docs/version-7.0/client-api/operations/server-wide/reorder-database-members.mdx
@@ -1,15 +1,17 @@
---
-title: "Operations: Server: How to reoder database members?"
+title: "Operations: Server: How to reorder database members?"
sidebar_label: Reorder Database Members
sidebar_position: 10
-supported_languages: ["csharp"]
+supported_languages: ["csharp", "java", "python", "nodejs"]
---
import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
import LanguageContent from "@site/src/components/LanguageContent";
import ReorderDatabaseMembersCsharp from './content/_reorder-database-members-csharp.mdx';
-
+import ReorderDatabaseMembersJava from './content/_reorder-database-members-java.mdx';
+import ReorderDatabaseMembersPython from './content/_reorder-database-members-python.mdx';
+import ReorderDatabaseMembersNodejs from './content/_reorder-database-members-nodejs.mdx';
@@ -17,7 +19,14 @@ import ReorderDatabaseMembersCsharp from './content/_reorder-database-members-cs
+
+
+
-
+
+
+
diff --git a/versioned_docs/version-7.0/server/clustering/distribution/distributed-database.mdx b/versioned_docs/version-7.0/server/clustering/distribution/distributed-database.mdx
index 903275f53f..ad2dc66d2a 100644
--- a/versioned_docs/version-7.0/server/clustering/distribution/distributed-database.mdx
+++ b/versioned_docs/version-7.0/server/clustering/distribution/distributed-database.mdx
@@ -5,11 +5,8 @@ sidebar_position: 0
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
# Distributed Database
@@ -17,21 +14,24 @@ import LanguageContent from "@site/src/components/LanguageContent";
* In RavenDB, a database can be replicated across multiple nodes, depending on its [Replication Factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor).
* A node where a database resides is referred to as a `Database Node`.
- The group of _Database Nodes_ that assemble the distributed database, is called a [Database Group](../../../studio/database/settings/manage-database-group.mdx).
+ The group of _Database Nodes_ that assemble the distributed database is called a [Database Group](../../../studio/database/settings/manage-database-group.mdx).
* Unless [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding) is employed,
each Database Node has a **full copy** of the database, containing **all** the database documents, and indexes them **locally**.
This greatly simplifies executing query requests, as there is no need to aggregate data from multiple nodes.
-
-* In this page:
- * [The Database Record](../../../server/clustering/distribution/distributed-database.mdx#the-database-record)
- * [Replication Factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor)
- * [Database Topology](../../../server/clustering/distribution/distributed-database.mdx#database-topology)
- * [Dynamic Database Distribution](../../../server/clustering/distribution/distributed-database.mdx#dynamic-database-distribution)
- * [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding)
+
+* In this article:
+ * [The database record](../../../server/clustering/distribution/distributed-database.mdx#the-database-record)
+ * [Replication factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor)
+ * [Database topology](../../../server/clustering/distribution/distributed-database.mdx#database-topology)
+ * [States flow](../../../server/clustering/distribution/distributed-database.mdx#states-flow)
+ * [Nodes order](../../../server/clustering/distribution/distributed-database.mdx#nodes-order)
+ * [Dynamic database distribution](../../../server/clustering/distribution/distributed-database.mdx#dynamic-database-distribution)
+ * [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding)
-## The Database Record
+
+
Each database instance keeps its configuration (e.g. Index definitions, Database topology) in a [Database Record](../../../client-api/operations/server-wide/create-database.mdx) object.
Upon database creation, this object is propagated through Rachis to all nodes in the cluster.
@@ -39,9 +39,9 @@ Upon database creation, this object is propagated through Rachis to all nodes in
After that, each node updates its own `Database Record` independently upon receiving any new Raft command,
e.g. when an index has changed.
+
-
-## Replication Factor
+
When creating a database, you can either:
@@ -52,11 +52,11 @@ When creating a database, you can either:
In either case, the number of nodes will represent the `Replication Factor`.
Once the database is created by getting a [Consensus](../../../server/clustering/rachis/consensus-operations.mdx),
-the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) begins monitoring the _Database Group_ in order to maintain this Replication Factor.
+the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) begins monitoring the _Database Group_ to maintain this Replication Factor.
+
-
-## Database Topology
+
The `Database Topology` describes the relationships between the Database Nodes within the [Database Group](../../../studio/database/settings/manage-database-group.mdx).
Each **Database Node** can be in one of the following states:
@@ -67,48 +67,60 @@ Each **Database Node** can be in one of the following states:
| **Promotable** | A node that has been recently added to the group and is being updated. |
| **Rehab** | A former Member node that is assumed to be _not_ up-to-date due to a partition. |
-
+
+
+All `Members` have master-master [Replication](../../../server/clustering/replication/replication-overview.mdx) to keep the documents in sync across the nodes.
+
+
+
+
+
+### States flow
* In general, all nodes in a newly created database are in a `Member` state.
-* When adding a new Database Node to an already existing database group, a `Mentor Node` is selected in order to update it.
+* When you add a new Database Node to an existing database group, a `Member` node becomes the new node's `Mentor Node` and updates the new node.
The new node will be in a `Promotable` state until it receives _and_ indexes all the documents from the mentor node.
* Learn more in:
* [Cluster node types](../../../studio/cluster/cluster-view.mdx#cluster-nodes-types)
* [Cluster node states and types flow](../../../studio/cluster/cluster-view.mdx#cluster-nodes-states--types-flow)
-
+
-
+
+
+### Nodes order
* The database topology is kept in a list that is always ordered with `Member` nodes first,
- then `Rehabs` and `Promotables` are last.
+ then `Rehabs` and `Promotables` are last.
* The order is important since it defines the client's order of access into the Database Group,
(see [Load balancing client requests](../../../client-api/configuration/load-balance/overview.mdx)).
-* The order can be modified using the [Client-API](../../../client-api/operations/server-wide/reorder-database-members.mdx)
- or via the [Studio](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
-
-
+* You can modify the order using the [client API](../../../client-api/operations/server-wide/reorder-database-members.mdx)
+ or [Studio](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
+ When you modify the order, you can set the new order as fixed.
+* When the Cluster Observer promotes a database node to `Member` (a newly added node, or a node that has recovered from `Rehab`),
+ the observer randomly reorders the `Member` nodes in the database's topology list.
+ A recovered node is promoted in every database the node hosts, so the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
+ role of these databases is spread among the cluster's nodes instead of remaining with the nodes that stayed up.
+ * If you set the order as fixed, the observer restores the fixed order after the random reorder.
-
-
-All `Members` have master-master [Replication](../../../server/clustering/replication/replication-overview.mdx) in order to keep the documents in sync across the nodes.
+
-
+
-
-## Dynamic Database Distribution
+
If any of the `Database Nodes` is down or partitioned, the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) will recognize it and act as follows:
1. If the time that is defined in [TimeBeforeMovingToRehabInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforemovingtorehabinsec) (default: 60 seconds) has passed
- and the node is still unreachable, the node will be moved to a `Rehab` state.
-
-2. If the node remains in `Rehab` for the time defined in [TimeBeforeAddingReplicaInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforeaddingreplicainsec) (default: 900 seconds),
- a new database node will be automatically added to the database group to replace the `Rehab` node.
+ and the node is still unreachable, the observer will change the node's state to `Rehab`.
+
+2. If dynamic database distribution is on and the node remains in `Rehab` state for the time defined in
+ [TimeBeforeAddingReplicaInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforeaddingreplicainsec) (default: 900 seconds),
+ the observer will add another cluster node to the database group to replace the `Rehab` node, if a suitable cluster node is available.
-3. If the `Rehab` node is online again, it will be assigned a [Mentor Node](../../../server/clustering/distribution/highly-available-tasks.mdx#responsible-node) to update it with the recent changes.
+3. If the `Rehab` node is online again, it will be assigned a [Mentor Node](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties) to update it with the recent changes.
-4. The first node to be up-to-date stays, while the other is deleted.
+4. If a replacement node was added in step 2, the first of the two nodes to be up-to-date stays, while the other is deleted.
@@ -117,20 +129,21 @@ and only AFTER it has finished sending all new documents it may have (while disc
-The _Dynamic Database Distribution_ feature can be toggled on and off with the following request:
+To turn dynamic database distribution on or off, use the
+[SetDatabaseDynamicDistributionOperation](../../../client-api/operations/server-wide/toggle-dynamic-database-distribution.mdx) client API operation,
+[Studio](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions), or the following request:
| URL | Method | URL Params |
|--------------------------------------------|----------|-----------------------------------------|
| /admin/databases/dynamic-node-distribution | `POST` | name=[`database-name`], enable=[`bool`] |
+
-
-## Sharding
+
* Sharding, supported by RavenDB as an out-of-the-box solution starting with version **6.0**,
is the distribution of a database's content across autonomous shards.
* Learn more about sharding in this dedicated [Sharding overview](../../../sharding/overview.mdx) article.
-
-
+
diff --git a/versioned_docs/version-7.0/sharding/external-replication.mdx b/versioned_docs/version-7.0/sharding/external-replication.mdx
index 90e8c80962..f565ffcca2 100644
--- a/versioned_docs/version-7.0/sharding/external-replication.mdx
+++ b/versioned_docs/version-7.0/sharding/external-replication.mdx
@@ -5,74 +5,72 @@ sidebar_position: 9
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
# Sharding: External Replication
-* [External Replication](../server/ongoing-tasks/external-replication.mdx) is an
- ongoing RavenDB task that you can create and run to maintain a live replica
+* [External Replication](../server/ongoing-tasks/external-replication.mdx) is an
+ ongoing RavenDB task that you can create and run to maintain a live replica
of your database on another RavenDB server.
-* Defining an external replication task via [Studio](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#definition)
- or [API](../server/ongoing-tasks/external-replication.mdx#code-sample) under a
+* Defining an external replication task via [Studio](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#definition)
+ or [API](../server/ongoing-tasks/external-replication.mdx#code-sample) under a
sharded database is similar to defining such tasks under a non-sharded database.
-* Sharded and non-sharded databases can replicate data to each other, providing
- their version is at least 6.0.
+* Sharded and non-sharded databases can replicate data to each other, provided that the non-sharded databases
+ are of version 5.4 or higher.
-* In this page:
- * [Supported Versions](../sharding/external-replication.mdx#supported-versions)
- * [External Replication Types](../sharding/external-replication.mdx#external-replication-types)
- * [Non-Sharded Database to Sharded Database](../sharding/external-replication.mdx#non-sharded-database-to-sharded-database)
- * [Sharded Database to Sharded Database](../sharding/external-replication.mdx#sharded-database-to-sharded-database)
- * [Performance Considerations](../sharding/external-replication.mdx#performance-considerations)
+* In this article:
+ * [Supported versions](../sharding/external-replication.mdx#supported-versions)
+ * [External replication types](../sharding/external-replication.mdx#external-replication-types)
+ * [Non-sharded database to sharded database](../sharding/external-replication.mdx#non-sharded-database-to-sharded-database)
+ * [Sharded database to sharded database](../sharding/external-replication.mdx#sharded-database-to-sharded-database)
+ * [Performance considerations](../sharding/external-replication.mdx#performance-considerations)
-## Supported Versions
-* A sharded database and a non-sharded database **can** replicate data to each
- other, providing their versions are 6.0 or higher.
-* Replicating data between a sharded database and a RavenDB version earlier
+
+
+* A sharded database and a non-sharded database **can** replicate data to each other, provided that the non-sharded database
+ is of version 5.4 or higher.
+* Replicating data between a sharded database and a RavenDB version earlier
than 5.4 is **not supported**.
-* Non-sharded databases **can** replicate data to each other regardless of
- their version. E.g., a non-sharded 6.0 database can replicate data to a 5.2
+* Non-sharded databases **can** replicate data to each other regardless of
+ their version. E.g., a non-sharded 6.0 database can replicate data to a 5.2
database and vice versa.
+
-
-## External Replication Types
+
-* **Internal replication** is applied automatically when the replication
- factor is larger than 1, to make the shard database more available by
+* **Internal replication** is applied automatically when the replication
+ factor is larger than 1, to make the shard database more available by
maintaining multiple accessible copies of it.
- Learn more about shards internal replication in the [overview](../sharding/overview.mdx#shard-replication)
- article and administration [Studio](../sharding/administration/studio-admin.mdx)
+ Learn more about shards internal replication in the [overview](../sharding/overview.mdx#shard-replication)
+ article and administration [Studio](../sharding/administration/studio-admin.mdx)
and [API](../sharding/administration/api-admin.mdx) articles.
* **External replication** is applied when a dedicated task is defined for it.
- Read more about it and follow a step-by-step guide
- [here](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#step-by-step-guide).
+ To learn more about external replication and follow a step-by-step guide,
+ see [External Replication Task](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#step-by-step-guide).
-All data replicated by or to a sharded database is mediated via
-[orchestrators](../sharding/overview.mdx#client-server-communication).
-The shards themselves are oblivious to their being shards: from
-a shard's perspective, it is just a regular RavenDB database that
+All data replicated to a sharded database is mediated via
+[orchestrators](../sharding/overview.mdx#client-server-communication).
+The shards themselves are oblivious to their being shards: from
+a shard's perspective, it is just a regular RavenDB database that
can, among its other ordinary RavenDB features, replicate data.
-External replication from and to non-sharded databases requires
-no special syntax or preparations. It does, however, cost the server
-some additional work, that, especially when the database is large
-and every extra operation counts, should be taken into account by
-the administrator. Here is how external replication works behind
-the scenes.
+External replication from and to sharded databases requires no special syntax or preparations.
+It does, however, cost the server some additional work. Take this additional work into account,
+especially when the database is large and every extra operation counts.
+Here is how external replication works behind the scenes.
-## Non-Sharded Database to Sharded Database
+
+
+### Non-sharded database to sharded database
The image below depicts a non-sharded database replicating data to a 5-shard database.
@@ -80,22 +78,26 @@ The image below depicts a non-sharded database replicating data to a 5-shard dat
1. **Non-Sharded Database**
2. **Replication to Sharded Database**
- The database is unaware that the destination database is sharded,
- no special syntax or preparation is needed.
+ The database is unaware that the destination database is sharded,
+ so no special syntax or preparation is needed.
3. **Orchestrator**
- The orchestrator receives and prepares the replicated data,
- grouping documents and document extensions by document IDs so each
+ The orchestrator receives and prepares the replicated data,
+ grouping documents and document extensions by document IDs so each
entity can be stored in the correct shard.
4. **Transfer to Shard**
The orchestrator transfers each destination shard its data.
- Optimization routines are applied to make the process as
+ Optimization routines are applied to make the process as
effective as possible.
5. **Shard**
- Document and document extensions are assigned to buckets by document ID.
- Shard replies to replicated data and replication attempts are similar
+ Documents and document extensions are assigned to buckets by document ID.
+ Shard replies to replicated data and replication attempts are similar
to replies made by non-sharded databases.
-## Sharded Database to Sharded Database
+
+
+
+
+### Sharded database to sharded database
* The image below depicts a 3-shard database replicating data to a 5-shard database.
* Each shard replicates its data as an autonomous database.
@@ -105,33 +107,55 @@ The image below depicts a non-sharded database replicating data to a 5-shard dat
1. **DB 1 Shard**
The shard is unaware that the destination database is sharded.
2. **Replication to DB 2**
- The database is unaware that the destination database is sharded,
- no special syntax or preparation is needed.
+ The database is unaware that the destination database is sharded,
+ so no special syntax or preparation is needed.
3. **DB 2 Orchestrator**
- The orchestrator receives and prepares the replicated data,
- grouping documents and document extensions by document IDs so each
+ The orchestrator receives and prepares the replicated data,
+ grouping documents and document extensions by document IDs so each
entity can be stored in the correct shard.
4. **Transfer to Shard**
The orchestrator transfers each destination shard its data.
- Optimization routines are applied to make the process as
+ Optimization routines are applied to make the process as
effective as possible.
5. **DB 2 Shard**
Documents and document extensions are assigned to buckets by document ID.
- Shard replies to replicated data and replication attempts are similar
+ Shard replies to replicated data and replication attempts are similar
to replies made by non-sharded databases.
+
+
+
+
-## Performance Considerations
+When two databases replicate data to each other, whether they are sharded or not, the target database sends each data item it receives
+back to the original sender. The original sender recognizes that the data item is already stored locally, ignores the data item, and
+ends the cycle.
-When external replication tasks are defined in two different sharded databases,
-so they replicate their data to each other, each data item sent from one of the
-databases to the other will then be sent back from the target database to the
-original sender. The original sender will then recognize that the data item is
-already stored locally, ignore it, and end the cycle.
+The data items that the target database sends back depend on the target database type:
-In this specific case, of two external databases replicating data to each other,
-please consider this overhead in your performance considerations and tests.
+* **Non-sharded target database**
+ The database sends back only the data items it receives while its replication task to the original sender is running.
+* **Sharded target database**
+ The database sends back every data item it received from the original sender, regardless of when it received the data item.
+Each shard adds its own entry to the [change vector](../server/clustering/replication/change-vector.mdx) of every data item it receives
+by external replication. When the sharded database replicates data onward to another database, the sharded database uses the shards'
+entries to send the destination every data item from every shard, so no data item is lost.
+The original sender's [global change vector](../server/clustering/replication/change-vector.mdx#database-global-change-vector) does not
+include the shards' entries, so the sharded database sends every data item received from the original sender back to the original sender.
+For example:
+
+* A non-sharded database replicates 1,000 documents to a sharded database.
+* You then create a replication task from the sharded database back to the non-sharded database.
+* The sharded database will send all 1,000 documents back to the non-sharded database
+ (whereas a non-sharded target database would send back none of the 1,000 documents).
+
+
+
+Take the additional replication traffic into account in your performance planning and tests.
+
+
+
diff --git a/versioned_docs/version-7.1/client-api/configuration/load-balance/overview.mdx b/versioned_docs/version-7.1/client-api/configuration/load-balance/overview.mdx
index fee668b5de..07bdb9340e 100644
--- a/versioned_docs/version-7.1/client-api/configuration/load-balance/overview.mdx
+++ b/versioned_docs/version-7.1/client-api/configuration/load-balance/overview.mdx
@@ -5,11 +5,7 @@ sidebar_position: 0
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
# Load balancing client requests - Overview
@@ -17,89 +13,98 @@ import LanguageContent from "@site/src/components/LanguageContent";
* A database can have multiple instances, each one residing on a different cluster node.
Each instance is a complete replica of the database.
-* The [database-group-topology](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view) is the list of nodes that contain those database replicas.
+* The [database group topology](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view) is the list of nodes that contain the database's replicas.
The first node in this list is called the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node).
* The client is kept up-to-date with this topology list.
- __The client decides which node from this list to access__ when making requests to the RavenDB cluster.
+ **The client decides which node from this list to access** when making requests to the RavenDB cluster.
* By default, the client will access the preferred node for all _Read & Write_ requests it makes.
This default behavior can be changed by configuring:
* [ReadBalanceBehavior](../../../client-api/configuration/load-balance/read-balance-behavior.mdx) - load balancing `Read` requests only
* [LoadBalanceBehavior](../../../client-api/configuration/load-balance/load-balance-behavior.mdx) - load balancing `Read & Write` requests
-* In this page:
- * [Keeping the client topology up-to-date](../../../client-api/configuration/load-balance/overview.mdx#keeping-the-client-topology-up-to-date)
- * [Client logic for choosing a node](../../../client-api/configuration/load-balance/overview.mdx#client-logic-for-choosing-a-node)
- * [The preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
- * [Single-node session usage](../../../client-api/configuration/load-balance/overview.mdx#single-node-session-usage)
-
+
+* In this article:
+ * [Keeping the client topology up-to-date](../../../client-api/configuration/load-balance/overview.mdx#keeping-the-client-topology-up-to-date)
+ * [Client logic for choosing a node](../../../client-api/configuration/load-balance/overview.mdx#client-logic-for-choosing-a-node)
+ * [The preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
+ * [Single-node session usage](../../../client-api/configuration/load-balance/overview.mdx#single-node-session-usage)
+
-## Keeping the client topology up-to-date
-* Upon Document Store initialization, the client receives the __initial topology list__,
+
+
+* Upon Document Store initialization, the client receives the **initial topology list**,
after which the client is kept updated at all times for any changes made to it.
-* If the topology list has changed on the server, (or any other client configuration),
- the client will learn about it upon making its __next request__ to the server,
+* If the topology list (or any other client configuration) has changed on the server,
+ the client will learn about the change from the server's response to its **next request**,
and will update its configuration accordingly.
* In addition, every 5 minutes, the client will fetch the current topology from the server
if no requests were made within that time frame.
-* Any client-configuration settings that are set on the server side __override__ the settings made on the client-side.
+* Any client-configuration settings that are set on the server side **override** the settings made on the client side.
* For more information see [Topology in the client](../../../client-api/cluster/how-client-integrates-with-replication-and-cluster.mdx#cluster-topology-in-the-client).
+
-
-## Client logic for choosing a node
+
The client uses the following logic (from top to bottom) to determine which node to send the request to:
-* Use the __specified node__:
+* Use the **specified node**:
A client can explicitly specify the target node when executing a [server-maintenance operation](../../../client-api/operations/what-are-operations.mdx#server-maintenance-operations).
- Learn more in [switch operation to a different node](../../../client-api/operations/how-to/switch-operations-to-a-different-node.mdx).
-* Else, if using-session-context is defined, use __LoadBalanceBehavior__:
+ Learn more in [Switch Operations to a Different Node](../../../client-api/operations/how-to/switch-operations-to-a-different-node.mdx).
+* Else, if **LoadBalanceBehavior** is set to `UseSessionContext`, use the session context:
Per session, the client will select a node based on the [session context](../../../client-api/configuration/load-balance/load-balance-behavior.mdx#loadbalancebehavior-options).
- All `Read & Write` requests made on the session will be directed to that node.
-* Else, if defined, use __ReadBalanceBehavior__:
+ All `Read & Write` requests made on the session will be directed to the selected node.
+* Else, if defined, use **ReadBalanceBehavior**:
`Read` requests: The client will select a node based on the [read balance options](../../../client-api/configuration/load-balance/read-balance-behavior.mdx#readbalancebehavior-options).
- `Write` requests: All _Write_ requests will be directed to the preferred node.
-* Else, use the __preferred node__:
+ `Write` requests: All _Write_ requests will be directed to the preferred node.
+* Else, use the **preferred node**:
Use the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node) for both `Read & Write` requests.
+
+
-## The preferred node
-
-* The preferred node is simply the __first__ node in the [topology nodes list](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view).
-* __By default__, when no load balancing strategy is defined,
+* The preferred node is the **first** node in the [topology list](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---view).
+* **By default**, when no load balancing strategy is defined,
the client will send all `Read & Write` requests to this node.
-* When the preferred node is in a failure state,
- the cluster will update the topology, assigning another node to be the preferred one.
+* When the preferred node is in a failure state,
+ the client will send its requests to the first node in the topology list that is not in a failure state.
+ If the failed node stays down, the cluster will change the node's state to `Rehab` and move it to the end of the list,
+ so the second node in the list will become the preferred node.
* Once the preferred node is back up and has caught up with all data,
- it will be placed __last__ in the topology list.
-* If all the nodes in the topology list are in a failure state then the first node in the list will be the 'preferred'.
- The user would get an error, or recover if the error was transient.
+ the cluster will [randomly reorder](../../../server/clustering/distribution/distributed-database.mdx#nodes-order) the topology list of every database the recovered node hosts,
+ so the node may be placed anywhere in each list.
+ As a result, the preferred-node role of the node's databases will be spread among the cluster's nodes,
+ instead of remaining with the nodes that stayed up.
+ * If you set a [fixed order](../../../client-api/operations/server-wide/reorder-database-members.mdx) for the topology list, the cluster will restore the fixed order instead,
+ and the recovered node will return to its position in the fixed order.
+* If all the nodes in the topology list are in a [failure state](../../../client-api/cluster/how-client-integrates-with-replication-and-cluster.mdx#failover-behavior),
+ the client will send each request to the next node in the list, in turn.
+ The request will fail, unless the node it is sent to has recovered (e.g., from a temporary network outage).
* The preferred node can be explicitly set by:
* Reordering the topology list from the [Database Group view](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
* Sending [ReorderDatabaseMembersOperation](../../../client-api/operations/server-wide/reorder-database-members.mdx) from the client code.
-* The cluster may assign a different preferred node when removing/adding new nodes to the database-group.
-
+* The cluster may assign a different preferred node when nodes join the database group or leave it.
+
-## Single-node session usage
+
* When using a [single-node session](../../../client-api/session/cluster-transaction/overview.mdx#single-node),
- a short delay in replicating changes to all nodes in the cluster is acceptable in most cases.
+ a short delay in replicating changes to all nodes in the cluster is acceptable in most cases.
* If `ReadBalanceBehavior` or `LoadBalanceBehavior` are defined,
then the next session you open may access a different node.
So if you need to ensure that the next request will be able to _immediately_ read what you just wrote,
then use [Write Assurance](../../../client-api/session/saving-changes.mdx#waiting-for-replication---write-assurance).
-
-
+
diff --git a/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx b/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
index 58de528cdf..e013e66c99 100644
--- a/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
+++ b/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-csharp.mdx
@@ -1,53 +1,89 @@
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-**ReorderDatabaseMembersOperation** allows you to change the order of nodes in the [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
-## Syntax
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
-
-
-{`public ReorderDatabaseMembersOperation(string database, List order)
-`}
-
-
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixedTopology` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
-| Parameters | | |
-| ------------- | ------------- | ----- |
-| **database** | string | Name of a database to operate on |
-| **order** | List\<string> | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `ArgumentException` is the reordered list doesn't correspond to the existing nodes of the database group |
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
-## Example I
+
-
-
-{`// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+
+#### Example: Set a new order
+
+```csharp
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
// Change the order of database group nodes to : ["C", "A", "B"]
store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind",
new List
- \{
+ {
"C", "A", "B"
- \}));
-`}
-
-
+ }));
+```
+
+
-## Example II
+
-
-
-{`// Get the current DatabaseTopology from database record
+#### Example: Reverse the current order
+
+```csharp
+// Get the current DatabaseTopology from database record
var topology = store.Maintenance.Server.Send(new GetDatabaseRecordOperation("Northwind")).Topology;
// Reverse the order of database group nodes
topology.Members.Reverse();
store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind", topology.Members));
-`}
-
-
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```csharp
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+store.Maintenance.Server.Send(new ReorderDatabaseMembersOperation("Northwind",
+ new List
+ {
+ "C", "A", "B"
+ },
+ fixedTopology: true));
+```
+
+
+
+
+
+
+
+```csharp
+public ReorderDatabaseMembersOperation(string database, List order)
+
+public ReorderDatabaseMembersOperation(string database, List order, bool fixedTopology)
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `string` | Name of a database to operate on |
+| **order** | `List` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `ArgumentException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixedTopology** | `bool` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (the first constructor's value): the order may change later, and the server clears any fixed order set earlier. |
+
diff --git a/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-java.mdx b/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-java.mdx
new file mode 100644
index 0000000000..f5d94f6b0f
--- /dev/null
+++ b/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-java.mdx
@@ -0,0 +1,83 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```java
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+// Change the order of database group nodes to : ["C", "A", "B"]
+
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind",
+ Arrays.asList("C", "A", "B")));
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```java
+// Get the current DatabaseTopology from database record
+DatabaseTopology topology = store.maintenance().server().send(new GetDatabaseRecordOperation("Northwind")).getTopology();
+
+// Reverse the order of database group nodes
+Collections.reverse(topology.getMembers());
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind", topology.getMembers()));
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```java
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+store.maintenance().server().send(new ReorderDatabaseMembersOperation("Northwind",
+ Arrays.asList("C", "A", "B"),
+ true));
+```
+
+
+
+
+
+
+
+```java
+public ReorderDatabaseMembersOperation(String database, List order)
+
+public ReorderDatabaseMembersOperation(String database, List order, boolean fixed)
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `String` | Name of a database to operate on |
+| **order** | `List` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `boolean` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (the first constructor's value): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx b/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx
new file mode 100644
index 0000000000..a1fd36a0c0
--- /dev/null
+++ b/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-nodejs.mdx
@@ -0,0 +1,82 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `true`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```js
+// Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+// Change the order of database group nodes to : ["C", "A", "B"]
+
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"]));
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```js
+// Get the current DatabaseTopology from database record
+const databaseRecord = await store.maintenance.server.send(new GetDatabaseRecordOperation("Northwind"));
+const members = databaseRecord.topology.members;
+
+// Reverse the order of database group nodes
+members.reverse();
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind", members));
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```js
+// Set the order of database group nodes to ["C", "A", "B"],
+// and keep this order when the Cluster Observer reorders the nodes
+await store.maintenance.server.send(new ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"],
+ true));
+```
+
+
+
+
+
+
+
+```js
+const operation = new ReorderDatabaseMembersOperation(database, order, fixed?);
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `string` | Name of a database to operate on |
+| **order** | `string[]` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `boolean` | `true`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`false` (default): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-python.mdx b/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-python.mdx
new file mode 100644
index 0000000000..4f2e7c081d
--- /dev/null
+++ b/versioned_docs/version-7.1/client-api/operations/server-wide/content/_reorder-database-members-python.mdx
@@ -0,0 +1,83 @@
+import Admonition from '@theme/Admonition';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
+
+
+
+* `ReorderDatabaseMembersOperation` allows you to change the order of nodes in the
+ [Database Group Topology](../../../../studio/database/settings/manage-database-group.mdx).
+
+* To make the [Cluster Observer](../../../../server/clustering/distribution/cluster-observer.mdx) keep the order you set,
+ set `fixed` to `True`. Otherwise, the observer may later
+ [randomly reorder the nodes](../../../../server/clustering/distribution/distributed-database.mdx#nodes-order), for example when a node recovers.
+
+* In this article:
+ * [Examples](../../../../client-api/operations/server-wide/reorder-database-members.mdx#examples)
+ * [Syntax](../../../../client-api/operations/server-wide/reorder-database-members.mdx#syntax)
+
+
+
+
+
+
+
+#### Example: Set a new order
+
+```python
+# Assume that the current order of database group nodes is : ["A", "B", "C"]
+
+# Change the order of database group nodes to : ["C", "A", "B"]
+
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"]))
+```
+
+
+
+
+
+#### Example: Reverse the current order
+
+```python
+# Get the current topology from database record
+topology = store.maintenance.server.send(GetDatabaseRecordOperation("Northwind")).topology
+members = topology["Members"]
+
+# Reverse the order of database group nodes
+members.reverse()
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind", members))
+```
+
+
+
+
+
+#### Example: Set a fixed order
+
+```python
+# Set the order of database group nodes to ["C", "A", "B"],
+# and keep this order when the Cluster Observer reorders the nodes
+store.maintenance.server.send(ReorderDatabaseMembersOperation("Northwind",
+ ["C", "A", "B"],
+ fixed=True))
+```
+
+
+
+
+
+
+
+```python
+class ReorderDatabaseMembersOperation(VoidServerOperation):
+ def __init__(self, database: str = None, order: List[str] = None, fixed: bool = False): ...
+```
+
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| **database** | `str` | Name of a database to operate on |
+| **order** | `List[str]` | List of node tags of all existing nodes in the database group, listed in the exact order that you wish to have.
Throws `RavenException` if the reordered list doesn't correspond to the existing nodes of the database group |
+| **fixed** | `bool` | `True`: the Cluster Observer keeps the order in `order`. Whenever the observer reorders the nodes (for example, when it promotes a recovered node back to `Member`), the observer restores the order in `order`.
`False` (default): the order may change later, and the server clears any fixed order set earlier. |
+
+
diff --git a/versioned_docs/version-7.1/client-api/operations/server-wide/reorder-database-members.mdx b/versioned_docs/version-7.1/client-api/operations/server-wide/reorder-database-members.mdx
index 9edbcb0ad3..fed98069ad 100644
--- a/versioned_docs/version-7.1/client-api/operations/server-wide/reorder-database-members.mdx
+++ b/versioned_docs/version-7.1/client-api/operations/server-wide/reorder-database-members.mdx
@@ -1,15 +1,17 @@
---
-title: "Operations: Server: How to reoder database members?"
+title: "Operations: Server: How to reorder database members?"
sidebar_label: Reorder Database Members
sidebar_position: 10
-supported_languages: ["csharp"]
+supported_languages: ["csharp", "java", "python", "nodejs"]
---
import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
import LanguageContent from "@site/src/components/LanguageContent";
import ReorderDatabaseMembersCsharp from './content/_reorder-database-members-csharp.mdx';
-
+import ReorderDatabaseMembersJava from './content/_reorder-database-members-java.mdx';
+import ReorderDatabaseMembersPython from './content/_reorder-database-members-python.mdx';
+import ReorderDatabaseMembersNodejs from './content/_reorder-database-members-nodejs.mdx';
@@ -17,7 +19,14 @@ import ReorderDatabaseMembersCsharp from './content/_reorder-database-members-cs
+
+
+
-
+
+
+
diff --git a/versioned_docs/version-7.1/server/clustering/distribution/distributed-database.mdx b/versioned_docs/version-7.1/server/clustering/distribution/distributed-database.mdx
index 903275f53f..ad2dc66d2a 100644
--- a/versioned_docs/version-7.1/server/clustering/distribution/distributed-database.mdx
+++ b/versioned_docs/version-7.1/server/clustering/distribution/distributed-database.mdx
@@ -5,11 +5,8 @@ sidebar_position: 0
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
# Distributed Database
@@ -17,21 +14,24 @@ import LanguageContent from "@site/src/components/LanguageContent";
* In RavenDB, a database can be replicated across multiple nodes, depending on its [Replication Factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor).
* A node where a database resides is referred to as a `Database Node`.
- The group of _Database Nodes_ that assemble the distributed database, is called a [Database Group](../../../studio/database/settings/manage-database-group.mdx).
+ The group of _Database Nodes_ that assemble the distributed database is called a [Database Group](../../../studio/database/settings/manage-database-group.mdx).
* Unless [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding) is employed,
each Database Node has a **full copy** of the database, containing **all** the database documents, and indexes them **locally**.
This greatly simplifies executing query requests, as there is no need to aggregate data from multiple nodes.
-
-* In this page:
- * [The Database Record](../../../server/clustering/distribution/distributed-database.mdx#the-database-record)
- * [Replication Factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor)
- * [Database Topology](../../../server/clustering/distribution/distributed-database.mdx#database-topology)
- * [Dynamic Database Distribution](../../../server/clustering/distribution/distributed-database.mdx#dynamic-database-distribution)
- * [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding)
+
+* In this article:
+ * [The database record](../../../server/clustering/distribution/distributed-database.mdx#the-database-record)
+ * [Replication factor](../../../server/clustering/distribution/distributed-database.mdx#replication-factor)
+ * [Database topology](../../../server/clustering/distribution/distributed-database.mdx#database-topology)
+ * [States flow](../../../server/clustering/distribution/distributed-database.mdx#states-flow)
+ * [Nodes order](../../../server/clustering/distribution/distributed-database.mdx#nodes-order)
+ * [Dynamic database distribution](../../../server/clustering/distribution/distributed-database.mdx#dynamic-database-distribution)
+ * [Sharding](../../../server/clustering/distribution/distributed-database.mdx#sharding)
-## The Database Record
+
+
Each database instance keeps its configuration (e.g. Index definitions, Database topology) in a [Database Record](../../../client-api/operations/server-wide/create-database.mdx) object.
Upon database creation, this object is propagated through Rachis to all nodes in the cluster.
@@ -39,9 +39,9 @@ Upon database creation, this object is propagated through Rachis to all nodes in
After that, each node updates its own `Database Record` independently upon receiving any new Raft command,
e.g. when an index has changed.
+
-
-## Replication Factor
+
When creating a database, you can either:
@@ -52,11 +52,11 @@ When creating a database, you can either:
In either case, the number of nodes will represent the `Replication Factor`.
Once the database is created by getting a [Consensus](../../../server/clustering/rachis/consensus-operations.mdx),
-the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) begins monitoring the _Database Group_ in order to maintain this Replication Factor.
+the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) begins monitoring the _Database Group_ to maintain this Replication Factor.
+
-
-## Database Topology
+
The `Database Topology` describes the relationships between the Database Nodes within the [Database Group](../../../studio/database/settings/manage-database-group.mdx).
Each **Database Node** can be in one of the following states:
@@ -67,48 +67,60 @@ Each **Database Node** can be in one of the following states:
| **Promotable** | A node that has been recently added to the group and is being updated. |
| **Rehab** | A former Member node that is assumed to be _not_ up-to-date due to a partition. |
-
+
+
+All `Members` have master-master [Replication](../../../server/clustering/replication/replication-overview.mdx) to keep the documents in sync across the nodes.
+
+
+
+
+
+### States flow
* In general, all nodes in a newly created database are in a `Member` state.
-* When adding a new Database Node to an already existing database group, a `Mentor Node` is selected in order to update it.
+* When you add a new Database Node to an existing database group, a `Member` node becomes the new node's `Mentor Node` and updates the new node.
The new node will be in a `Promotable` state until it receives _and_ indexes all the documents from the mentor node.
* Learn more in:
* [Cluster node types](../../../studio/cluster/cluster-view.mdx#cluster-nodes-types)
* [Cluster node states and types flow](../../../studio/cluster/cluster-view.mdx#cluster-nodes-states--types-flow)
-
+
-
+
+
+### Nodes order
* The database topology is kept in a list that is always ordered with `Member` nodes first,
- then `Rehabs` and `Promotables` are last.
+ then `Rehabs` and `Promotables` are last.
* The order is important since it defines the client's order of access into the Database Group,
(see [Load balancing client requests](../../../client-api/configuration/load-balance/overview.mdx)).
-* The order can be modified using the [Client-API](../../../client-api/operations/server-wide/reorder-database-members.mdx)
- or via the [Studio](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
-
-
+* You can modify the order using the [client API](../../../client-api/operations/server-wide/reorder-database-members.mdx)
+ or [Studio](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions).
+ When you modify the order, you can set the new order as fixed.
+* When the Cluster Observer promotes a database node to `Member` (a newly added node, or a node that has recovered from `Rehab`),
+ the observer randomly reorders the `Member` nodes in the database's topology list.
+ A recovered node is promoted in every database the node hosts, so the [preferred node](../../../client-api/configuration/load-balance/overview.mdx#the-preferred-node)
+ role of these databases is spread among the cluster's nodes instead of remaining with the nodes that stayed up.
+ * If you set the order as fixed, the observer restores the fixed order after the random reorder.
-
-
-All `Members` have master-master [Replication](../../../server/clustering/replication/replication-overview.mdx) in order to keep the documents in sync across the nodes.
+
-
+
-
-## Dynamic Database Distribution
+
If any of the `Database Nodes` is down or partitioned, the [Cluster Observer](../../../server/clustering/distribution/cluster-observer.mdx) will recognize it and act as follows:
1. If the time that is defined in [TimeBeforeMovingToRehabInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforemovingtorehabinsec) (default: 60 seconds) has passed
- and the node is still unreachable, the node will be moved to a `Rehab` state.
-
-2. If the node remains in `Rehab` for the time defined in [TimeBeforeAddingReplicaInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforeaddingreplicainsec) (default: 900 seconds),
- a new database node will be automatically added to the database group to replace the `Rehab` node.
+ and the node is still unreachable, the observer will change the node's state to `Rehab`.
+
+2. If dynamic database distribution is on and the node remains in `Rehab` state for the time defined in
+ [TimeBeforeAddingReplicaInSec](../../../server/configuration/cluster-configuration.mdx#clustertimebeforeaddingreplicainsec) (default: 900 seconds),
+ the observer will add another cluster node to the database group to replace the `Rehab` node, if a suitable cluster node is available.
-3. If the `Rehab` node is online again, it will be assigned a [Mentor Node](../../../server/clustering/distribution/highly-available-tasks.mdx#responsible-node) to update it with the recent changes.
+3. If the `Rehab` node is online again, it will be assigned a [Mentor Node](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---members-duties) to update it with the recent changes.
-4. The first node to be up-to-date stays, while the other is deleted.
+4. If a replacement node was added in step 2, the first of the two nodes to be up-to-date stays, while the other is deleted.
@@ -117,20 +129,21 @@ and only AFTER it has finished sending all new documents it may have (while disc
-The _Dynamic Database Distribution_ feature can be toggled on and off with the following request:
+To turn dynamic database distribution on or off, use the
+[SetDatabaseDynamicDistributionOperation](../../../client-api/operations/server-wide/toggle-dynamic-database-distribution.mdx) client API operation,
+[Studio](../../../studio/database/settings/manage-database-group.mdx#database-group-topology---actions), or the following request:
| URL | Method | URL Params |
|--------------------------------------------|----------|-----------------------------------------|
| /admin/databases/dynamic-node-distribution | `POST` | name=[`database-name`], enable=[`bool`] |
+
-
-## Sharding
+
* Sharding, supported by RavenDB as an out-of-the-box solution starting with version **6.0**,
is the distribution of a database's content across autonomous shards.
* Learn more about sharding in this dedicated [Sharding overview](../../../sharding/overview.mdx) article.
-
-
+
diff --git a/versioned_docs/version-7.1/sharding/external-replication.mdx b/versioned_docs/version-7.1/sharding/external-replication.mdx
index 90e8c80962..f565ffcca2 100644
--- a/versioned_docs/version-7.1/sharding/external-replication.mdx
+++ b/versioned_docs/version-7.1/sharding/external-replication.mdx
@@ -5,74 +5,72 @@ sidebar_position: 9
---
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
-import LanguageSwitcher from "@site/src/components/LanguageSwitcher";
-import LanguageContent from "@site/src/components/LanguageContent";
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
# Sharding: External Replication
-* [External Replication](../server/ongoing-tasks/external-replication.mdx) is an
- ongoing RavenDB task that you can create and run to maintain a live replica
+* [External Replication](../server/ongoing-tasks/external-replication.mdx) is an
+ ongoing RavenDB task that you can create and run to maintain a live replica
of your database on another RavenDB server.
-* Defining an external replication task via [Studio](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#definition)
- or [API](../server/ongoing-tasks/external-replication.mdx#code-sample) under a
+* Defining an external replication task via [Studio](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#definition)
+ or [API](../server/ongoing-tasks/external-replication.mdx#code-sample) under a
sharded database is similar to defining such tasks under a non-sharded database.
-* Sharded and non-sharded databases can replicate data to each other, providing
- their version is at least 6.0.
+* Sharded and non-sharded databases can replicate data to each other, provided that the non-sharded databases
+ are of version 5.4 or higher.
-* In this page:
- * [Supported Versions](../sharding/external-replication.mdx#supported-versions)
- * [External Replication Types](../sharding/external-replication.mdx#external-replication-types)
- * [Non-Sharded Database to Sharded Database](../sharding/external-replication.mdx#non-sharded-database-to-sharded-database)
- * [Sharded Database to Sharded Database](../sharding/external-replication.mdx#sharded-database-to-sharded-database)
- * [Performance Considerations](../sharding/external-replication.mdx#performance-considerations)
+* In this article:
+ * [Supported versions](../sharding/external-replication.mdx#supported-versions)
+ * [External replication types](../sharding/external-replication.mdx#external-replication-types)
+ * [Non-sharded database to sharded database](../sharding/external-replication.mdx#non-sharded-database-to-sharded-database)
+ * [Sharded database to sharded database](../sharding/external-replication.mdx#sharded-database-to-sharded-database)
+ * [Performance considerations](../sharding/external-replication.mdx#performance-considerations)
-## Supported Versions
-* A sharded database and a non-sharded database **can** replicate data to each
- other, providing their versions are 6.0 or higher.
-* Replicating data between a sharded database and a RavenDB version earlier
+
+
+* A sharded database and a non-sharded database **can** replicate data to each other, provided that the non-sharded database
+ is of version 5.4 or higher.
+* Replicating data between a sharded database and a RavenDB version earlier
than 5.4 is **not supported**.
-* Non-sharded databases **can** replicate data to each other regardless of
- their version. E.g., a non-sharded 6.0 database can replicate data to a 5.2
+* Non-sharded databases **can** replicate data to each other regardless of
+ their version. E.g., a non-sharded 6.0 database can replicate data to a 5.2
database and vice versa.
+
-
-## External Replication Types
+
-* **Internal replication** is applied automatically when the replication
- factor is larger than 1, to make the shard database more available by
+* **Internal replication** is applied automatically when the replication
+ factor is larger than 1, to make the shard database more available by
maintaining multiple accessible copies of it.
- Learn more about shards internal replication in the [overview](../sharding/overview.mdx#shard-replication)
- article and administration [Studio](../sharding/administration/studio-admin.mdx)
+ Learn more about shards internal replication in the [overview](../sharding/overview.mdx#shard-replication)
+ article and administration [Studio](../sharding/administration/studio-admin.mdx)
and [API](../sharding/administration/api-admin.mdx) articles.
* **External replication** is applied when a dedicated task is defined for it.
- Read more about it and follow a step-by-step guide
- [here](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#step-by-step-guide).
+ To learn more about external replication and follow a step-by-step guide,
+ see [External Replication Task](../studio/database/tasks/ongoing-tasks/external-replication-task.mdx#step-by-step-guide).
-All data replicated by or to a sharded database is mediated via
-[orchestrators](../sharding/overview.mdx#client-server-communication).
-The shards themselves are oblivious to their being shards: from
-a shard's perspective, it is just a regular RavenDB database that
+All data replicated to a sharded database is mediated via
+[orchestrators](../sharding/overview.mdx#client-server-communication).
+The shards themselves are oblivious to their being shards: from
+a shard's perspective, it is just a regular RavenDB database that
can, among its other ordinary RavenDB features, replicate data.
-External replication from and to non-sharded databases requires
-no special syntax or preparations. It does, however, cost the server
-some additional work, that, especially when the database is large
-and every extra operation counts, should be taken into account by
-the administrator. Here is how external replication works behind
-the scenes.
+External replication from and to sharded databases requires no special syntax or preparations.
+It does, however, cost the server some additional work. Take this additional work into account,
+especially when the database is large and every extra operation counts.
+Here is how external replication works behind the scenes.
-## Non-Sharded Database to Sharded Database
+
+
+### Non-sharded database to sharded database
The image below depicts a non-sharded database replicating data to a 5-shard database.
@@ -80,22 +78,26 @@ The image below depicts a non-sharded database replicating data to a 5-shard dat
1. **Non-Sharded Database**
2. **Replication to Sharded Database**
- The database is unaware that the destination database is sharded,
- no special syntax or preparation is needed.
+ The database is unaware that the destination database is sharded,
+ so no special syntax or preparation is needed.
3. **Orchestrator**
- The orchestrator receives and prepares the replicated data,
- grouping documents and document extensions by document IDs so each
+ The orchestrator receives and prepares the replicated data,
+ grouping documents and document extensions by document IDs so each
entity can be stored in the correct shard.
4. **Transfer to Shard**
The orchestrator transfers each destination shard its data.
- Optimization routines are applied to make the process as
+ Optimization routines are applied to make the process as
effective as possible.
5. **Shard**
- Document and document extensions are assigned to buckets by document ID.
- Shard replies to replicated data and replication attempts are similar
+ Documents and document extensions are assigned to buckets by document ID.
+ Shard replies to replicated data and replication attempts are similar
to replies made by non-sharded databases.
-## Sharded Database to Sharded Database
+
+
+
+
+### Sharded database to sharded database
* The image below depicts a 3-shard database replicating data to a 5-shard database.
* Each shard replicates its data as an autonomous database.
@@ -105,33 +107,55 @@ The image below depicts a non-sharded database replicating data to a 5-shard dat
1. **DB 1 Shard**
The shard is unaware that the destination database is sharded.
2. **Replication to DB 2**
- The database is unaware that the destination database is sharded,
- no special syntax or preparation is needed.
+ The database is unaware that the destination database is sharded,
+ so no special syntax or preparation is needed.
3. **DB 2 Orchestrator**
- The orchestrator receives and prepares the replicated data,
- grouping documents and document extensions by document IDs so each
+ The orchestrator receives and prepares the replicated data,
+ grouping documents and document extensions by document IDs so each
entity can be stored in the correct shard.
4. **Transfer to Shard**
The orchestrator transfers each destination shard its data.
- Optimization routines are applied to make the process as
+ Optimization routines are applied to make the process as
effective as possible.
5. **DB 2 Shard**
Documents and document extensions are assigned to buckets by document ID.
- Shard replies to replicated data and replication attempts are similar
+ Shard replies to replicated data and replication attempts are similar
to replies made by non-sharded databases.
+
+
+
+
-## Performance Considerations
+When two databases replicate data to each other, whether they are sharded or not, the target database sends each data item it receives
+back to the original sender. The original sender recognizes that the data item is already stored locally, ignores the data item, and
+ends the cycle.
-When external replication tasks are defined in two different sharded databases,
-so they replicate their data to each other, each data item sent from one of the
-databases to the other will then be sent back from the target database to the
-original sender. The original sender will then recognize that the data item is
-already stored locally, ignore it, and end the cycle.
+The data items that the target database sends back depend on the target database type:
-In this specific case, of two external databases replicating data to each other,
-please consider this overhead in your performance considerations and tests.
+* **Non-sharded target database**
+ The database sends back only the data items it receives while its replication task to the original sender is running.
+* **Sharded target database**
+ The database sends back every data item it received from the original sender, regardless of when it received the data item.
+Each shard adds its own entry to the [change vector](../server/clustering/replication/change-vector.mdx) of every data item it receives
+by external replication. When the sharded database replicates data onward to another database, the sharded database uses the shards'
+entries to send the destination every data item from every shard, so no data item is lost.
+The original sender's [global change vector](../server/clustering/replication/change-vector.mdx#database-global-change-vector) does not
+include the shards' entries, so the sharded database sends every data item received from the original sender back to the original sender.
+For example:
+
+* A non-sharded database replicates 1,000 documents to a sharded database.
+* You then create a replication task from the sharded database back to the non-sharded database.
+* The sharded database will send all 1,000 documents back to the non-sharded database
+ (whereas a non-sharded target database would send back none of the 1,000 documents).
+
+
+
+Take the additional replication traffic into account in your performance planning and tests.
+
+
+