文档:https://github.com/infiniflow/ragflow
RAGFlow 是一款基于深度文档理解构建的开源 RAG(Retrieval-Augmented Generation)引擎。RAGFlow 可以为各种规模的企业及个人提供一套精简的 RAG 工作流程,结合大语言模型(LLM)针对用户各类不同的复杂格式数据提供可靠的问答以及有理有据的引用。
前提条件
- CPU >= 4 核
- RAM >= 16 GB
- Disk >= 50 GB
- Docker >= 24.0.0 & Docker Compose >= v2.26.1
安装
- 确保
<font style="color:rgb(31, 35, 40);">vm.max_map_count</font>
不小于 262144:
如需确认 vm.max_map_count
的大小:
$ sysctl vm.max_map_count
如果 vm.max_map_count
的值小于 262144,可以进行重置:
# 这里我们设为 262144:
$ sudo sysctl -w vm.max_map_count=262144
你的改动会在下次系统重启时被重置。如果希望做永久改动,还需要在 /etc/sysctl.conf 文件里把 vm.max_map_count
的值再相应更新一遍:
vm.max_map_count=262144
- 克隆仓库:
$ git clone https://github.com/infiniflow/ragflow.git
- 进入 docker 文件夹,利用提前编译好的 Docker 镜像启动服务器:
运行以下命令会自动下载 RAGFlow slim Docker 镜像 v0.17.0-slim
。请参考下表查看不同 Docker 发行版的描述。如需下载不同于 v0.17.0-slim
的 Docker 镜像,请在运行 docker compose
启动服务之前先更新 docker/.env 文件内的 RAGFLOW_IMAGE
变量。比如,你可以通过设置 RAGFLOW_IMAGE=infiniflow/ragflow:v0.17.0
来下载 RAGFlow 镜像的 v0.17.0
完整发行版。
$ cd ragflow/docker
$ docker compose -f docker-compose.yml up -d
- 确认服务器状态:
$ docker logs -f ragflow-server
出现以下界面提示说明服务器启动成功:
____ ___ ______ ______ __
/ __ \ / | / ____// ____// /____ _ __
/ /_/ // /| | / / __ / /_ / // __ \| | /| / /
/ _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ /
/_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/
* Running on all addresses (0.0.0.0)
- 在你的浏览器中输入你的服务器对应的 IP 地址并登录 RAGFlow。
Dify使用
- 创建一个知识库
- 通过接口查询知识库的id
接口可以在RAGFlow中查看
真实情况中,请求方式get
- 在Dify中添加外部知识库API
- 连接外部知识库
- 测试
常见报错
- ragflow-es-01容器不断重启,报错
{“@timestamp”:“2025-03-04T02:53:13.877Z”, “log.level”:“ERROR”, “message”:“fatal exception while booting Elasticsearch”, “ecs.version”: “1.2.0”,“service.name”:“ES_ECS”,“event.dataset”:“elasticsearch.server”,“process.thread.name”:“main”,“log.logger”:“org.elasticsearch.bootstrap.Elasticsearch”,“elasticsearch.node.name”:“es01”,“elasticsearch.cluster.name”:“docker-cluster”,“error.type”:“java.lang.IllegalStateException”,“error.message”:“failed to obtain node locks, tried [/usr/share/elasticsearch/data]; maybe these locations are not writable or multiple nodes were started on the same data path?”,“error.stack_trace”:“java.lang.IllegalStateException: failed to obtain node locks, tried [/usr/share/elasticsearch/data]; maybe these locations are not writable or multiple nodes were started on the same data path?\n\tat [email protected]/org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:294)\n\tat [email protected]/org.elasticsearch.node.Node.(Node.java:499)\n\tat [email protected]/org.elasticsearch.node.Node.(Node.java:344)\n\tat [email protected]/org.elasticsearch.bootstrap.ElasticsearchKaTeX parse error: Undefined control sequence: \n at position 33: …earch.java:236)\̲n̲\tat org.elasti…NodeLock.(NodeEnvironment.java:239)\n\tat [email protected]/org.elasticsearch.env.NodeEnvironmentKaTeX parse error: Undefined control sequence: \n at position 42: …nment.java:206)\̲n̲\tat org.elasti…NodeLock.(NodeEnvironment.java:232)\n\t… 7 more\n\tSuppressed: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/node.lock\n\t\tat java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)\n\t\tat java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)\n\t\tat java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)\n\t\tat java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:261)\n\t\tat java.base/java.nio.file.Files.newByteChannel(Files.java:379)\n\t\tat java.base/java.nio.file.Files.createFile(Files.java:657)\n\t\tat [email protected]/org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:84)\n\t\t… 10 more\n”
- ragflow-server容器日志中报错
网络有问题,无法连接到OpenAI下载到gpt-3.5-turbo的分词器。
可以在docker-compose.yml中为ragflow-server容器添加网络代理
或者
使用完整版的RAGFlow镜像,在.env文件中修改
或者