Skip to content

Commit 2a674b2

Browse files
kylebernhardykriszyp
authored andcommitted
Add documentation for replication.shard configuration.
1 parent f0ea297 commit 2a674b2

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/deployments/configuration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ When true, Harper will verify certificates against the Node.js bundled CA store.
270270

271271
Replication will first attempt to catch up using the audit log. If unsuccessful, it will perform a full table copy. When set to `false`, replication will only use the audit log.
272272

273+
`shard` - _Type_: integer;
274+
275+
This defines the shard id of this instance and is used in conjunction with the [Table Resource functions](../developers/replication/sharding#custom-sharding) `setResidency` & `setResidencyById` to programmatically route traffic to the proper shard.
276+
273277
***
274278

275279
### `clustering` using NATS

docs/developers/replication/sharding.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ class MyTable extends tables.MyTable {
6565
```
6666

6767
## Configuration for Static Sharding
68-
Alternatively, you can configure static sharding, where each node is assigned to a specific shard, and each record is replicated to the nodes in that shard based on the primary key. The `shard` is identified by a number. To configure the shard for each node, you can specify the shard number in the `replication`'s `routes` in the configuration:
68+
Alternatively, you can configure static sharding, where each node is assigned to a specific shard, and each record is replicated to the nodes in that shard based on the primary key. The `shard` is identified by a number. To configure the shard for each node, you can specify the shard number in the `replication`'s `shard` in the configuration:
69+
```yaml
70+
replication:
71+
shard: 1
72+
```
73+
Alternatively, you can configure the `shard` under the `replication` `routes`. This allows you to assign a specific shard id based on the routing configuration.
6974
```yaml
7075
replication:
7176
routes:

0 commit comments

Comments
 (0)