|
| 1 | +<div align=center> |
| 2 | +<img src="https://raw.githubusercontent.com/CurvineIO/curvine-doc/refs/heads/main/static/img/curvine_logo.svg", width="180" height="200"> |
| 3 | +</div> |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +[](https://opensource.org/licenses/Apache-2.0) |
| 9 | +[](https://www.rust-lang.org) |
| 10 | + |
| 11 | +**Curvine** 是一个用 Rust 编写的高性能、并发分布式缓存系统,专为低延迟和高吞吐量工作负载设计。 |
| 12 | + |
| 13 | +<p align="center"> |
| 14 | + <a href="https://github.com/CurvineIO/curvine/blob/main/README.md">English</a> || |
| 15 | + 简体中文 | |
| 16 | + <a href="https://readme-i18n.com/CurvineIO/curvine?lang=de">Deutsch</a> | |
| 17 | + <a href="https://readme-i18n.com/CurvineIO/curvine?lang=es">Español</a> | |
| 18 | + <a href="https://readme-i18n.com/CurvineIO/curvine?lang=fr">français</a> | |
| 19 | + <a href="https://readme-i18n.com/CurvineIO/curvine?lang=ja">日本語</a> | |
| 20 | + <a href="https://readme-i18n.com/CurvineIO/curvine?lang=ko">한국어</a> | |
| 21 | + <a href="https://readme-i18n.com/CurvineIO/curvine?lang=pt">Português</a> | |
| 22 | + <a href="https://readme-i18n.com/CurvineIO/curvine?lang=ru">Русский</a> |
| 23 | +</p> |
| 24 | + |
| 25 | +## 📚 文档资源 |
| 26 | + |
| 27 | +更多详细信息,请参阅: |
| 28 | + |
| 29 | +- [官方文档](https://curvineio.github.io/docs/Overview/instroduction) |
| 30 | +- [快速入门](https://curvineio.github.io/docs/Deploy/quick-start) |
| 31 | +- [用户手册](https://curvineio.github.io/docs/category/user-manuals) |
| 32 | +- [性能基准](https://curvineio.github.io/docs/category/benchmark) |
| 33 | +- [DeepWiki](https://deepwiki.com/CurvineIO/curvine) |
| 34 | + |
| 35 | +## 应用场景 |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +- **场景1**: 数据洗牌加速 |
| 40 | +- **场景2**: 热表数据加速 |
| 41 | +- **场景3**: 训练加速 |
| 42 | +- **场景4**: 模型分发 |
| 43 | +- **场景5**: 多云数据缓存 |
| 44 | + |
| 45 | +## 🚀 核心特性 |
| 46 | + |
| 47 | +- **高性能 RPC 框架**:基于 Tokio 的异步通信框架,支持高并发请求处理。 |
| 48 | +- **分布式架构**:采用 Master-Worker 架构设计,支持水平扩展。 |
| 49 | +- **多级缓存**:支持内存、SSD 和 HDD 的多级缓存策略。 |
| 50 | +- **FUSE 接口**:提供 FUSE 文件系统接口,可无缝集成到现有系统中。 |
| 51 | +- **底层存储集成**:支持与多种底层存储系统集成。 |
| 52 | +- **Raft 共识**:采用 Raft 算法确保数据一致性与高可用性。 |
| 53 | +- **监控与指标**:内置监控与性能指标收集功能。 |
| 54 | +- **Web 界面**:提供 Web 管理界面,便于系统监控与管理。 |
| 55 | + |
| 56 | +## 🧩 模块化架构 |
| 57 | + |
| 58 | +Curvine 采用模块化设计,主要由以下核心组件构成: |
| 59 | + |
| 60 | +- **orpc**: 一个支持异步 RPC 调用的高性能网络通信框架 |
| 61 | +- **curvine-common**: 包含协议定义、错误处理和通用工具的共享库 |
| 62 | +- **curvine-server**: 服务端组件,包含 Master 和 Worker 实现 |
| 63 | +- **curvine-client**: 提供与服务器交互 API 的客户端库 |
| 64 | +- **curvine-fuse**: FUSE 文件系统接口,支持将 Curvine 挂载为本地文件系统 |
| 65 | +- **curvine-libsdk**: 支持多语言访问的 SDK 库 |
| 66 | +- **curvine-web**: Web 管理界面和 API |
| 67 | +- **curvine-tests**: 测试框架与性能基准测试工具 |
| 68 | + |
| 69 | +## 📦 系统要求 |
| 70 | + |
| 71 | +- Rust 1.80+ |
| 72 | +- Linux 或 macOS (Windows 支持有限) |
| 73 | +- FUSE 库 (用于文件系统功能) |
| 74 | + |
| 75 | +## 🗂️ 缓存文件系统访问 |
| 76 | + |
| 77 | +### 🦀 Rust API (原生集成推荐) |
| 78 | + |
| 79 | +``` |
| 80 | +use curvine_common::conf::ClusterConf; |
| 81 | +use curvine_common::fs::Path; |
| 82 | +use std::sync::Arc; |
| 83 | +
|
| 84 | +let conf = ClusterConf::from(conf_path); |
| 85 | +let rt = Arc::new(conf.client_rpc_conf().create_runtime()); |
| 86 | +let fs = CurvineFileSystem::with_rt(conf, rt)?; |
| 87 | +
|
| 88 | +let path = Path::from_str("/dir")?; |
| 89 | +fs.mkdir(&path).await?; |
| 90 | +``` |
| 91 | + |
| 92 | +### 📌 FUSE (用户空间文件系统) |
| 93 | + |
| 94 | +``` |
| 95 | +ls /curvine-fuse |
| 96 | +``` |
| 97 | + |
| 98 | +**官方支持的 Linux 发行版** |
| 99 | + |
| 100 | +| 操作系统发行版 | 内核要求 | 测试版本 | 依赖项 | |
| 101 | +|---------------------|-------------------|---------------|--------------| |
| 102 | +| **CentOS 7** | ≥3.10.0 | 7.6 | fuse2-2.9.2 | |
| 103 | +| **CentOS 8** | ≥4.18.0 | 8.5 | fuse3-3.9.1 | |
| 104 | +| **Rocky Linux 9** | ≥5.14.0 | 9.5 | fuse3-3.10.2 | |
| 105 | +| **RHEL 9** | ≥5.14.0 | 9.5 | fuse3-3.10.2 | |
| 106 | +| **Ubuntu 9** | ≥5.15.0 | 22.4 | fuse3-3.10.5 | |
| 107 | + |
| 108 | +### 🐘 Hadoop 兼容 API |
| 109 | + |
| 110 | +``` |
| 111 | +import org.apache.hadoop.conf.Configuration; |
| 112 | +import org.apache.hadoop.fs.*; |
| 113 | +
|
| 114 | +Configuration conf = new Configuration(); |
| 115 | +conf.set("fs.cv.impl", "io.curvine.CurvineFileSystem"); |
| 116 | +
|
| 117 | +FileSystem fs = FileSystem.get(URI.create("cv://master:8995"), conf); |
| 118 | +FSDataInputStream in = fs.open(new Path("/user/test/file.txt")); |
| 119 | +``` |
| 120 | + |
| 121 | +## 🛠 构建指南 |
| 122 | + |
| 123 | +本项目需要以下依赖项,请确保在继续之前已安装: |
| 124 | + |
| 125 | +### 📋 先决条件 |
| 126 | + |
| 127 | +- **Rust**: 1.80 或更高版本 ([安装指南](https://www.rust-lang.org/tools/install)) |
| 128 | +- **Protobuf**: 2.x 版本 |
| 129 | +- **Maven**: 3.8 或更高版本 ([安装指南](https://maven.apache.org/install.html)) |
| 130 | +- **LLVM**: 12 或更高版本 ([安装指南](https://llvm.org/docs/GettingStarted.html)) |
| 131 | +- **FUSE**: libfuse2 或 libfuse3 开发包 |
| 132 | +- **JDK**: 1.8 或更高版本 (OpenJDK 或 Oracle JDK) |
| 133 | +- **npm**: 9 或更高版本 ([Node.js 安装](https://nodejs.org/)) |
| 134 | + |
| 135 | +您可以选择: |
| 136 | + |
| 137 | +1. 使用预配置的 `curvine-docker/compile/Dockerfile_rocky9` 来构建编译镜像 |
| 138 | +2. 参考此 Dockerfile 为其他操作系统版本创建编译镜像 |
| 139 | + |
| 140 | +### 🚀 构建步骤 (Linux - Ubuntu/Debian 示例) |
| 141 | + |
| 142 | +```bash |
| 143 | +# Compiled files are in build/dist |
| 144 | +sh build/build.sh |
| 145 | +``` |
| 146 | + |
| 147 | +编译成功后,目标文件将生成在 build/dist 目录中。该文件是可用于部署或构建镜像的 Curvine 安装包。 |
| 148 | + |
| 149 | +### 🖥️ 启动单节点集群 |
| 150 | + |
| 151 | +```bash |
| 152 | +cd build/dist |
| 153 | + |
| 154 | +# Start the master node |
| 155 | +bin/curvine-master.sh start |
| 156 | + |
| 157 | +# Start the worker node |
| 158 | +bin/curvine-worker.sh start |
| 159 | +``` |
| 160 | + |
| 161 | +挂载文件系统 |
| 162 | + |
| 163 | +```bash |
| 164 | +# The default mount point is /curvine-fuse |
| 165 | +bin/curvine-fuse.sh start |
| 166 | +``` |
| 167 | + |
| 168 | +查看集群概览: |
| 169 | + |
| 170 | +```bash |
| 171 | +bin/curvine report |
| 172 | +``` |
| 173 | + |
| 174 | +使用兼容的 HDFS 命令访问文件系统: |
| 175 | + |
| 176 | +```bash |
| 177 | +bin/curvine fs -mkdir /a |
| 178 | +bin/curvine fs -ls / |
| 179 | +``` |
| 180 | + |
| 181 | +访问 Web 界面: |
| 182 | + |
| 183 | +``` |
| 184 | +http://your-hostname:9000 |
| 185 | +``` |
| 186 | + |
| 187 | +Curvine 使用 TOML 格式的配置文件。示例配置位于 conf/curvine-cluster.toml,主要配置项包括: |
| 188 | + |
| 189 | +- 网络设置(端口、地址等) |
| 190 | +- 存储策略(缓存大小、存储类型) |
| 191 | +- 集群配置(节点数量、副本因子) |
| 192 | +- 性能调优参数 |
| 193 | + |
| 194 | +## 🏗️ 架构设计 |
| 195 | + |
| 196 | +Curvine 采用主从架构: |
| 197 | + |
| 198 | +- **主节点**:负责元数据管理、工作节点协调和负载均衡 |
| 199 | +- **工作节点**:负责数据存储和处理 |
| 200 | +- **客户端**:通过 RPC 与主节点和工作节点通信 |
| 201 | + |
| 202 | +该系统使用 Raft 共识算法确保元数据一致性,并支持多种存储策略(内存、SSD、HDD)以优化性能和成本。 |
| 203 | + |
| 204 | +## 📈 性能表现 |
| 205 | + |
| 206 | +Curvine 在高并发场景下表现优异,支持: |
| 207 | + |
| 208 | +- 高吞吐量数据读写 |
| 209 | +- 低延迟操作 |
| 210 | +- 大规模并发连接 |
| 211 | + |
| 212 | +## 📜 许可证 |
| 213 | + |
| 214 | +Curvine 采用 **[Apache License 2.0](LICENSE)** 开源协议授权。 |
| 215 | + |
| 216 | +## 星标历史 |
| 217 | + |
| 218 | +[](https://www.star-history.com/#CurvineIO/curvine&Date) |
0 commit comments