使用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

posted on   荣锋亮  阅读(492)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.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 方便的多平台软件包管理工具使用

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示