---
title: "Multi-node setup"
description: "Configure replication and sharding for multi-node setups with code in Python, TypeScript, Go, Java, and C#."
url: https://docs.weaviate.io/weaviate/manage-collections/multi-node-setup
---

# Multi-node setup

## Replication settings

> [!WARNING]
>
> **Replication factor change**
>
> The replication factor of a collection cannot be updated by updating the collection's definition.
>
> From `v1.32` by using [replica movement](https://docs.weaviate.io/deploy/configuration/replica-movement), the [replication factor](https://docs.weaviate.io/weaviate/config-refs/collections#replication) of a shard can be changed.

Configure replication settings, such as [async replication](https://docs.weaviate.io/deploy/configuration/replication#async-replication-settings) and [deletion resolution strategy](https://docs.weaviate.io/weaviate/concepts/replication-architecture/consistency#deletion-resolution-strategies).

**Python**

```py
from weaviate.classes.config import Configure, ReplicationDeletionStrategy

client.collections.create(
    "Article",
    replication_config=Configure.replication(
        factor=3,
        deletion_strategy=ReplicationDeletionStrategy.TIME_BASED_RESOLUTION,
        async_config=Configure.Replication.async_config(
            hashtree_height=16,
            frequency=30,
        ),
    ),
)
```

See also: [.Configure](https://weaviate-python-client.readthedocs.io/en/stable/weaviate.collections.classes.html#weaviate.collections.classes.config.Configure)

**JavaScript/TypeScript**

```ts
import { configure } from '@weaviate/node';

await replicationClient.collections.create({
  name: 'Article',
  replication: configure.replication({
    factor: 3,
    deletionStrategy: 'TimeBasedResolution',
    asyncConfig: {
      hashtreeHeight: 16,
      frequency: 30,
    },
  }),
})
```

**Go (v5)**

```go
  articleClass := &models.Class{
    Class:       "Article",
    Description: "Collection of articles",
    // Async replication runs by default when the replication factor is greater than 1
    ReplicationConfig: &models.ReplicationConfig{
      Factor:           3,
      DeletionStrategy: models.ReplicationConfigDeletionStrategyTimeBasedResolution,
    },
  }
```

**Go (v6)**

```go
_, err := client.Collections.Create(ctx, collections.Collection{
  Name: "Article",
  Replication: &collections.ReplicationConfig{
    Factor:           3,
    DeletionStrategy: collections.TimeBasedResolution,
    AsyncReplication: &collections.AsyncReplicationConfig{
      HashTreeHeight:       16,
      ReplicationFrequency: 30 * time.Millisecond,
    },
  },
})
if err != nil {
  // handle error
  panic(err)
}
```

**Java**

```java
threeNodeClient.collections.create("Article",
    col -> col.replication(Replication.of(rep -> rep.replicationFactor(3)
        .deletionStrategy(DeletionStrategy.TIME_BASED_RESOLUTION)
        .asyncReplication(AsyncReplicationConfig.of(async -> async
            .propagationConcurrency(5)
            .hashTreeHeight(16)
            .frequencyMillis(30))))));
```

**C#**

```csharp
await client.Collections.Create(
    new CollectionCreateParams
    {
        Name = "Article",
        ReplicationConfig = new ReplicationConfig
        {
            Factor = 1,
            AsyncEnabled = true,
            DeletionStrategy = DeletionStrategy.TimeBasedResolution,
        },
    }
);
```

**Curl**

```bash
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{
    "class": "Article",
    "properties": [
        {
            "dataType": [
                "string"
            ],
            "description": "Title of the article",
            "name": "title"
        }
    ],
    "replicationConfig": {
      "factor": 3,
      "deletionStrategy": "TimeBasedResolution",
      "asyncConfig": {
        "hashtreeHeight": 16,
        "frequency": 30000
      }
    }
}' \
http://localhost:8080/v1/schema
```

**Additional information**

To use replication factors greater than one, use a [multi-node deployment](https://docs.weaviate.io/deploy/installation-guides/docker-installation#multi-node-configuration).

For details on the configuration parameters, see the following:

- [Replication](https://docs.weaviate.io/weaviate/config-refs/collections#replication)

## Update replication settings

Update async replication settings for an existing collection. The `asyncConfig` parameters are mutable and can be changed at any time.

**Python**

```py
from weaviate.classes.config import Reconfigure

collection = client.collections.get("Article")

collection.config.update(
    replication_config=Reconfigure.replication(
        async_config=Reconfigure.Replication.async_config(
            frequency=60,
        ),
    ),
)
```

**JavaScript/TypeScript**

```ts
const articleReplication = replicationClient.collections.use('Article')

await articleReplication.config.update({
  replication: reconfigure.replication({
    asyncConfig: {
      frequency: 60,
    },
  }),
})
```

**Java**

```java
var collection = threeNodeClient.collections.use("Article");

collection.config.update(col -> col.replication(Replication.of(
    rep -> rep.asyncReplication(AsyncReplicationConfig.of(async -> async
        .propagationConcurrency(10)
        .frequencyMillis(60))))));
```

> [!NOTE]
>
> Changing the hash tree height invalidates the existing tree and triggers a full rebuild. The rebuild duration scales with the number of objects in the collection, but it runs in the background and does not block reads or writes.

## Sharding settings

Configure sharding per collection.

**Python**

```py
from weaviate.classes.config import Configure

client.collections.create(
    "Article",
    sharding_config=Configure.sharding(
        virtual_per_physical=128,
        desired_count=1,
        desired_virtual_count=128,
    ),
)
```

**JavaScript/TypeScript**

```ts
import { configure } from '@weaviate/node';

await client.collections.create({
  name: 'Article',
  sharding: configure.sharding({
    virtualPerPhysical: 128,
    desiredCount: 1,
    desiredVirtualCount: 128,
  })
})
```

**Go (v5)**

```go
  articleClass := &models.Class{
    Class:       "Article",
    Description: "Collection of articles",
    ShardingConfig: sharding.Config{
      VirtualPerPhysical:  128,
      DesiredCount:        1,
      DesiredVirtualCount: 128,
      Key:                 sharding.DefaultKey,
      Strategy:            sharding.DefaultStrategy,
      Function:            sharding.DefaultFunction,
    },
  }
```

**Go (v6)**

```go
_, err := client.Collections.Create(ctx, collections.Collection{
  Name: "Article",
  Sharding: &collections.ShardingConfig{
    VirtualPerPhysical:  128,
    DesiredCount:        1,
    DesiredVirtualCount: 128,
  },
})
if err != nil {
  // handle error
  panic(err)
}
```

**Java**

```java
client.collections.create("Article",
    col -> col.sharding(Sharding.of(s -> s.virtualPerPhysical(128)
        .desiredCount(1)
        .desiredVirtualCount(128))));
```

**C#**

```csharp
await client.Collections.Create(
    new CollectionCreateParams
    {
        Name = "Article",
        ShardingConfig = new ShardingConfig
        {
            VirtualPerPhysical = 128,
            DesiredCount = 1,
            DesiredVirtualCount = 128,
        },
    }
);
```

**Additional information**

For details on the configuration parameters, see the following:

- [Sharding](https://docs.weaviate.io/weaviate/config-refs/collections#sharding)

## Inspect shards (for a collection)

> [!NOTE]
>
> **Changed in `v1.40`**

An index itself can be comprised of multiple shards.

**Python**

```py
articles = client.collections.use("Article")

article_shards = articles.config.get_shards()
print(article_shards)
```

**JavaScript/TypeScript**

```js
let articles = client.collections.use('Article')

const shards = await articles.config.getShards()
console.log(JSON.stringify(shards, null, 2));
```

**Go (v5)**

```go
package main

import (
  "context"
  "fmt"

  "github.com/weaviate/weaviate-go-client/v5/weaviate"
)

func main() {
  cfg := weaviate.Config{
    Host:   "localhost:8080",
    Scheme: "http",
  }
  client, err := weaviate.NewClient(cfg)
  if err != nil {
    panic(err)
  }
  shards, err := client.Schema().
    ShardsGetter().
    WithClassName("Article").
    Do(context.Background())
  if err != nil {
    panic(err)
  }
  fmt.Printf("%v", shards)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> articles =
    client.collections.use("Article");

List<Shard> articleShards = articles.config.getShards();
System.out.println(articleShards);
```

**C#**

```csharp
    // Coming soon
```

`GET /v1/schema/{collection}/shards` reports the status of each shard on every replica. Each entry has a `per_node_status` object that maps a node name to the shard's status on that node. A replica that cannot be reached, or that cannot serve reads, reports `UNAVAILABLE`.

```json
"per_node_status": { "node-0": "READY", "node-1": "UNAVAILABLE" }
```

`status` and `vectorQueueSize` are deprecated. Use `per_node_status`.

## Update shard status

You can manually update a shard to change its status, for example to `READONLY` to stop writes, or back to `READY`. Shards marked `READONLY` because of disk pressure return to `READY` automatically from `v1.36.0` on. See [disk pressure warnings and limits](https://docs.weaviate.io/deploy/configuration/persistence#disk-pressure-warnings-and-limits).

**Python**

```py
articles = client.collections.use("Article")

article_shards = articles.config.update_shards(
    status="READY",
    shard_names=shard_names,  # The names (List[str]) of the shard to update (or a shard name)
)

print(article_shards)
```

**JavaScript/TypeScript**

```js
let articles = client.collections.use("Article");

const shards = await articles.config.updateShards("READY", "shard-1234");
console.log(JSON.stringify(shards, null, 2));
```

**Go (v5)**

```go
shardStatus, err := client.Schema().ShardUpdater().
  WithClassName(myCollectionName). // Set your collection name
  WithShardName(shardName).        // Set the shard name to update
  WithStatus("READY").
  Do(ctx)
if err != nil {
  // handle error
  panic(err)
}
fmt.Printf("%v", shardStatus)
```

**Java**

```java
CollectionHandle<Map<String, Object>> articles =
    client.collections.use("Article");

List<Shard> articleShards =
    articles.config.updateShards(ShardStatus.READONLY, shardName);
System.out.println(articleShards);
```

**C#**

```csharp
    // Coming soon
```

## Further resources

- [API References: REST: Schema](https://docs.weaviate.io/weaviate/api/rest#tag/schema/post/schema)

- [References: Configuration: Schema](https://docs.weaviate.io/weaviate/config-refs/collections)

- [Concepts: Data structure](https://docs.weaviate.io/weaviate/concepts/data)
