Closed lucas0usa closed 2 weeks ago
Olá @lucas0usa! Eu sou um bot que pode te ajudar a resolver bugs, responder perguntas e até se tornar um colaborador. Estou aqui para ajudar enquanto você aguarda um mantenedor humano. 😊
Para resolver o erro "Error building Component Qdrant: [Errno 111] Connection refused" ao rodar o Langflow a partir da imagem Docker no Windows 11, siga os passos abaixo:
Certifique-se de que o serviço Qdrant está em execução: Verifique se o serviço Qdrant está ativo e funcionando corretamente. Você pode fazer isso verificando o status do serviço ou os logs.
Verifique os detalhes da conexão: Certifique-se de que o host e a porta especificados na configuração correspondem ao host e à porta onde o Qdrant está rodando. A porta padrão para o Qdrant é 6333 para HTTP e 6334 para gRPC.
Configuração de rede do Docker: Certifique-se de que o contêiner Docker que está rodando o Langflow pode se comunicar com o serviço Qdrant. Se o Qdrant estiver rodando na máquina host, você pode precisar usar host.docker.internal
como o host na sua configuração.
Aqui está um exemplo de configuração para o componente Qdrant:
def build(
self,
embedding: Embeddings,
collection_name: str,
documents: Optional[Document] = None,
api_key: Optional[str] = None,
content_payload_key: str = "page_content",
distance_func: str = "Cosine",
grpc_port: int = 6334,
https: bool = False,
host: Optional[str] = "host.docker.internal", # Use host.docker.internal para Docker no Windows
location: Optional[str] = None,
metadata_payload_key: str = "metadata",
path: Optional[str] = None,
port: Optional[int] = 6333,
prefer_grpc: bool = False,
prefix: Optional[str] = None,
search_kwargs: Optional[NestedDict] = None,
timeout: Optional[int] = None,
url: Optional[str] = None,
) -> Union[VectorStore, Qdrant, BaseRetriever]:
if documents is None:
from qdrant_client import QdrantClient
client = QdrantClient(
location=location,
url=host,
port=port,
grpc_port=grpc_port,
https=https,
prefix=prefix,
timeout=timeout,
prefer_grpc=prefer_grpc,
metadata_payload_key=metadata_payload_key,
content_payload_key=content_payload_key,
api_key=api_key,
collection_name=collection_name,
host=host,
path=path,
)
vs = Qdrant(
client=client,
collection_name=collection_name,
embeddings=embedding,
)
return vs
else:
vs = Qdrant.from_documents(
documents=documents, # type: ignore
embedding=embedding,
api_key=api_key,
collection_name=collection_name,
content_payload_key=content_payload_key,
distance_func=distance_func,
grpc_port=grpc_port,
host=host,
https=https,
location=location,
metadata_payload_key=metadata_payload_key,
path=path,
port=port,
prefer_grpc=prefer_grpc,
prefix=prefix,
search_kwargs=search_kwargs,
timeout=timeout,
url=url,
)
return vs
Ao definir host
como host.docker.internal
, você permite que o contêiner Docker acesse serviços que estão rodando na máquina host. Ajuste a port
e outros parâmetros conforme necessário para corresponder à configuração do seu serviço Qdrant [1].
To continue talking to Dosu, mention @dosu.
Testei, mas ainda persiste o erro
same problem here, tried different things like the container name, changing for url field, but nothing.
The host value seems to be blocked on "localhost"
It seems the problem is more related to docker than to Langflow itself, for you to connect with qdrant, the langflow network needs to have access to it, it means you need to configure your deployment as a bridge deployment, then refer to the qdrant container using your docker namespace.
version: "3.8"
services:
langflow:
image: langflowai/langflow:latest # or another version tag on https://hub.docker.com/r/langflowai/langflow
pull_policy: always # set to 'always' when using 'latest' image
ports:
- "7860:7860"
depends_on:
- postgres
- qdrant
environment:
- LANGFLOW_DATABASE_URL=postgresql://langflow:langflow@postgres:5432/langflow
- QDRANT_URL=http://qdrant:6333 # URL to connect to Qdrant service
# Add any additional environment variables as needed
volumes:
- langflow-data:/app/langflow
networks:
- app-network
postgres:
image: postgres:16
environment:
POSTGRES_USER: langflow
POSTGRES_PASSWORD: langflow
POSTGRES_DB: langflow
ports:
- "5432:5432"
volumes:
- langflow-postgres:/var/lib/postgresql/data
networks:
- app-network
qdrant:
image: qdrant/qdrant:latest
container_name: qdrant
ports:
- "6333:6333" # HTTP API
- "6334:6334" # gRPC API (optional)
volumes:
- qdrant-data:/qdrant/storage
environment:
QDRANT__SERVICE__GRPC_PORT: 6334
QDRANT__LOG__LEVEL: info
# You can add more Qdrant-specific environment variables here
networks:
- app-network
volumes:
langflow-postgres:
langflow-data:
qdrant-data:
networks:
app-network:
driver: bridge
Bug Description
O Langflow quando rodado a partir da Imagem Docker não consegue se conectar com o container do Qdrant, recebo o seguinte erro: "Error building Component Qdrant: [Errno 111] Conection refused". Percebi que rodando o Langflow local e com a instancia do Qdrant via docker, Langflow produz os resultados esperados. Porém Rodando o langflow via Docker ele não consegue se conectar.
Reproduction
Error building Component Qdrant: [Errno 111] Conection refused
Expected behavior
ok
Who can help?
No response
Operating System
windows 11
Langflow Version
1.0.17
Python Version
None
Screenshot
No response
Flow File
No response