Multi-node setup
Replication settings
The replication factor of a collection cannot be updated by updating the collection's definition.
From v1.32 by using replica movement, the replication factor of a shard can be changed.
Configure replication settings, such as async replication and deletion resolution strategy.
If a snippet doesn't work or you have feedback, please open a GitHub issue.
from weaviate.classes.config import Configure, ReplicationDeletionStrategy
client.collections.create(
"Article",
replication_config=Configure.replication(
factor=3,
async_enabled=True,
deletion_strategy=ReplicationDeletionStrategy.TIME_BASED_RESOLUTION,
async_config=Configure.Replication.async_config(
max_workers=5,
hashtree_height=16,
frequency=30,
),
),
)
Additional information
To use replication factors greater than one, use a multi-node deployment.
For details on the configuration parameters, see the following:
Update replication settings
Update async replication settings for an existing collection. The asyncConfig parameters are mutable and can be changed at any time.
If a snippet doesn't work or you have feedback, please open a GitHub issue.
from weaviate.classes.config import Reconfigure
collection = client.collections.get("Article")
collection.config.update(
replication_config=Reconfigure.replication(
async_config=Reconfigure.Replication.async_config(
max_workers=10,
frequency=60,
),
),
)
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.
If a snippet doesn't work or you have feedback, please open a GitHub issue.
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,
),
)
Additional information
For details on the configuration parameters, see the following:
Inspect shards (for a collection)
An index itself can be comprised of multiple shards.
If a snippet doesn't work or you have feedback, please open a GitHub issue.
articles = client.collections.use("Article")
article_shards = articles.config.get_shards()
print(article_shards)
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.
If a snippet doesn't work or you have feedback, please open a GitHub issue.
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)
Further resources
Questions and feedback
If you have any questions or feedback, let us know in the user forum.
