# Multi-node setup

## Replication settings

:::callout{intent="warning" title="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](../replication-and-scaling/replica-movement.md), the [replication factor](../reference-configuration/collections.md#replication) of a shard can be changed.
:::

Configure replication settings, such as [async replication](../replication-and-scaling/replication.md#configure-async-replication-settings) and [deletion resolution strategy](../replication-architecture/consistency.md#deletion-resolution-strategies).

:::code-group{sync="languages"}
```python title="Python" {5-12}
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,
        ),
    ),
)
```

```typescript title="JavaScript/TypeScript"
import { configure } from 'weaviate-client';
```

```go title="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,
  },
}
```

```java title="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))))));
```

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

```bash title="cURL"
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
```
:::

:::accordion{title="Additional information"}
To use replication factors greater than one, use a [multi-node deployment](../installation/installation-guides-docker-installation.md#multi-node-configuration).

For details on the configuration parameters, see the following:

- [Replication](../reference-configuration/collections.md#replication)
:::

## Update replication settings

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

:::code-group{sync="languages"}
```python title="Python" {5-11}
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,
        ),
    ),
)
```

```typescript title="JavaScript/TypeScript" {3-9}
const articleReplication = replicationClient.collections.use('Article')

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

```java title="Java" {3-6}
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))))));
```
:::

:::callout{intent="info"}
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.

:::code-group{sync="languages"}
```python title="Python" {5-9}
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,
    ),
)
```

```typescript title="JavaScript/TypeScript"
import { configure } from 'weaviate-client';
```

```go title="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,
  },
}
```

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

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

:::accordion{title="Additional information"}
For details on the configuration parameters, see the following:

- [Sharding](../reference-configuration/collections.md#sharding)
:::

## Inspect shards (for a collection)

An index itself can be comprised of multiple shards.

:::code-group{sync="languages"}
```python title="Python" {3}
articles = client.collections.use("Article")

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

```js title="JavaScript/TypeScript" {3}
let articles = client.collections.use('Article')

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

```go title="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 title="Java"
CollectionHandle<Map<String, Object>> articles =
    client.collections.use("Article");

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

```csharp title="C#"
// Coming soon
```
:::

## Update shard status

You can manually update a shard to change it's status. For example, update the shard status from `READONLY` to `READY` after you make other changes.

:::code-group{sync="languages"}
```python title="Python" {3-6}
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)
```

```js title="JavaScript/TypeScript" {3}
let articles = client.collections.use("Article");

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

```go title="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 title="Java"
CollectionHandle<Map<String, Object>> articles =
    client.collections.use("Article");

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

```csharp title="C#"
// Coming soon
```
:::

## Further resources

- [API References: REST: Schema](/weaviate/api/rest#tag/schema/post/schema)
- [References: Configuration: Schema](../reference-configuration/collections.md)
- [Concepts: Data structure](../concepts/data.md)

## Questions and feedback

Have a question or feedback? Here's how to reach us.

::::card-grid
:::card{title="Community Forum" href="https://forum.weaviate.io/c/support" icon="messages-square"}
Ask questions and connect with other developers on our **Community forum**.
:::

:::card{title="Support" href="/guides/support-overview" icon="life-buoy"}
Weaviate Cloud user or customer? Find the right channel on the **Support page**.
:::
::::

## Related pages

- [Agents](./agents-index.md)
- [AI-assisted Weaviate code generation](./ai-assisted-vibe-coding-index.md)
- [APIs](./apis-index.md)
- [Authorization and authentication](./authorization-and-authentication-index.md)
- [Benchmarks](./benchmarks-index.md)
- [Best practices](./best-practices-index.md)
- [Client libraries](./clients-index.md)
- [Client Libraries / SDKs](./client-libraries-index.md)
- [Cloud](./cloud-index.md)
- [Cloud account management](./cloud-account-management-index.md)

# Agent Instructions

This portal answers questions programmatically. To receive a synthesized,
source-cited answer instead of crawling page by page, append the `?ask=`
query parameter to any page URL on this site:

    /guides/quickstart?ask=how+do+I+authenticate

Optional parameters:

- `&goal=<what-you-are-trying-to-do>` steers the answer toward your
  objective (e.g. `&goal=write+a+python+client`).
- `&version=<label>` scopes the answer to a mounted version when the
  portal publishes more than one.

The response is `text/markdown`: the answer followed by a `# Sources` list
of the portal pages it was grounded in. Status codes are the contract:

- `200` — the answer; `402` — the portal owner’s plan or answer credits are
  exhausted (surface this to your operator; do NOT retry); `429` — you are
  rate-limited; back off for the `Retry-After` seconds; `503` — the answer
  lane is temporarily unavailable; fall back to crawling the `.md` pages.

For the full corpus map read `llms.txt` at the site root; for the tool
surface (search + page fetch as MCP tools) see `/mcp`.
