1、下载安装包
wget 分布式模式快速上手指南 | JuiceFS Document Center
cp juicefs /opt/.
2、安装
/usr/bin/install /opt/soft/juicefs /usr/local/bin/
which juicefs
/usr/local/bin/juicefs
juicefs --help
3、初始化juicefs,管理对象存储
juicefs format \
--storage <对象存储类型> \
--bucket http://<bucket_name>.<bucket地址> \
--access-key <对应的access-key> \
--secret-key <对应的secret-key> \
redis://<redis地址,并指定根节点> \
<目录名>
例如:
juicefs format \
--storage eos \
--bucket http://dw-test.192.168.1.200:10000 \
--access-key 055FT*********QQI39JZG \
--secret-key af2NQZonr**********G6O22FrOjs4v \
redis://192.168.1.201:32628/1 \
myjfs
4、挂载的服务器磁盘
juicefs mount --metrics 0.0.0.0:9567 -d redis://192.168.1.201:32628/1 /data/jfs
如有密码:
META_PASSWORD='密码' juicefs mount --metrics 0.0.0.0:9567 -d redis://192.168.1.201:32628/1 /data/jfs
或者(juicefs mount --metrics 0.0.0.0:9567 -d redis://:密码@192.168.1.201:32628/1 /data/jfs) 如果密码中有特殊字符,可用转义https://blog.csdn.net/jimojianghu/article/details/126391990
5、防止服务器重启,可以将以上命令放到/etc/rc.local中
6、卸载juicefs挂载
juicefs umount /data/jfs
如果umount失败,可以使用fusermount 解决
fusermount -zu /data/jfs
7、Prometheus 指标
##后台启动,并指定metrics绑定 IP
juicefs mount --metrics 0.0.0.0:9567 -d redis://192.168.1.201:32628/1 /data/jfs
http://10.192.1.203:9567/metrics
8、设置gateway服务
cat > /lib/systemd/system/juicefs-gateway.service<<EOF
[Unit]
Description=Juicefs S3 Gateway
Requires=network.target
After=multi-user.target
StartLimitIntervalSec=0
[Service]
Type=simple
User=root
Environment="MINIO_ROOT_USER=<用户名>"
Environment="MINIO_ROOT_PASSWORD=<密码>"
ExecStart=/usr/local/bin/juicefs gateway --cache-size 20480 redis://192.168.1.201:32628/1 0.0.0.0:9567
Restart=on-failure
RestartSec=60
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable juicefs-gateway --now
sudo systemctl status juicefs-gateway
服务启动正常后,可以在web端使用minio访问juicefs里的存储内容。
9、 benchmark 压测
juicefs bench <绑定的目录> -p 4