Environment:Langgenius Dify Vector Database Environment
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, RAG |
| Last Updated | 2026-02-08 11:00 GMT |
Overview
Vector database infrastructure environment supporting 15+ vector store backends for Dify RAG pipelines, with Weaviate as the default option.
Description
This environment defines the vector database infrastructure required for Dify's Retrieval-Augmented Generation (RAG) capabilities. Dify supports an extensive set of vector databases selectable via the `VECTOR_STORE` environment variable and Docker Compose profiles. The default is Weaviate 1.27.0, but the platform also supports Qdrant, Milvus, PGVector, Elasticsearch, OpenSearch, Chroma, and many more. Each vector database has its own Docker Compose profile that can be activated by setting the appropriate `VECTOR_STORE` value.
Usage
Use this environment when setting up Knowledge Base indexing and retrieval. It is required by the FetchIndexingEstimate, RetrievalConfig_Type, and HitTesting implementations that depend on vector similarity search.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| RAM | 2GB minimum per vector DB | Weaviate and Milvus may need more for large indexes |
| Disk | 10GB+ SSD | Storage scales with indexed document count |
| Network | Internal Docker network | Vector DBs communicate only with API service |
Dependencies
Supported Vector Databases
Default:
- `semitechnologies/weaviate` = 1.27.0 (ports 8080 REST, 50051 gRPC)
Alternatives (select via VECTOR_STORE env var):
- `langgenius/qdrant` = v1.8.3 (port 6333)
- `milvusdb/milvus` = v2.6.3 (port 19530, requires etcd + MinIO)
- `pgvector/pgvector` = pg16 (port 5432)
- `tensorchord/pgvecto-rs` = pg16-v0.3.0 (port 5432)
- `docker.elastic.co/elasticsearch/elasticsearch` = 8.14.3 (port 9200)
- `opensearchproject/opensearch` = latest (port 9200)
- `ghcr.io/chroma-core/chroma` = 0.5.20 (port 8000)
- `myscale/myscaledb` = 1.6.4 (port 8123)
- `matrixorigin/matrixone` = 2.1.1 (port 6001)
- `opengauss/opengauss` = 7.0.0-RC1 (port 6600)
- Plus: Oracle, Couchbase, IRIS, TiDB, Lindorm, and cloud-managed options
Credentials
- `WEAVIATE_API_KEY`: Weaviate authentication API key (default: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih).
- `QDRANT_API_KEY`: Qdrant authentication key (default: difyai123456).
- `MILVUS_TOKEN`: Milvus authentication token (optional).
- `ELASTICSEARCH_PASSWORD`: Elasticsearch password (default: elastic).
- `OPENSEARCH_INITIAL_ADMIN_PASSWORD`: OpenSearch admin password (default: Qazwsxedc!@#123).
- `CHROMA_AUTH_CREDENTIALS`: Chroma token authentication credentials.
Quick Install
# Default (Weaviate):
VECTOR_STORE=weaviate docker compose up -d
# Switch to Qdrant:
# Edit .env: VECTOR_STORE=qdrant
docker compose --profile qdrant up -d
# Switch to PGVector:
# Edit .env: VECTOR_STORE=pgvector
docker compose --profile pgvector up -d
Code Evidence
Vector store selection from `docker/.env.example:468`:
VECTOR_STORE=weaviate
Compose profile activation from `docker/.env.example:1497`:
COMPOSE_PROFILES=${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql}
Weaviate health check from `docker/docker-compose.yaml`:
healthcheck:
test: wget --no-verbose --tries=3 --spider http://weaviate:8080/v1/.well-known/ready || exit 1
interval: 1s
timeout: 5s
retries: 60
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `Connection refused to weaviate:8080` | Weaviate not started or wrong profile | Verify `COMPOSE_PROFILES` includes `weaviate` |
| `CUDA out of memory` (Milvus) | Insufficient GPU VRAM | Use CPU-only Milvus or reduce index parameters |
| `Authentication failed` on vector DB | Wrong API key | Verify `WEAVIATE_API_KEY` or `QDRANT_API_KEY` in `.env` |
| `etcd: mvcc: required revision has been compacted` | Milvus etcd compaction issue | Increase `ETCD_AUTO_COMPACTION_RETENTION` |
Compatibility Notes
- Weaviate: Default and most tested option. Supports gRPC for faster bulk operations.
- PGVector: Good choice if already running PostgreSQL; supports optional `pg_bigm` for CJK full-text search.
- Milvus: Requires 3 services (etcd + MinIO + Milvus); most complex setup but supports hybrid search.
- Elasticsearch: Requires xpack security; provides built-in Kibana dashboard.
- Cloud-managed options: TiDB, AnalyticDB, VikingDB, Upstash, Tablestore, and others supported via connection strings without Docker containers.