Multi-Tenancy in Weaviate
Lernen Sie, Daten innerhalb einer einzigen Weaviate-Collection pro Tenant zu isolieren und so skalierbare, sichere Anwendungen für mehrere Kunden zu entwickeln.
Multi-Tenancy in Weaviate ist eine kostenlose Vector Databases: Pinecone, Weaviate & pgvector-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Vector Databases: Pinecone, Weaviate & pgvector-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Vector Databases: Pinecone, Weaviate & pgvector-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Why Multi-Tenancy?
Multi-tenancy lets one Weaviate collection serve many isolated customers (tenants) while keeping their data physically and logically separated.
- One schema, many tenants
- Strong data isolation
- Efficient resource use vs. one collection per customer
Enabling Multi-Tenancy
You enable multi-tenancy at collection creation time by setting multiTenancyConfig.enabled = true. Once enabled, every object must belong to a tenant.
{
"class": "Article",
"multiTenancyConfig": { "enabled": true }
}Creating Tenants
Tenants are added to a collection explicitly. Each tenant has a unique name and an activity status.
- HOT: active, queryable
- COLD: offloaded, must be activated first
POST /v1/schema/Article/tenants
[
{ "name": "customer-a" },
{ "name": "customer-b" }
]Inserting Tenant Data
When inserting objects you must specify which tenant owns the object. Data for one tenant is never visible to another.
{
"class": "Article",
"tenant": "customer-a",
"properties": { "title": "Hello" }
}Querying Per Tenant
Every query must include the tenant parameter. Weaviate scopes the search to that tenant's shard only, improving both isolation and performance.
{
Get {
Article (tenant: "customer-a", limit: 5) {
title
}
}
}Tenant Isolation Guarantees
Each tenant gets its own shard. This means:
- No cross-tenant data leakage
- Independent indexing per tenant
- Per-tenant lifecycle management
Activity Status & Offloading
Inactive tenants can be set to COLD to free memory, or offloaded to cloud storage. Reactivate them on demand to query again.
PUT /v1/schema/Article/tenants
[
{ "name": "customer-b", "activityStatus": "COLD" }
]Listing & Deleting Tenants
You can list all tenants of a collection or delete a tenant entirely. Deleting a tenant removes all its data permanently.
GET /v1/schema/Article/tenants
DELETE /v1/schema/Article/tenants
["customer-b"]Scaling with Many Tenants
Weaviate supports thousands of tenants efficiently because inactive shards consume minimal resources. Use COLD status aggressively for rarely-used tenants.
Python Client Example
The Python client makes tenant operations explicit via a tenant-scoped handle.
import weaviate
client = weaviate.connect_to_local()
articles = client.collections.get('Article')
tenant_a = articles.with_tenant('customer-a')
tenant_a.data.insert({'title': 'Edge case'})
client.close()Best Practices
Guidelines for multi-tenant Weaviate:
- Use one tenant per customer, not per request
- Set unused tenants to COLD
- Always validate the tenant param server-side to prevent enumeration
Quick Check
Test your understanding of multi-tenancy.
Recap
You learned to enable multi-tenancy, create and manage tenants, insert and query tenant-scoped data, and use COLD status for scaling. Multi-tenancy is the key to building secure, multi-customer apps on a single Weaviate collection.
Häufig gestellte Fragen
Ist die Lektion „Multi-Tenancy in Weaviate“ kostenlos?
Ja — der vollständige Text von „Multi-Tenancy in Weaviate“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Vector Databases: Pinecone, Weaviate & pgvector-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Vector Databases: Pinecone, Weaviate & pgvector-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Multi-Tenancy in Weaviate“?
Lernen Sie, Daten innerhalb einer einzigen Weaviate-Collection pro Tenant zu isolieren und so skalierbare, sichere Anwendungen für mehrere Kunden zu entwickeln. Du übst Vector Databases: Pinecone, Weaviate & pgvector mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Vector Databases: Pinecone, Weaviate & pgvector zu starten?
Keine Vorkenntnisse erforderlich. Vector Databases: Pinecone, Weaviate & pgvector auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „Multi-Tenancy in Weaviate“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Vector Databases: Pinecone, Weaviate & pgvector-Lektion Code schreiben und ausführen?
Ja. Jede Vector Databases: Pinecone, Weaviate & pgvector-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Semantische Suche und hybride Suche
- Weaviate-Module verwenden
- Strategien für Sicherung und Wiederherstellung
- Multi-Tenancy in Weaviate