使用juicefs 让s3 更好兼容posix协议
juicefs 是一个很不错的云原生高性能共享文件系统,以下是s3的测试
环境准备
- docker-compose
version: "3"
services:
s3:
image: minio/minio
environment:
- "MINIO_ACCESS_KEY=minio"
- "MINIO_SECRET_KEY=minio123"
command: server /data --console-address ":9001"
ports:
- "9000:9000"
- "9001:9001"
- juicefs mac 客户端
可以参考官方资料
https://www.cnblogs.com/rongfengliang/p/15734513.html
使用
测试多客户端挂载文件通知
- format
juicefs format \
--storage minio \
--bucket http://localhost:9000/appdemo \
--bucket http://localhost:9000/appdemo2 \
--bucket http://localhost:9000/appdemo4 \
--access-key minio \
--secret-key minio123 \
sqlite3://myjfs.db \
miniofs
- mount
juicefs mount sqlite3://myjfs.db miniofs
juicefs mount sqlite3://myjfs.db miniofs2
- nodejs watch 文件
基于chokidar
const chokidar = require('chokidar');
const watcher = chokidar.watch(["/Users/dalong/mylearning/juicefs-rongfl/miniofs","/Users/dalong/mylearning/juicefs-rongfl/miniofs2"], {
ignored: /(^|[\/\\\\])\../, // ignore dotfiles
persistent: true
});
// Something to use when events are received.
const log = console.log.bind(console);
// More possible events.
watcher
.on('addDir', path => log(`Directory ${path} has been added`))
.on('unlinkDir', path => log(`Directory ${path} has been removed`))
.on('error', error => log(`Watcher error: ${error}`))
.on('ready', () => log('Initial scan complete. Ready for changes'))
.on('raw', (event, path, details) => { // internal
log('Raw event info:', event, path, details);
});
- 效果
说明
以上是基于juicefs 可以很明显的提升s3 挂载的性能,而且可以更好的兼容posix(尤其是进行多端挂载进行文件处理的时候),大家如果在测试
s3fs-fuse 的时候是不能达到多端挂载实时数据变动通知的(可以参考Limitations章节)
参考资料
https://www.npmjs.com/package/chokidar
https://juicefs.com/docs/zh/community/getting-started/for_distributed
https://github.com/s3fs-fuse/s3fs-fuse
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2020-12-27 vlang 0.2 试用&&火焰图简单查看
2020-12-27 micro 试用
2020-12-27 micro cloud native 开发平台
2020-12-27 cespare/reflex 基于golang 编写的文件变动监听&&任务执行
2020-12-27 api2html 试用
2020-12-27 api2html go mod 支持以及dockerfile 修改
2019-12-27 snap 方便的多平台软件包管理工具使用